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 |
---|---|---|---|---|---|---|
1515 | Codeforces Global Round 14 | FINISHED | False | 10800 | 117386711 | May 2, 2021, 2:35 p.m. |
Solved$ |
Index |
Name |
Type |
Tags |
Community Tag |
Rating |
---|---|---|---|---|---|---|
( 17434 ) | C | Phoenix and Towers | PROGRAMMING | constructive algorithms data structures greedy |
B"Phoenix has n blocks of height h_1, h_2, ... , h_n , and all h_i don't exceed some value x . He plans to stack all n blocks into m separate towers. The height of a tower is simply the sum of the heights of its blocks. For the towers to look beautiful, no two towers may have a height difference of strictly more than x . Please help Phoenix build m towers that look beautiful. Each tower must have at least one block and all blocks must be used. The input consists of multiple test cases. The first line contains an integer t ( 1 <= t <= 1000 ) -- the number of test cases. The first line of each test case contains three integers n , m , and x ( 1 <= m <= n <= 10^5 ; 1 <= x <= 10^4 ) -- the number of blocks, the number of towers to build, and the maximum acceptable height difference of any two towers, respectively. The second line of each test case contains n space-separated integers ( 1 <= h_i <= x ) -- the heights of the blocks. It is guaranteed that the sum of n over all the test cases will not exceed 10^5 . For each test case, if Phoenix cannot build m towers that look beautiful, print NO. Otherwise, print YES, followed by n integers y_1, y_2, ... , y_n , where y_i ( 1 <= y_i <= m ) is the index of the tower that the i -th block is placed in. If there are multiple solutions, print any of them. In the first test case, the first tower has height 1+2+3=6 and the second tower has height 1+2=3 . Their difference is 6-3=3 which doesn't exceed x=3 , so the towers are beautiful. In the second test case, the first tower has height 1 , the second tower has height 1+2=3 , and the third tower has height 3 . The maximum height difference of any two towers is 3-1=2 which doesn't exceed x=3 , so the towers are beautiful. "... |
Editorial |
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
---|---|---|---|---|---|---|---|---|---|---|---|
114965229 | spinxfr | C | May 2, 2021, 7:38 p.m. | OK | D | TESTS | 16 | 156 | 24268800 | ||
114991925 | fishcathu. | C | May 3, 2021, 5:16 a.m. | OK | GNU C11 | TESTS | 16 | 31 | 819200 | ||
114972008 | rainboy | C | May 2, 2021, 10:04 p.m. | OK | GNU C11 | TESTS | 16 | 390 | 1228800 | ||
114954031 | ja1467 | C | May 2, 2021, 5:19 p.m. | OK | GNU C11 | TESTS | 16 | 421 | 5120000 | ||
114952383 | zeust | C | May 2, 2021, 5:12 p.m. | OK | GNU C11 | TESTS | 16 | 701 | 1228800 | ||
114991809 | fishcathu. | C | May 3, 2021, 5:14 a.m. | OK | GNU C++11 | TESTS | 16 | 31 | 614400 | ||
114991470 | fishcathu. | C | May 3, 2021, 5:11 a.m. | OK | GNU C++11 | TESTS | 16 | 31 | 819200 | ||
114981316 | fishcathu. | C | May 3, 2021, 2:43 a.m. | OK | GNU C++11 | TESTS | 16 | 31 | 1536000 | ||
114983208 | ALLnxiglan | C | May 3, 2021, 3:19 a.m. | OK | GNU C++11 | TESTS | 16 | 31 | 1945600 | ||
114977432 | feicheng_ | C | May 3, 2021, 1:07 a.m. | OK | GNU C++11 | TESTS | 16 | 31 | 3379200 | ||
114981975 | xtzic | C | May 3, 2021, 2:55 a.m. | OK | GNU C++11 | TESTS | 16 | 46 | 1536000 | ||
114978453 | Robert_JYH | C | May 3, 2021, 1:37 a.m. | OK | GNU C++11 | TESTS | 16 | 46 | 1638400 | ||
114983035 | ALLnxiglan | C | May 3, 2021, 3:16 a.m. | OK | GNU C++11 | TESTS | 16 | 46 | 1945600 | ||
114981645 | xgzc | C | May 3, 2021, 2:49 a.m. | OK | GNU C++11 | TESTS | 16 | 46 | 2355200 | ||
114983779 | LinkZelda | C | May 3, 2021, 3:28 a.m. | OK | GNU C++11 | TESTS | 16 | 46 | 2355200 | ||
114967059 | im_still_worthy | C | May 2, 2021, 8:10 p.m. | OK | GNU C++14 | TESTS | 16 | 46 | 1638400 | ||
114980232 | ..vince | C | May 3, 2021, 2:18 a.m. | OK | GNU C++14 | TESTS | 16 | 46 | 2457600 | ||
114972443 | samar_238 | C | May 2, 2021, 10:18 p.m. | OK | GNU C++14 | TESTS | 16 | 46 | 38092800 | ||
114957326 | Myzc | C | May 2, 2021, 5:32 p.m. | OK | GNU C++14 | TESTS | 16 | 61 | 1638400 | ||
114990290 | mohantyabhijit074 | C | May 3, 2021, 4:58 a.m. | OK | GNU C++14 | TESTS | 16 | 61 | 1638400 | ||
114953406 | swati1411 | C | May 2, 2021, 5:17 p.m. | OK | GNU C++14 | TESTS | 16 | 61 | 2048000 | ||
114972600 | Neos | C | May 2, 2021, 10:22 p.m. | OK | GNU C++14 | TESTS | 16 | 61 | 2355200 | ||
114975806 | fastflow | C | May 3, 2021, 12:12 a.m. | OK | GNU C++14 | TESTS | 16 | 61 | 2457600 | ||
114990616 | starboy_jb | C | May 3, 2021, 5:02 a.m. | OK | GNU C++14 | TESTS | 16 | 61 | 2560000 | ||
114991933 | I_francis | C | May 3, 2021, 5:16 a.m. | OK | GNU C++14 | TESTS | 16 | 61 | 3276800 | ||
114972181 | Akib_2612 | C | May 2, 2021, 10:09 p.m. | OK | GNU C++17 | TESTS | 16 | 46 | 1228800 | ||
114962238 | peterr | C | May 2, 2021, 7:01 p.m. | OK | GNU C++17 | TESTS | 16 | 46 | 1638400 | ||
114964570 | idas | C | May 2, 2021, 7:28 p.m. | OK | GNU C++17 | TESTS | 16 | 46 | 2457600 | ||
114977604 | atom_bomb | C | May 3, 2021, 1:13 a.m. | OK | GNU C++17 | TESTS | 16 | 46 | 2969600 | ||
114980382 | kamikaze8 | C | May 3, 2021, 2:21 a.m. | OK | GNU C++17 | TESTS | 16 | 46 | 3174400 | ||
114972068 | ReCRuS | C | May 2, 2021, 10:05 p.m. | OK | GNU C++17 | TESTS | 16 | 46 | 3174400 | ||
114983452 | a_die | C | May 3, 2021, 3:23 a.m. | OK | GNU C++17 | TESTS | 16 | 46 | 3174400 | ||
114987755 | MrBing | C | May 3, 2021, 4:26 a.m. | OK | GNU C++17 | TESTS | 16 | 46 | 3379200 | ||
114996102 | ShiinaMahiru | C | May 3, 2021, 5:56 a.m. | OK | GNU C++17 | TESTS | 16 | 46 | 3481600 | ||
114977720 | tanmay.raj.29 | C | May 3, 2021, 1:15 a.m. | OK | GNU C++17 | TESTS | 16 | 61 | 1228800 | ||
114962341 | tiasmondal | C | May 2, 2021, 7:02 p.m. | OK | GNU C++17 (64) | TESTS | 16 | 31 | 3481600 | ||
114969675 | 12662 | C | May 2, 2021, 9 p.m. | OK | GNU C++17 (64) | TESTS | 16 | 46 | 1228800 | ||
114996969 | Sadat999 | C | May 3, 2021, 6:05 a.m. | OK | GNU C++17 (64) | TESTS | 16 | 46 | 1228800 | ||
114979787 | dblark | C | May 3, 2021, 2:08 a.m. | OK | GNU C++17 (64) | TESTS | 16 | 46 | 1228800 | ||
114979990 | cumin | C | May 3, 2021, 2:13 a.m. | OK | GNU C++17 (64) | TESTS | 16 | 46 | 1638400 | ||
114979087 | feelin_dejavu | C | May 3, 2021, 1:52 a.m. | OK | GNU C++17 (64) | TESTS | 16 | 46 | 1638400 | ||
114965169 | kristja6 | C | May 2, 2021, 7:37 p.m. | OK | GNU C++17 (64) | TESTS | 16 | 46 | 2150400 | ||
114962935 | alyanser | C | May 2, 2021, 7:08 p.m. | OK | GNU C++17 (64) | TESTS | 16 | 46 | 2150400 | ||
114961797 | AnonySharma | C | May 2, 2021, 6:57 p.m. | OK | GNU C++17 (64) | TESTS | 16 | 46 | 2457600 | ||
114991832 | BikAdi | C | May 3, 2021, 5:15 a.m. | OK | GNU C++17 (64) | TESTS | 16 | 46 | 2457600 | ||
114994792 | Lelouch_1 | C | May 3, 2021, 5:44 a.m. | OK | Java 11 | TESTS | 16 | 248 | 0 | ||
114979681 | Jetman | C | May 3, 2021, 2:06 a.m. | OK | Java 11 | TESTS | 16 | 248 | 0 | ||
114990735 | naman5811 | C | May 3, 2021, 5:04 a.m. | OK | Java 11 | TESTS | 16 | 249 | 0 | ||
114989435 | sakethsriram19 | C | May 3, 2021, 4:47 a.m. | OK | Java 11 | TESTS | 16 | 249 | 0 | ||
114985423 | aayushdhakad | C | May 3, 2021, 3:53 a.m. | OK | Java 11 | TESTS | 16 | 249 | 0 | ||
114960740 | future_me | C | May 2, 2021, 6:49 p.m. | OK | Java 11 | TESTS | 16 | 249 | 10649600 | ||
114991671 | Lelouch_1 | C | May 3, 2021, 5:13 a.m. | OK | Java 11 | TESTS | 16 | 264 | 0 | ||
114990860 | ritik008 | C | May 3, 2021, 5:05 a.m. | OK | Java 11 | TESTS | 16 | 264 | 0 | ||
114968618 | Log_ZOOM | C | May 2, 2021, 8:37 p.m. | OK | Java 11 | TESTS | 16 | 264 | 2252800 | ||
114953019 | HBP | C | May 2, 2021, 5:15 p.m. | OK | Java 11 | TESTS | 16 | 265 | 0 | ||
114961153 | csullivan203 | C | May 2, 2021, 6:52 p.m. | OK | Java 8 | TESTS | 16 | 171 | 0 | ||
114960667 | VishuTomar | C | May 2, 2021, 6:49 p.m. | OK | Java 8 | TESTS | 16 | 186 | 0 | ||
114950846 | swapnilganguly1234 | C | May 2, 2021, 5:06 p.m. | OK | Java 8 | TESTS | 16 | 186 | 0 | ||
114989633 | Charigardash | C | May 3, 2021, 4:50 a.m. | OK | Java 8 | TESTS | 16 | 186 | 0 | ||
114965349 | RonWonWon | C | May 2, 2021, 7:40 p.m. | OK | Java 8 | TESTS | 16 | 202 | 307200 | ||
114964028 | gssakash | C | May 2, 2021, 7:21 p.m. | OK | Java 8 | TESTS | 16 | 217 | 0 | ||
114951672 | Akshay211 | C | May 2, 2021, 5:09 p.m. | OK | Java 8 | TESTS | 16 | 218 | 102400 | ||
114992864 | sedenion | C | May 3, 2021, 5:25 a.m. | OK | Java 8 | TESTS | 16 | 234 | 1638400 | ||
114967097 | Adi_7861 | C | May 2, 2021, 8:10 p.m. | OK | Java 8 | TESTS | 16 | 249 | 1024000 | ||
114954754 | shubhamsb25 | C | May 2, 2021, 5:22 p.m. | OK | Java 8 | TESTS | 16 | 265 | 102400 | ||
114988822 | Spheniscine | C | May 3, 2021, 4:40 a.m. | OK | Kotlin | TESTS | 16 | 155 | 1228800 | ||
114988619 | Spheniscine | C | May 3, 2021, 4:37 a.m. | OK | Kotlin | TESTS | 16 | 186 | 1331200 | ||
114969796 | Bloodwyn | C | May 2, 2021, 9:03 p.m. | OK | Kotlin | TESTS | 16 | 280 | 6144000 | ||
114965010 | ky28059 | C | May 2, 2021, 7:34 p.m. | OK | Kotlin | TESTS | 16 | 295 | 4505600 | ||
114971817 | Bloodwyn | C | May 2, 2021, 9:58 p.m. | OK | Kotlin | TESTS | 16 | 295 | 6246400 | ||
114955120 | PROGrand | C | May 2, 2021, 5:24 p.m. | OK | Kotlin | TESTS | 16 | 546 | 26624000 | ||
114971577 | Huth-0 | C | May 2, 2021, 9:51 p.m. | OK | Kotlin | TESTS | 16 | 561 | 3891200 | ||
114953909 | gleb32 | C | May 2, 2021, 5:19 p.m. | OK | MS C++ 2017 | TESTS | 16 | 155 | 1638400 | ||
114994317 | aleksikangas | C | May 3, 2021, 5:40 a.m. | OK | MS C++ 2017 | TESTS | 16 | 202 | 3584000 | ||
114960882 | Ilyaiq300 | C | May 2, 2021, 6:51 p.m. | OK | MS C++ 2017 | TESTS | 16 | 202 | 3584000 | ||
114976218 | _Rimjhim_36 | C | May 3, 2021, 12:27 a.m. | OK | MS C++ 2017 | TESTS | 16 | 498 | 3584000 | ||
114961366 | fgwiebfaoish | C | May 2, 2021, 6:54 p.m. | OK | .NET Core C# | TESTS | 16 | 171 | 16896000 | ||
114992706 | tabibi | C | May 3, 2021, 5:24 a.m. | OK | .NET Core C# | TESTS | 16 | 248 | 18227200 | ||
114966599 | abhishek4981 | C | May 2, 2021, 8:02 p.m. | OK | PyPy 3 | TESTS | 16 | 248 | 12288000 | ||
114963823 | nitish420 | C | May 2, 2021, 7:18 p.m. | OK | PyPy 3 | TESTS | 16 | 265 | 12390400 | ||
114966829 | bjy | C | May 2, 2021, 8:06 p.m. | OK | PyPy 3 | TESTS | 16 | 311 | 16793600 | ||
114991906 | Half_coder | C | May 3, 2021, 5:15 a.m. | OK | PyPy 3 | TESTS | 16 | 342 | 15052800 | ||
114974547 | bacarbland | C | May 2, 2021, 11:24 p.m. | OK | PyPy 3 | TESTS | 16 | 358 | 13516800 | ||
114968016 | InvalidSyntax | C | May 2, 2021, 8:26 p.m. | OK | PyPy 3 | TESTS | 16 | 374 | 13107200 | ||
114991604 | imadilkhan | C | May 3, 2021, 5:12 a.m. | OK | PyPy 3 | TESTS | 16 | 389 | 13004800 | ||
114971441 | belkka | C | May 2, 2021, 9:47 p.m. | OK | PyPy 3 | TESTS | 16 | 405 | 12492800 | ||
114969348 | AjJi | C | May 2, 2021, 8:53 p.m. | OK | PyPy 3 | TESTS | 16 | 421 | 15872000 | ||
114994131 | manmohan1105 | C | May 3, 2021, 5:38 a.m. | OK | PyPy 3 | TESTS | 16 | 421 | 17817600 | ||
114985661 | Klaycf | C | May 3, 2021, 3:56 a.m. | OK | Python 3 | TESTS | 16 | 264 | 8396800 | ||
114968340 | Itzumal | C | May 2, 2021, 8:32 p.m. | OK | Python 3 | TESTS | 16 | 296 | 16691200 | ||
114988685 | sh1194 | C | May 3, 2021, 4:38 a.m. | OK | Python 3 | TESTS | 16 | 342 | 11264000 | ||
114971762 | eugalt | C | May 2, 2021, 9:57 p.m. | OK | Python 3 | TESTS | 16 | 342 | 20275200 | ||
114996019 | eugalt | C | May 3, 2021, 5:56 a.m. | OK | Python 3 | TESTS | 16 | 343 | 19660800 | ||
114961823 | valek123 | C | May 2, 2021, 6:57 p.m. | OK | Python 3 | TESTS | 16 | 358 | 11264000 | ||
114956508 | Ashray_7 | C | May 2, 2021, 5:29 p.m. | OK | Python 3 | TESTS | 16 | 358 | 17305600 | ||
114972245 | eugalt | C | May 2, 2021, 10:11 p.m. | OK | Python 3 | TESTS | 16 | 358 | 20275200 | ||
114970865 | eugalt | C | May 2, 2021, 9:32 p.m. | OK | Python 3 | TESTS | 16 | 358 | 21094400 | ||
114951099 | eugalt | C | May 2, 2021, 5:07 p.m. | OK | Python 3 | TESTS | 16 | 373 | 13619200 |
Back to search problems