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 |
---|---|---|---|---|---|---|
1784 | VK Cup 2022 - Финальный раунд (Engine) | FINISHED | False | 10800 | 56224499 | Feb. 5, 2023, 12:05 p.m. |
Solved$ |
Index |
Name |
Type |
Tags |
Community Tag |
Rating |
---|---|---|---|---|---|---|
( 3358 ) | B | Letter Exchange | PROGRAMMING | constructive algorithms constructive algorithms |
B'A cooperative game is played by m people. In the game, there are 3m sheets of paper: m sheets with letter 'w ', m sheets with letter 'i ', and m sheets with letter 'n '. Initially, each person is given three sheets (possibly with equal letters). The goal of the game is to allow each of the m people to spell the word "win" using their sheets of paper. In other words, everyone should have one sheet with letter 'w ', one sheet with letter 'i ', and one sheet with letter 'n '. To achieve the goal, people can make exchanges. Two people participate in each exchange. Both of them choose exactly one sheet of paper from the three sheets they own and exchange it with each other. Find the shortest sequence of exchanges after which everyone has one 'w ', one 'i ', and one 'n '. Each test contains multiple test cases. The first line contains the number of test cases t ( 1 <= t <= 10^4 ). The description of the test cases follows. The first line of each test case contains a single integer m ( 2 <= m <= 10^5 ) -- the number of people. The i -th of the next m lines contains a string s_i of length 3 consisting of lowercase English letters 'w ', 'i ', and 'n ', denoting the letters person i has on their sheets of paper at the beginning of the game, in arbitrary order. Each of the letters 'w ', 'i ', and 'n ' appears on the sheets of paper exactly m times in total. It is guaranteed that the sum of m over all test cases does not exceed 10^5 . For each test case, print a non-negative integer k -- the smallest number of exchanges people need to make everyone have one 'w ', one 'i ', and one 'n '. In each of the next k lines print four tokens a_1 c_1 a_2 c_2 , describing the exchanges in chronological order ( 1 <= a_1, a_2 <= m ; a_1 ne a_2 ; c_1, c_2 are one of { mathtt{w}, mathtt{i}, mathtt{n} } ): person a_1 gives lett'... |
Codeforces Round #850 Editorial |
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
---|---|---|---|---|---|---|---|---|---|---|---|
192408453 | william556 | B | Feb. 6, 2023, 12:49 a.m. | OK | GNU C++14 | TESTS | 32 | 46 | 5529600 | ||
192404259 | zltzlt | B | Feb. 5, 2023, 11:15 p.m. | OK | GNU C++14 | TESTS | 32 | 61 | 8396800 | ||
192415965 | rui_er | B | Feb. 6, 2023, 3:23 a.m. | OK | GNU C++14 | TESTS | 32 | 62 | 7680000 | ||
192405595 | liujunyi123 | B | Feb. 5, 2023, 11:45 p.m. | OK | GNU C++14 | TESTS | 32 | 77 | 14438400 | ||
192410040 | zuytong | B | Feb. 6, 2023, 1:27 a.m. | OK | GNU C++14 | TESTS | 32 | 78 | 5836800 | ||
192415678 | jiangzhihui | B | Feb. 6, 2023, 3:18 a.m. | OK | GNU C++14 | TESTS | 32 | 78 | 7475200 | ||
192425482 | dongyinjie001 | B | Feb. 6, 2023, 5:52 a.m. | OK | GNU C++14 | TESTS | 32 | 78 | 22835200 | ||
192408092 | VinstaG173 | B | Feb. 6, 2023, 12:40 a.m. | OK | GNU C++14 | TESTS | 32 | 93 | 34201600 | ||
192407829 | Leasier | B | Feb. 6, 2023, 12:34 a.m. | OK | GNU C++14 | TESTS | 32 | 124 | 5324800 | ||
192412314 | Alan_dong | B | Feb. 6, 2023, 2:17 a.m. | OK | GNU C++14 | TESTS | 32 | 139 | 4505600 | ||
192377818 | Azimjonm0012 | B | Feb. 5, 2023, 5:59 p.m. | OK | GNU C++17 | TESTS | 32 | 62 | 4608000 | ||
192417143 | kidcodeforces | B | Feb. 6, 2023, 3:45 a.m. | OK | GNU C++17 | TESTS | 32 | 93 | 7168000 | ||
192402898 | rb_r | B | Feb. 5, 2023, 10:49 p.m. | OK | GNU C++17 | TESTS | 32 | 264 | 25702400 | ||
192290093 | 353cerega | B | Feb. 5, 2023, 12:20 p.m. | OK | GNU C++17 (64) | TESTS | 32 | 92 | 16896000 | ||
192413819 | Once_I_Liked_AGirl | B | Feb. 6, 2023, 2:45 a.m. | OK | GNU C++17 (64) | TESTS | 32 | 93 | 13414400 | ||
192415122 | hokarikanae | B | Feb. 6, 2023, 3:08 a.m. | OK | GNU C++17 (64) | TESTS | 32 | 233 | 14848000 | ||
192420769 | Physics212303 | B | Feb. 6, 2023, 4:45 a.m. | OK | GNU C++17 (64) | TESTS | 32 | 296 | 5836800 | ||
192411748 | PEKKA_l | B | Feb. 6, 2023, 2:06 a.m. | OK | GNU C++17 (64) | TESTS | 32 | 327 | 6348800 | ||
192415430 | yemuzhe | B | Feb. 6, 2023, 3:14 a.m. | OK | GNU C++17 (64) | TESTS | 32 | 1279 | 5324800 | ||
192291573 | budalnik | B | Feb. 5, 2023, 12:22 p.m. | OK | GNU C++20 (64) | TESTS | 32 | 46 | 5836800 | ||
192292284 | Kirill22 | B | Feb. 5, 2023, 12:24 p.m. | OK | GNU C++20 (64) | TESTS | 32 | 46 | 14745600 | ||
192297277 | Maksim1744 | B | Feb. 5, 2023, 12:33 p.m. | OK | GNU C++20 (64) | TESTS | 32 | 61 | 5017600 | ||
192411413 | Awesome3.14 | B | Feb. 6, 2023, 1:58 a.m. | OK | GNU C++20 (64) | TESTS | 32 | 61 | 5632000 | ||
192290770 | never_giveup | B | Feb. 5, 2023, 12:21 p.m. | OK | GNU C++20 (64) | TESTS | 32 | 62 | 6348800 | ||
192293584 | Kapt | B | Feb. 5, 2023, 12:26 p.m. | OK | GNU C++20 (64) | TESTS | 32 | 77 | 5939200 | ||
192296279 | Mangooste | B | Feb. 5, 2023, 12:31 p.m. | OK | GNU C++20 (64) | TESTS | 32 | 77 | 10240000 | ||
192295981 | isaf27 | B | Feb. 5, 2023, 12:30 p.m. | OK | GNU C++20 (64) | TESTS | 32 | 77 | 13926400 | ||
192295914 | Ormlis | B | Feb. 5, 2023, 12:30 p.m. | OK | GNU C++20 (64) | TESTS | 32 | 78 | 5939200 | ||
192306000 | Allvik06 | B | Feb. 5, 2023, 12:50 p.m. | OK | GNU C++20 (64) | TESTS | 32 | 108 | 23142400 | ||
192299611 | Egor | B | Feb. 5, 2023, 12:37 p.m. | OK | Rust 2021 | TESTS | 32 | 46 | 10752000 |
Back to search problems