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 |
---|---|---|---|---|---|---|
1433 | Codeforces Round 677 (Div. 3) | FINISHED | False | 7200 | 141405879 | Oct. 20, 2020, 2:35 p.m. |
Solved$ |
Index |
Name |
Type |
Tags |
Community Tag |
Rating |
---|---|---|---|---|---|---|
( 27574 ) | C | Dominant Piranha | PROGRAMMING | constructive algorithms greedy |
B"There are n piranhas with sizes a_1, a_2, ldots, a_n in the aquarium. Piranhas are numbered from left to right in order they live in the aquarium. Scientists of the Berland State University want to find if there is dominant piranha in the aquarium. The piranha is called dominant if it can eat all the other piranhas in the aquarium (except itself, of course). Other piranhas will do nothing while the dominant piranha will eat them. Because the aquarium is pretty narrow and long, the piranha can eat only one of the adjacent piranhas during one move. Piranha can do as many moves as it needs (or as it can). More precisely: When the piranha i eats some piranha, its size increases by one ( a_i becomes a_i + 1 ). Your task is to find any dominant piranha in the aquarium or determine if there are no such piranhas. Note that you have to find any (exactly one) dominant piranha, you don't have to find all of them. For example, if a = [5, 3, 4, 4, 5] , then the third piranha can be dominant. Consider the sequence of its moves: You have to answer t independent test cases. The first line of the input contains one integer t ( 1 <= t <= 2 cdot 10^4 ) -- the number of test cases. Then t test cases follow. The first line of the test case contains one integer n ( 2 <= n <= 3 cdot 10^5 ) -- the number of piranhas in the aquarium. The second line of the test case contains n integers a_1, a_2, ldots, a_n ( 1 <= a_i <= 10^9 ), where a_i is the size of the i -th piranha. It is guaranteed that the sum of n does not exceed 3 cdot 10^5 ( sum n <= 3 cdot 10^5 ). For each test case, print the answer: -1 if there are no dominant piranhas in the aquarium or index of any dominant piranha otherwise. If there are several answers, you can print any. The first test case of the example is described in the problem statement. In the second test case of the example, there "... |
Codeforces Round #677 (Div. 3) Editorial |
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
---|---|---|---|---|---|---|---|---|---|---|---|
96197195 | vandoor | C | Oct. 21, 2020, 2:30 a.m. | OK | GNU C++11 | TESTS | 6 | 46 | 1228800 | ||
96195678 | yukishinki | C | Oct. 21, 2020, 1:47 a.m. | OK | GNU C++11 | TESTS | 6 | 46 | 1228800 | ||
96201245 | MengWH | C | Oct. 21, 2020, 4:05 a.m. | OK | GNU C++11 | TESTS | 6 | 46 | 1638400 | ||
96202412 | hnust_liuxin | C | Oct. 21, 2020, 4:33 a.m. | OK | GNU C++11 | TESTS | 6 | 46 | 2457600 | ||
96198957 | wddmahe | C | Oct. 21, 2020, 3:13 a.m. | OK | GNU C++11 | TESTS | 6 | 61 | 1228800 | ||
96168840 | Redorain | C | Oct. 20, 2020, 4:54 p.m. | OK | GNU C++11 | TESTS | 3 | 61 | 2457600 | ||
96180630 | Yash_s3135 | C | Oct. 20, 2020, 6:56 p.m. | OK | GNU C++11 | TESTS | 5 | 62 | 1024000 | ||
96197380 | TheBlueSnake | C | Oct. 21, 2020, 2:35 a.m. | OK | GNU C++11 | TESTS | 6 | 62 | 1228800 | ||
96193915 | answerend42 | C | Oct. 21, 2020, 12:42 a.m. | OK | GNU C++11 | TESTS | 6 | 62 | 1228800 | ||
96192903 | li0201 | C | Oct. 20, 2020, 11:58 p.m. | OK | GNU C++11 | TESTS | 6 | 62 | 1228800 | ||
96170853 | Danos_24 | C | Oct. 20, 2020, 5:11 p.m. | OK | GNU C++14 | TESTS | 3 | 77 | 1228800 | ||
96161806 | PavanK_025 | C | Oct. 20, 2020, 4:27 p.m. | OK | GNU C++14 | TESTS | 3 | 77 | 1228800 | ||
96174218 | juan123 | C | Oct. 20, 2020, 5:41 p.m. | OK | GNU C++14 | TESTS | 3 | 77 | 2355200 | ||
96169272 | Br0wnHammer | C | Oct. 20, 2020, 4:57 p.m. | OK | GNU C++14 | TESTS | 3 | 77 | 2355200 | ||
96177704 | mayukh11699 | C | Oct. 20, 2020, 6:19 p.m. | OK | GNU C++14 | TESTS | 5 | 77 | 3174400 | ||
96176441 | akshay_malik | C | Oct. 20, 2020, 6:05 p.m. | OK | GNU C++14 | TESTS | 5 | 78 | 1228800 | ||
96173203 | Czarcasm | C | Oct. 20, 2020, 5:31 p.m. | OK | GNU C++14 | TESTS | 3 | 78 | 1228800 | ||
96171991 | SAKIB_ALAMIN | C | Oct. 20, 2020, 5:20 p.m. | OK | GNU C++14 | TESTS | 3 | 78 | 1228800 | ||
96166387 | QAWIYY | C | Oct. 20, 2020, 4:38 p.m. | OK | GNU C++14 | TESTS | 3 | 78 | 1228800 | ||
96176561 | khushiagr99 | C | Oct. 20, 2020, 6:06 p.m. | OK | GNU C++14 | TESTS | 5 | 78 | 2355200 |
Back to search problems