Codeforces Round 639 (Div. 1)

Solutions are presented as using the least memory and the fastest execution time. It also takes the top 10 most recent solutions from each language. If you want to limit to a specific index, click the "Solved" button and go to that problem.

ContestId
Name
Phase
Frozen
Duration (Seconds)
Relative Time
Start Time
1344 Codeforces Round 639 (Div. 1) FINISHED False 8100 148404263 May 6, 2020, 2:35 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 6123 ) B Monopole Magnets PROGRAMMING constructive algorithms dfs and similar ds graphs 2000

B'A monopole magnet is a magnet that only has one pole, either north or south. They don 't actually exist since real magnets have two poles, but this is a programming contest problem, so we don 't care. There is an n x m grid. Initially, you may place some north magnets and some south magnets into the cells. You are allowed to place as many magnets as you like, even multiple in the same cell. An operation is performed as follows. Choose a north magnet and a south magnet to activate. If they are in the same row or the same column and they occupy different cells, then the north magnet moves one unit closer to the south magnet. Otherwise, if they occupy the same cell or do not share a row or column, then nothing changes. Note that the south magnets are immovable. Each cell of the grid is colored black or white. Let 's consider ways to place magnets in the cells so that the following conditions are met. Determine if it is possible to place magnets such that these conditions are met. If it is possible, find the minimum number of north magnets required (there are no requirements on the number of south magnets). The first line contains two integers n and m ( 1 <= n,m <= 1000 ) -- the number of rows and the number of columns, respectively. The next n lines describe the coloring. The i -th of these lines contains a string of length m , where the j -th character denotes the color of the cell in row i and column j . The characters "#" and "." represent black and white, respectively. It is guaranteed, that the string will not contain any other characters. Output a single integer, the minimum possible number of north magnets required. If there is no placement of magnets that satisfies all conditions, print a single integer -1 . In the first test, here is an example placement of magnets: In the second test, we can show that no required placement of magnets exists. Here are three example placements that fail to'...

Tutorials

