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 |
|---|---|---|---|---|---|---|
| 933 | Codeforces Round 462 (Div. 1) | FINISHED | False | 7200 | 257882084 | Feb. 14, 2018, 12:05 p.m. |
Solved |
Index |
Name |
Type |
Tags |
Community Tag |
Rating |
|---|---|---|---|---|---|---|
| ( 288 ) | E | A Preponderant Reunion | PROGRAMMING | constructive algorithms dp | 3100 |
East or west, home is best. That's why family reunion, the indispensable necessity of Lunar New Year celebration, is put in such a position. After the reunion dinner, Little Tommy plays a game with the family. Here is a concise introduction to this game: There is a sequence of n non-negative integers p 1 , p 2 , ..., p n in the beginning. It is ruled that each integer in this sequence should be non-negative at any time . You can select two consecutive positive integers in this sequence, p i and p i + 1 (1 ≤ i < n ) , and then decrease them by their minimum (i. e. min ( p i , p i + 1 ) ), the cost of this operation is equal to min ( p i , p i + 1 ) . We call such operation as a descension . The game immediately ends when there are no two consecutive positive integers. Your task is to end the game so that the total cost of your operations is as small as possible. Obviously, every game ends after at most n - 1 descensions. Please share your solution of this game with the lowest cost. The first line contains one integer n (1 ≤ n ≤ 3·10 5 ) . The second line contains n space-separated integers p 1 , p 2 , ..., p n (0 ≤ p i ≤ 10 9 , i = 1, 2, ..., n ) . In the first line print one integer as the number of descensions m (0 ≤ m ≤ n - 1) . In the next m lines print the descensions chronologically. More precisely, in each line of the next m lines print one integer i (1 ≤ i < n ) representing a descension would operate on p i and p i + 1 such that all the descensions could be utilized from top to bottom. If there are many possible solutions to reach the minimal cost, print any of them. In the first sample, one possible best solution is , of which the cost is 1 + 1 = 2 . In the second sample, one possible best solution is , of which the cost is 1 + 1 + 1 = 3 . |
| 57763 |
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
|---|---|---|---|---|---|---|---|---|---|---|---|
| 35270878 | yosupo | E | Feb. 14, 2018, 5:13 p.m. | OK | D | TESTS | 76 | 1824 | 80281600 | 3100 | |
| 35328858 | cz_xuyixuan | E | Feb. 16, 2018, 6:51 a.m. | OK | GNU C++ | TESTS | 76 | 46 | 8499200 | 3100 | |
| 40978152 | ReaLNero1 | E | July 30, 2018, 4:30 p.m. | OK | GNU C++ | TESTS | 76 | 62 | 6348800 | 3100 | |
| 39140790 | Sacrifice | E | June 11, 2018, 8:20 a.m. | OK | GNU C++ | TESTS | 76 | 62 | 6348800 | 3100 | |
| 39141062 | thx | E | June 11, 2018, 8:34 a.m. | OK | GNU C++ | TESTS | 76 | 77 | 8396800 | 3100 | |
| 39141006 | thx | E | June 11, 2018, 8:32 a.m. | OK | GNU C++ | TESTS | 76 | 78 | 8396800 | 3100 | |
| 39141098 | Sacrifice | E | June 11, 2018, 8:36 a.m. | OK | GNU C++ | TESTS | 76 | 109 | 5120000 | 3100 | |
| 35287876 | 131131yhx | E | Feb. 15, 2018, 9:25 a.m. | OK | GNU C++ | TESTS | 76 | 109 | 8396800 | 3100 | |
| 35287790 | 131131yhx | E | Feb. 15, 2018, 9:21 a.m. | OK | GNU C++ | TESTS | 76 | 109 | 8396800 | 3100 | |
| 35464546 | skywalkert | E | Feb. 19, 2018, 7:42 a.m. | OK | GNU C++ | TESTS | 76 | 109 | 8499200 | 3100 | |
| 35284202 | vincent163 | E | Feb. 15, 2018, 6:32 a.m. | OK | GNU C++ | TESTS | 76 | 124 | 9318400 | 3100 | |
| 56739202 | Rubbish12345 | E | July 9, 2019, 6:53 a.m. | OK | GNU C++11 | TESTS | 76 | 62 | 6041600 | 3100 | |
| 56739168 | Rubbish12345 | E | July 9, 2019, 6:52 a.m. | OK | GNU C++11 | TESTS | 76 | 62 | 6041600 | 3100 | |
| 56783516 | newbiechdboom0 | E | July 10, 2019, 7:21 a.m. | OK | GNU C++11 | TESTS | 76 | 62 | 6348800 | 3100 | |
| 56757374 | lwhlwh | E | July 9, 2019, 2:26 p.m. | OK | GNU C++11 | TESTS | 76 | 62 | 6348800 | 3100 | |
| 56739502 | iotang | E | July 9, 2019, 7:01 a.m. | OK | GNU C++11 | TESTS | 76 | 62 | 6451200 | 3100 | |
| 35290430 | laofudasuan | E | Feb. 15, 2018, 11:12 a.m. | OK | GNU C++11 | TESTS | 76 | 62 | 7577600 | 3100 | |
| 47507112 | samjia2000 | E | Dec. 26, 2018, 2:14 a.m. | OK | GNU C++11 | TESTS | 76 | 62 | 10854400 | 3100 | |
| 56783105 | luogu_bot5 | E | July 10, 2019, 7:09 a.m. | OK | GNU C++11 | TESTS | 76 | 77 | 6348800 | 3100 | |
| 47035600 | newbiegcz | E | Dec. 15, 2018, 12:03 p.m. | OK | GNU C++11 | TESTS | 76 | 77 | 6348800 | 3100 | |
| 60680792 | nealchen | E | Sept. 16, 2019, 1:52 p.m. | OK | GNU C++11 | TESTS | 76 | 77 | 6860800 | 3100 | |
| 35463935 | _LowestJN | E | Feb. 19, 2018, 7:08 a.m. | OK | GNU C++14 | TESTS | 76 | 62 | 10956800 | 3100 | |
| 35436008 | ZaakDov | E | Feb. 18, 2018, 4:30 a.m. | OK | GNU C++14 | TESTS | 76 | 109 | 9113600 | 3100 | |
| 35435992 | ZaakDov | E | Feb. 18, 2018, 4:29 a.m. | OK | GNU C++14 | TESTS | 76 | 109 | 9113600 | 3100 | |
| 43899932 | Lynstery | E | Oct. 6, 2018, 12:10 p.m. | OK | GNU C++14 | TESTS | 76 | 124 | 6348800 | 3100 | |
| 50263781 | RNS_KSB | E | Feb. 21, 2019, 2:58 a.m. | OK | GNU C++14 | TESTS | 76 | 124 | 7065600 | 3100 | |
| 59778562 | Scut82 | E | Aug. 31, 2019, 1:35 a.m. | OK | GNU C++14 | TESTS | 76 | 124 | 7680000 | 3100 | |
| 59693402 | Scut82 | E | Aug. 30, 2019, 7:19 a.m. | OK | GNU C++14 | TESTS | 76 | 124 | 7680000 | 3100 | |
| 35251948 | fateice | E | Feb. 14, 2018, 1:10 p.m. | OK | GNU C++14 | TESTS | 76 | 124 | 9113600 | 3100 | |
| 37784497 | apink | E | May 1, 2018, 12:45 a.m. | OK | GNU C++14 | TESTS | 76 | 124 | 9830400 | 3100 | |
| 36996162 | Twishkle.Aevdark | E | April 5, 2018, 11:45 a.m. | OK | GNU C++14 | TESTS | 76 | 124 | 10035200 | 3100 | |
| 35345740 | whzzt | E | Feb. 16, 2018, 3:16 p.m. | OK | GNU C++17 | TESTS | 76 | 109 | 8601600 | 3100 | |
| 35443299 | Denisson | E | Feb. 18, 2018, 10:42 a.m. | OK | GNU C++17 | TESTS | 76 | 124 | 8294400 | 3100 | |
| 35443249 | Denisson | E | Feb. 18, 2018, 10:41 a.m. | OK | GNU C++17 | TESTS | 76 | 124 | 8294400 | 3100 | |
| 37271952 | deadRabbit | E | April 13, 2018, 7:18 a.m. | OK | GNU C++17 | TESTS | 76 | 139 | 10342400 | 3100 | |
| 57297517 | Benq | E | July 18, 2019, 8:15 p.m. | OK | GNU C++17 | TESTS | 76 | 140 | 6451200 | 3100 | |
| 38975113 | Ali_Pi | E | June 5, 2018, 5:18 p.m. | OK | GNU C++17 | TESTS | 76 | 171 | 14028800 | 3100 | |
| 35271817 | HIR180 | E | Feb. 14, 2018, 5:42 p.m. | OK | GNU C++17 | TESTS | 76 | 233 | 93696000 | 3100 | |
| 35271770 | HIR180 | E | Feb. 14, 2018, 5:41 p.m. | OK | GNU C++17 | TESTS | 76 | 233 | 93696000 | 3100 | |
| 40977700 | ReaLNero1 | E | July 30, 2018, 4:19 p.m. | OK | GNU C++17 | TESTS | 76 | 234 | 6348800 | 3100 | |
| 37383162 | deadRabbit | E | April 16, 2018, 9:31 p.m. | OK | GNU C++17 | TESTS | 76 | 343 | 16691200 | 3100 | |
| 35684741 | Los_Angelos_Laycurse | E | Feb. 25, 2018, 3:12 p.m. | OK | MS C++ | TESTS | 76 | 108 | 7372800 | 3100 |
Back to search problems