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 |
|---|---|---|---|---|---|---|
| 1779 | Hello 2023 | FINISHED | False | 9000 | 103649123 | Jan. 3, 2023, 2:35 p.m. |
Solved |
Index |
Name |
Type |
Tags |
Community Tag |
Rating |
|---|---|---|---|---|---|---|
| ( 170 ) | H | Olympic Team Building | PROGRAMMING | brute force meet-in-the-middle |
Iron and Werewolf are participating in a chess Olympiad, so they want to practice team building. They gathered (n) players, where (n) is a power of (2), and they will play sports. Iron and Werewolf are among those (n) people. One of the sports is tug of war. For each (1\leq i \leq n), the (i)-th player has strength (s_i). Elimination rounds will be held until only one player remains — we call that player the absolute winner . In each round: Assume that (m>1) players are still in the game, where (m) is a power of (2). The (m) players are split into two teams of equal sizes (i. e., with (m/2) players in each team). The strength of a team is the sum of the strengths of its players. If the teams have equal strengths, Iron chooses who wins; otherwise, the stronger team wins. Every player in the losing team is eliminated, so (m/2) players remain. Iron already knows each player's strength and is wondering who can become the absolute winner and who can't if he may choose how the teams will be formed in each round, as well as the winning team in case of equal strengths . The first line contains a single integer (n) ((4 \leq n \leq 32)) — the number of players participating in tug of war. It is guaranteed that (n) is a power of (2). The second line consists of a sequence (s_1,s_2, \ldots, s_n) of integers ((1 \leq s_i \leq 10^{15})) — the strengths of the players. In a single line output a binary string (s) of length (n) — the (i)-th character of (s) should be (1) if the (i)-th player can become the absolute winner and it should be (0) otherwise. In the first example, players (1) and (4) with their respective strengths of (60) and (87) can become the absolute winners . Let's describe the process for player (1). Firstly, we divide the players into teams (1,3) and (2,4). Strengths of those two teams are (60+59=119) and $$$32+87=11 |
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
|---|---|---|---|---|---|---|---|---|---|---|---|
| 187832305 | rainboy | H | Jan. 3, 2023, 5:03 p.m. | OK | GNU C11 | TESTS | 123 | 1309 | 4300800 | ||
| 187870036 | haseennurayin | H | Jan. 4, 2023, 4:12 a.m. | OK | GNU C++14 | TESTS | 123 | 1825 | 102400 | ||
| 187844066 | expectation_04 | H | Jan. 3, 2023, 6:49 p.m. | OK | GNU C++17 | TESTS | 123 | 31 | 1024000 | ||
| 187845525 | Radewoosh | H | Jan. 3, 2023, 7:04 p.m. | OK | GNU C++17 | TESTS | 123 | 1918 | 5017600 | ||
| 187840547 | LJC00118 | H | Jan. 3, 2023, 6:21 p.m. | OK | GNU C++17 (64) | TESTS | 123 | 46 | 11571200 | ||
| 187863438 | orzdevinwang | H | Jan. 4, 2023, 2:04 a.m. | OK | GNU C++17 (64) | TESTS | 123 | 62 | 819200 | ||
| 187830071 | hitonanode | H | Jan. 3, 2023, 4:58 p.m. | OK | GNU C++17 (64) | TESTS | 123 | 1107 | 1945600 | ||
| 187852378 | Benq | H | Jan. 3, 2023, 8:44 p.m. | OK | GNU C++17 (64) | TESTS | 123 | 1606 | 0 | ||
| 187839198 | hehehhehe | H | Jan. 3, 2023, 6:12 p.m. | OK | GNU C++20 (64) | TESTS | 123 | 30 | 307200 | ||
| 187875451 | Rebelz | H | Jan. 4, 2023, 5:30 a.m. | OK | GNU C++20 (64) | TESTS | 123 | 31 | 102400 | ||
| 187853354 | zxcuser1 | H | Jan. 3, 2023, 9:05 p.m. | OK | GNU C++20 (64) | TESTS | 123 | 31 | 409600 | ||
| 187875341 | Rebelz | H | Jan. 4, 2023, 5:29 a.m. | OK | GNU C++20 (64) | TESTS | 123 | 78 | 102400 | ||
| 187855041 | rqi | H | Jan. 3, 2023, 9:46 p.m. | OK | GNU C++20 (64) | TESTS | 123 | 343 | 0 | ||
| 187875314 | Rebelz | H | Jan. 4, 2023, 5:29 a.m. | OK | GNU C++20 (64) | TESTS | 123 | 546 | 102400 | ||
| 187833611 | jiangly_fan | H | Jan. 3, 2023, 5:04 p.m. | OK | GNU C++20 (64) | TESTS | 123 | 920 | 0 | ||
| 187873151 | nuraziZ | H | Jan. 4, 2023, 5:01 a.m. | OK | GNU C++20 (64) | TESTS | 123 | 1123 | 0 | ||
| 187842043 | DoNotForget | H | Jan. 3, 2023, 6:31 p.m. | OK | GNU C++20 (64) | TESTS | 123 | 1560 | 102400 | ||
| 187837404 | abcd_1 | H | Jan. 3, 2023, 6:04 p.m. | OK | GNU C++20 (64) | TESTS | 123 | 1606 | 0 |
Back to search problems