Codeforces Round #639 Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
79176084 hos.lyric B May 6, 2020, 3:16 p.m. OK D TESTS 69 78 18534400 2000
79170996 Gassa B May 6, 2020, 3:07 p.m. OK D TESTS 69 124 28979200 2000
79186905 physics0523 B May 6, 2020, 3:41 p.m. OK GNU C11 TESTS 69 62 21504000 2000
79326368 rabs00 B May 7, 2020, 8:45 p.m. OK GNU C++11 TESTS 69 31 9728000 2000
79180424 AristocratMarser B May 6, 2020, 3:25 p.m. OK GNU C++11 TESTS 69 31 14028800 2000
79189175 Golden_Time B May 6, 2020, 3:46 p.m. OK GNU C++11 TESTS 69 46 4710400 2000
79192562 Pigbrain B May 6, 2020, 3:55 p.m. OK GNU C++11 TESTS 69 46 4915200 2000
79178498 Deep_Kevin B May 6, 2020, 3:21 p.m. OK GNU C++11 TESTS 69 46 5939200 2000
79168177 01191020csl B May 6, 2020, 3:03 p.m. OK GNU C++11 TESTS 69 46 5939200 2000
79214598 GGMU B May 6, 2020, 11:22 p.m. OK GNU C++11 TESTS 69 46 5939200 2000
79243655 vjudge5 B May 7, 2020, 7:29 a.m. OK GNU C++11 TESTS 69 46 8908800 2000
79216542 yasugongshang B May 7, 2020, 12:18 a.m. OK GNU C++11 TESTS 69 46 9011200 2000
79345824 Chirography_11 B May 8, 2020, 5:24 a.m. OK GNU C++11 TESTS 69 46 9011200 2000
79173841 schtomi97 B May 6, 2020, 3:13 p.m. OK GNU C++14 TESTS 69 46 4710400 2000
79182804 mnaveenkumar2009 B May 6, 2020, 3:30 p.m. OK GNU C++14 TESTS 69 46 4915200 2000
79208135 Ernestico B May 6, 2020, 8:58 p.m. OK GNU C++14 TESTS 69 46 5017600 2000
79261931 as2341567 B May 7, 2020, 11:12 a.m. OK GNU C++14 TESTS 69 46 5017600 2000
79180731 mwisniewski B May 6, 2020, 3:26 p.m. OK GNU C++14 TESTS 69 46 5427200 2000
79220095 txingml B May 7, 2020, 1:49 a.m. OK GNU C++14 TESTS 69 46 5734400 2000
79172771 aarr B May 6, 2020, 3:10 p.m. OK GNU C++14 TESTS 69 46 5734400 2000
79434423 shashi_trent B May 9, 2020, 5:58 a.m. OK GNU C++14 TESTS 69 46 5734400 2000
79243810 AuqaKyz B May 7, 2020, 7:31 a.m. OK GNU C++14 TESTS 69 46 5939200 2000
79317291 ascent B May 7, 2020, 6:26 p.m. OK GNU C++14 TESTS 69 46 5939200 2000
79180755 1252351876 B May 6, 2020, 3:26 p.m. OK GNU C++17 TESTS 69 31 9011200 2000
79241321 Sofapuden B May 7, 2020, 7:04 a.m. OK GNU C++17 TESTS 69 46 3788800 2000
79329808 Nanored B May 7, 2020, 10:01 p.m. OK GNU C++17 TESTS 69 46 3891200 2000
79200827 Intrincantation B May 6, 2020, 4:38 p.m. OK GNU C++17 TESTS 69 46 4198400 2000
79191491 Lich_Ning B May 6, 2020, 3:52 p.m. OK GNU C++17 TESTS 69 46 4710400 2000
79180400 Giver B May 6, 2020, 3:25 p.m. OK GNU C++17 TESTS 69 46 4812800 2000
79215538 spaceleo B May 6, 2020, 11:49 p.m. OK GNU C++17 TESTS 69 46 4812800 2000
79164564 wrong B May 6, 2020, 2:57 p.m. OK GNU C++17 TESTS 69 46 4915200 2000
79179155 littlewhite.2 B May 6, 2020, 3:24 p.m. OK GNU C++17 TESTS 69 46 4915200 2000
79168036 Mr.Robot_28 B May 6, 2020, 3:03 p.m. OK GNU C++17 TESTS 69 46 5324800 2000
79236988 Micc B May 7, 2020, 6:19 a.m. OK GNU C++17 (64) TESTS 69 31 6144000 2000
79213381 iynaur87 B May 6, 2020, 10:51 p.m. OK GNU C++17 (64) TESTS 69 46 6144000 2000
79176517 Maksim1744 B May 6, 2020, 3:17 p.m. OK GNU C++17 (64) TESTS 69 46 6144000 2000
79225008 meox B May 7, 2020, 3:29 a.m. OK GNU C++17 (64) TESTS 69 46 6348800 2000
79459457 ir_1st_vil B May 9, 2020, 11:44 a.m. OK GNU C++17 (64) TESTS 69 46 6348800 2000
79357570 achvanov B May 8, 2020, 8:11 a.m. OK GNU C++17 (64) TESTS 69 46 6348800 2000
79175355 uruuru8888 B May 6, 2020, 3:15 p.m. OK GNU C++17 (64) TESTS 69 46 6348800 2000
79168959 Marckess B May 6, 2020, 3:04 p.m. OK GNU C++17 (64) TESTS 69 46 8396800 2000
79168609 Geothermal B May 6, 2020, 3:03 p.m. OK GNU C++17 (64) TESTS 69 46 9318400 2000
79426521 WGree B May 9, 2020, 2:58 a.m. OK GNU C++17 (64) TESTS 69 46 9420800 2000
79267778 wang.senyuan B May 7, 2020, 12:18 p.m. OK Go TESTS 69 233 220364800 2000
79214852 Lewin B May 6, 2020, 11:30 p.m. OK Java 11 TESTS 69 233 27955200 2000
79179672 uwi B May 6, 2020, 3:24 p.m. OK Java 11 TESTS 69 249 24166400 2000
79371453 half_blood000 B May 8, 2020, 11:14 a.m. OK Java 11 TESTS 69 264 87756800 2000
79389501 adarsh000321 B May 8, 2020, 2:55 p.m. OK Java 11 TESTS 69 265 87756800 2000
79173534 cirno3153 B May 6, 2020, 3:12 p.m. OK Java 11 TESTS 69 280 23961600 2000
79183788 awesomelemonade B May 6, 2020, 3:32 p.m. OK Java 11 TESTS 69 280 30412800 2000
79211172 TheSawan B May 6, 2020, 10:03 p.m. OK Java 11 TESTS 69 280 71884800 2000
79389277 adarsh000321 B May 8, 2020, 2:52 p.m. OK Java 11 TESTS 69 280 87654400 2000
79179500 dusty.and.rusty B May 6, 2020, 3:24 p.m. OK Java 11 TESTS 69 608 125337600 2000
79252096 DarLam B May 7, 2020, 9:08 a.m. OK Java 8 TESTS 69 140 20787200 2000
79211890 SecondThread B May 6, 2020, 10:18 p.m. OK Java 8 TESTS 69 171 20684800 2000
79169889 Xylenox B May 6, 2020, 3:06 p.m. OK Java 8 TESTS 69 171 20684800 2000
79170115 fetetriste B May 6, 2020, 3:06 p.m. OK Java 8 TESTS 69 171 25190400 2000
79171156 Harpae B May 6, 2020, 3:08 p.m. OK Java 8 TESTS 69 171 27545600 2000
79197063 golions B May 6, 2020, 4:14 p.m. OK Java 8 TESTS 69 186 84377600 2000
79164570 cwise B May 6, 2020, 2:57 p.m. OK Java 8 TESTS 69 187 29696000 2000
79260139 StayAwayFromBitches B May 7, 2020, 10:50 a.m. OK Java 8 TESTS 69 187 84992000 2000
79183238 DanielW48 B May 6, 2020, 3:31 p.m. OK Java 8 TESTS 69 202 20684800 2000
79200324 Sharon B May 6, 2020, 4:34 p.m. OK Java 8 TESTS 69 202 21094400 2000
79169742 Eva B May 6, 2020, 3:05 p.m. OK Kotlin TESTS 69 187 21606400 2000
79176940 elizarov B May 6, 2020, 3:18 p.m. OK Kotlin TESTS 69 280 27955200 2000
79169802 Tlatoani B May 6, 2020, 3:05 p.m. OK Kotlin TESTS 69 452 44032000 2000
79183424 mban259 B May 6, 2020, 3:32 p.m. OK Mono C# TESTS 69 124 17408000 2000
79166973 Yupiteru B May 6, 2020, 3:01 p.m. OK Mono C# TESTS 69 202 40448000 2000
79183488 keymoon B May 6, 2020, 3:32 p.m. OK Mono C# TESTS 69 561 92262400 2000
79208110 lxhgww B May 6, 2020, 8:58 p.m. OK MS C++ TESTS 69 46 14950400 2000
79185887 Pasqual45 B May 6, 2020, 3:38 p.m. OK MS C++ 2017 TESTS 69 46 5120000 2000
79181940 vpike B May 6, 2020, 3:28 p.m. OK MS C++ 2017 TESTS 69 46 5939200 2000
79217002 pichulia B May 7, 2020, 12:31 a.m. OK MS C++ 2017 TESTS 69 46 16793600 2000
79185078 P___ B May 6, 2020, 3:35 p.m. OK MS C++ 2017 TESTS 69 46 36864000 2000
79241830 kupriyanov B May 7, 2020, 7:09 a.m. OK MS C++ 2017 TESTS 69 77 46080000 2000
79217006 areo B May 7, 2020, 12:32 a.m. OK MS C++ 2017 TESTS 69 77 57241600 2000
79182173 alex_36 B May 6, 2020, 3:29 p.m. OK MS C++ 2017 TESTS 69 93 9523200 2000
79177169 Seyaua B May 6, 2020, 3:19 p.m. OK MS C++ 2017 TESTS 69 108 43929600 2000
79179788 tarattata1 B May 6, 2020, 3:24 p.m. OK MS C++ 2017 TESTS 69 109 12800000 2000
79175762 BpeMeHHa91_TryDHocTb B May 6, 2020, 3:16 p.m. OK MS C++ 2017 TESTS 69 171 24780800 2000
79171847 pajenegod B May 6, 2020, 3:09 p.m. OK PyPy 2 TESTS 69 234 48844800 2000
79176040 malylesio B May 6, 2020, 3:16 p.m. OK PyPy 3 TESTS 69 312 43622400 2000
79173442 tamato B May 6, 2020, 3:12 p.m. OK PyPy 3 TESTS 69 374 33587200 2000
79273927 codershuvo B May 7, 2020, 1:29 p.m. OK PyPy 3 TESTS 69 389 45977600 2000
79173508 mees B May 6, 2020, 3:12 p.m. OK PyPy 3 TESTS 69 405 50380800 2000
79186638 tanon710 B May 6, 2020, 3:39 p.m. OK PyPy 3 TESTS 69 483 52838400 2000
79169639 pineriver B May 6, 2020, 3:05 p.m. OK PyPy 3 TESTS 69 514 69427200 2000
79207218 titia B May 6, 2020, 8:39 p.m. OK PyPy 3 TESTS 69 561 67686400 2000
79179528 neterukun B May 6, 2020, 3:24 p.m. OK PyPy 3 TESTS 69 577 71372800 2000
79211040 PBatch B May 6, 2020, 10 p.m. OK PyPy 3 TESTS 69 592 74035200 2000
79172317 anagohirame B May 6, 2020, 3:09 p.m. OK PyPy 3 TESTS 69 608 33484800 2000
79221070 mkawa2 B May 7, 2020, 2:13 a.m. OK Python 3 TESTS 69 811 12595200 2000
79179703 Nanored B May 6, 2020, 3:24 p.m. OK Python 3 TESTS 69 920 7475200 2000
79183885 darkkcyan B May 6, 2020, 3:33 p.m. OK Rust TESTS 69 46 5939200 2000
79241339 cotton100pc B May 7, 2020, 7:04 a.m. OK Rust TESTS 69 62 6348800 2000
79240160 yuya178 B May 7, 2020, 6:52 a.m. OK Rust TESTS 69 62 10547200 2000
79434941 sansen B May 9, 2020, 6:06 a.m. OK Rust TESTS 69 62 20377600 2000

remove filters

Back to search problems