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 |
---|---|---|---|---|---|---|
1876 | Codeforces Round 902 (Div. 1, based on COMPFEST 15 - Final Round) | FINISHED | False | 9000 | 40424063 | Oct. 8, 2023, 9:05 a.m. |
Solved$ |
Index |
Name |
Type |
Tags |
Community Tag |
Rating |
---|---|---|---|---|---|---|
( 152 ) | F | Indefinite Clownfish | PROGRAMMING | binary search graphs |
B"Pak Chanek has just bought an empty fish tank and he has been dreaming to fill it with his favourite kind of fish, clownfish. Pak Chanek likes clownfish because of their ability to change their genders on demand. Because of the size of his fish tank, Pak Chanek wants to buy exactly k clownfish to fill the tank. Pak Chanek goes to the local fish shop. The shop provides n clownfish numbered from 1 to n , with clownfish i having a size of a_i . Initially, every clownfish in the store does not have an assigned gender, but has the ability to be assigned to two possible clownfish genders, female or male. The store has a procedure which Pak Chanek should follow to buy clownfish. The shop owner will point at each clownfish sequentially from 1 to n and for each clownfish, she asks Pak Chanek whether to buy it or not. Each time Pak Chanek is asked, he must declare whether to buy the currently asked clownfish or not, before the shop owner moves on to the next clownfish. If Pak Chanek declares to buy the currently asked clownfish, he must also declare the gender to be assigned to that clownfish immediately. When assigning the gender for the currently asked clownfish, the following conditions must be satisfied: Pak Chanek wants to buy exactly k clownfish such that: Let l and r respectively be the minimum and maximum index of a clownfish Pak Chanek buys. What is the minimum possible value of r-l ? The first line contains two integers n and k ( 2 <= q k <= q n <= q 2 cdot10^5 ) -- the number of clownfish in the shop and the number of clownfish Pak Chanek has to buy. The second line contains n integers a_1,a_2,a_3, ldots,a_n ( 1 <= q a_i <= q n ) -- the size of each clownfish. An integer representing the minimum possible value of r-l . If it is impossible to buy exactly k clownfish and satisfy the problem's condition, print -1 . In the first example, Pak "... |
Codeforces Round #902 (Div. 1, Div. 2, based on COMPFEST 15 — Final Round) Editorial |
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
---|---|---|---|---|---|---|---|---|---|---|---|
227262665 | Kubic | F | Oct. 9, 2023, 1:17 a.m. | OK | GNU C++17 (64) | TESTS | 128 | 529 | 32870400 | ||
227254926 | chappy1 | F | Oct. 8, 2023, 9:34 p.m. | OK | GNU C++17 (64) | TESTS | 128 | 1076 | 43929600 | ||
227253422 | Sana | F | Oct. 8, 2023, 9:05 p.m. | OK | GNU C++17 (64) | TESTS | 128 | 1107 | 43929600 | ||
227277706 | tricyzhkx | F | Oct. 9, 2023, 5:54 a.m. | OK | GNU C++17 (64) | TESTS | 128 | 1341 | 40960000 | ||
227225278 | ugly2333 | F | Oct. 8, 2023, 4:26 p.m. | OK | GNU C++20 (64) | TESTS | 128 | 935 | 80179200 | ||
227219889 | Benq | F | Oct. 8, 2023, 3:43 p.m. | OK | GNU C++20 (64) | TESTS | 128 | 1029 | 39321600 | ||
227196416 | nguyenquocthinhhung | F | Oct. 8, 2023, 1:01 p.m. | OK | GNU C++20 (64) | TESTS | 128 | 1934 | 138444800 | ||
227207094 | jiangly | F | Oct. 8, 2023, 2:13 p.m. | OK | GNU C++20 (64) | TESTS | 128 | 2121 | 167731200 | ||
227177806 | Radewoosh | F | Oct. 8, 2023, 11:10 a.m. | OK | GNU C++20 (64) | TESTS | 128 | 2137 | 138444800 | ||
227205151 | jiangly | F | Oct. 8, 2023, 1:59 p.m. | OK | GNU C++20 (64) | TESTS | 128 | 2527 | 168448000 | ||
227205539 | jiangly | F | Oct. 8, 2023, 2:02 p.m. | OK | GNU C++20 (64) | TESTS | 128 | 2542 | 168448000 |
Back to search problems