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 |
---|---|---|---|---|---|---|
1692 | Codeforces Round 799 (Div. 4) | FINISHED | False | 8100 | 81962663 | June 14, 2022, 2:35 p.m. |
Solved$ |
Index |
Name |
Type |
Tags |
Community Tag |
Rating |
---|---|---|---|---|---|---|
( 23421 ) | E | Binary Deque | PROGRAMMING | binary search implementation two pointers |
B"Slavic has an array of length n consisting only of zeroes and ones. In one operation, he removes either the first or the last element of the array. What is the minimum number of operations Slavic has to perform such that the total sum of the array is equal to s after performing all the operations? In case the sum s can't be obtained after any amount of operations, you should output -1. The first line contains a single integer t ( 1 <= q t <= q 10^4 ) -- the number of test cases. The first line of each test case contains two integers n and s ( 1 <= q n, s <= q 2 cdot 10^5 ) -- the length of the array and the needed sum of elements. The second line of each test case contains n integers a_i ( 0 <= q a_i <= q 1 ) -- the elements of the array. It is guaranteed that the sum of n over all test cases doesn't exceed 2 cdot 10^5 . For each test case, output a single integer -- the minimum amount of operations required to have the total sum of the array equal to s , or -1 if obtaining an array with sum s isn't possible. In the first test case, the sum of the whole array is 1 from the beginning, so we don't have to make any operations. In the second test case, the sum of the array is 2 and we want it to be equal to 1 , so we should remove the first element. The array turns into [1, 0] , which has a sum equal to 1 . In the third test case, the sum of the array is 5 and we need it to be 3 . We can obtain such a sum by removing the first two elements and the last element, doing a total of three operations. The array turns into [0, 1, 1, 1, 0, 0] , which has a sum equal to 3 . "... |
Codeforces Round #799 (Div. 4) Editorial |
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
---|---|---|---|---|---|---|---|---|---|---|---|
160680502 | bluemegane | E | June 15, 2022, 1:01 a.m. | OK | C# 8 | TESTS | 10 | 139 | 15155200 | ||
160674907 | connor.351 | E | June 14, 2022, 9:15 p.m. | OK | Clang++17 Diagnostics | TESTS | 10 | 717 | 14745600 | ||
160693969 | Wii | E | June 15, 2022, 5:34 a.m. | OK | FPC | TESTS | 10 | 31 | 1228800 | ||
160678160 | GTrigger | E | June 14, 2022, 11:11 p.m. | OK | GNU C11 | TESTS | 10 | 46 | 204800 | ||
160680308 | chinawcp | E | June 15, 2022, 12:53 a.m. | OK | GNU C11 | TESTS | 10 | 62 | 1638400 | ||
160680831 | XiaoDou | E | June 15, 2022, 1:13 a.m. | OK | GNU C11 | TESTS | 10 | 62 | 1638400 | ||
160688896 | chen_zhe_ | E | June 15, 2022, 4:16 a.m. | OK | GNU C++14 | TESTS | 10 | 15 | 921600 | ||
160681465 | JA2012 | E | June 15, 2022, 1:33 a.m. | OK | GNU C++14 | TESTS | 10 | 15 | 1843200 | ||
160673403 | Only_Again | E | June 14, 2022, 8:40 p.m. | OK | GNU C++14 | TESTS | 10 | 46 | 819200 | ||
160672660 | Memory66 | E | June 14, 2022, 8:26 p.m. | OK | GNU C++14 | TESTS | 10 | 46 | 819200 | ||
160670467 | Esmael_Samir | E | June 14, 2022, 7:48 p.m. | OK | GNU C++14 | TESTS | 10 | 46 | 819200 | ||
160667226 | dhruvrathi04 | E | June 14, 2022, 7:03 p.m. | OK | GNU C++14 | TESTS | 10 | 46 | 819200 | ||
160663546 | bhadrayu_18 | E | June 14, 2022, 6:19 p.m. | OK | GNU C++14 | TESTS | 10 | 46 | 819200 | ||
160676800 | maiky | E | June 14, 2022, 10:14 p.m. | OK | GNU C++14 | TESTS | 10 | 46 | 819200 | ||
160679432 | Mahamed_Nabil | E | June 15, 2022, 12:16 a.m. | OK | GNU C++14 | TESTS | 10 | 46 | 819200 | ||
160685106 | quanjun | E | June 15, 2022, 3:04 a.m. | OK | GNU C++14 | TESTS | 10 | 46 | 819200 | ||
160695831 | hans774882968 | E | June 15, 2022, 6 a.m. | OK | GNU C++17 | TESTS | 10 | 31 | 1228800 | ||
160664650 | akshat211103 | E | June 14, 2022, 6:31 p.m. | OK | GNU C++17 | TESTS | 10 | 31 | 1536000 | ||
160690438 | Azad01 | E | June 15, 2022, 4:41 a.m. | OK | GNU C++17 | TESTS | 10 | 46 | 819200 | ||
160688944 | yogesh_sane | E | June 15, 2022, 4:17 a.m. | OK | GNU C++17 | TESTS | 10 | 46 | 819200 | ||
160688407 | yogesh_sane | E | June 15, 2022, 4:08 a.m. | OK | GNU C++17 | TESTS | 10 | 46 | 819200 | ||
160686291 | Yash_04k | E | June 15, 2022, 3:29 a.m. | OK | GNU C++17 | TESTS | 10 | 46 | 819200 | ||
160686103 | MZZDX | E | June 15, 2022, 3:25 a.m. | OK | GNU C++17 | TESTS | 10 | 46 | 819200 | ||
160694048 | md_hamid | E | June 15, 2022, 5:35 a.m. | OK | GNU C++17 | TESTS | 10 | 46 | 819200 | ||
160693796 | bala418 | E | June 15, 2022, 5:32 a.m. | OK | GNU C++17 | TESTS | 10 | 46 | 819200 | ||
160694037 | ayushman228 | E | June 15, 2022, 5:35 a.m. | OK | GNU C++17 | TESTS | 10 | 46 | 819200 | ||
160682944 | Einstein1234 | E | June 15, 2022, 2:14 a.m. | OK | GNU C++17 (64) | TESTS | 10 | 30 | 3993600 | ||
160688533 | originalsidd | E | June 15, 2022, 4:10 a.m. | OK | GNU C++17 (64) | TESTS | 10 | 31 | 819200 | ||
160692078 | _matrix0_ | E | June 15, 2022, 5:07 a.m. | OK | GNU C++17 (64) | TESTS | 10 | 31 | 819200 | ||
160678928 | Ziad_Reda | E | June 14, 2022, 11:50 p.m. | OK | GNU C++17 (64) | TESTS | 10 | 31 | 819200 | ||
160675767 | Maram | E | June 14, 2022, 9:40 p.m. | OK | GNU C++17 (64) | TESTS | 10 | 31 | 819200 | ||
160667080 | neeraj_joshi | E | June 14, 2022, 7:01 p.m. | OK | GNU C++17 (64) | TESTS | 10 | 31 | 819200 | ||
160660695 | shamimjucse | E | June 14, 2022, 5:52 p.m. | OK | GNU C++17 (64) | TESTS | 10 | 31 | 819200 | ||
160684163 | eggag32 | E | June 15, 2022, 2:44 a.m. | OK | GNU C++17 (64) | TESTS | 10 | 31 | 1638400 | ||
160689214 | bhargabdhungel | E | June 15, 2022, 4:22 a.m. | OK | GNU C++17 (64) | TESTS | 10 | 31 | 1638400 | ||
160674916 | jesse_pinkman_619 | E | June 14, 2022, 9:15 p.m. | OK | GNU C++17 (64) | TESTS | 10 | 31 | 1638400 | ||
160672344 | AlokKT105 | E | June 14, 2022, 8:20 p.m. | OK | GNU C++20 (64) | TESTS | 10 | 15 | 819200 | ||
160688188 | Ahmed.Fathi | E | June 15, 2022, 4:04 a.m. | OK | GNU C++20 (64) | TESTS | 10 | 15 | 819200 | ||
160659833 | Feglaa | E | June 14, 2022, 5:45 p.m. | OK | GNU C++20 (64) | TESTS | 10 | 15 | 819200 | ||
160667143 | _ForeRunner_ | E | June 14, 2022, 7:02 p.m. | OK | GNU C++20 (64) | TESTS | 10 | 15 | 1638400 | ||
160663150 | DOBO | E | June 14, 2022, 6:15 p.m. | OK | GNU C++20 (64) | TESTS | 10 | 15 | 1638400 | ||
160675438 | MedoZ | E | June 14, 2022, 9:30 p.m. | OK | GNU C++20 (64) | TESTS | 10 | 30 | 1331200 | ||
160674421 | ahmedzedan884 | E | June 14, 2022, 9:03 p.m. | OK | GNU C++20 (64) | TESTS | 10 | 30 | 1638400 | ||
160680623 | Chad_Mia2 | E | June 15, 2022, 1:05 a.m. | OK | GNU C++20 (64) | TESTS | 10 | 30 | 2150400 | ||
160663383 | Andy.zhu23 | E | June 14, 2022, 6:18 p.m. | OK | GNU C++20 (64) | TESTS | 10 | 31 | 409600 | ||
160695484 | Pranav.exe | E | June 15, 2022, 5:55 a.m. | OK | GNU C++20 (64) | TESTS | 10 | 31 | 819200 | ||
160655459 | Emruz_Hossain | E | June 14, 2022, 5:11 p.m. | OK | Go | TESTS | 10 | 93 | 1126400 | ||
160666259 | koqo | E | June 14, 2022, 6:51 p.m. | OK | Go | TESTS | 10 | 93 | 1945600 | ||
160689597 | satyaa_78 | E | June 15, 2022, 4:28 a.m. | OK | Java 11 | TESTS | 10 | 156 | 0 | ||
160685762 | kamannb | E | June 15, 2022, 3:17 a.m. | OK | Java 11 | TESTS | 10 | 171 | 0 | ||
160668705 | Ginkgobiloba | E | June 14, 2022, 7:23 p.m. | OK | Java 11 | TESTS | 10 | 186 | 0 | ||
160669028 | Ma-XD | E | June 14, 2022, 7:27 p.m. | OK | Java 11 | TESTS | 10 | 186 | 0 | ||
160663380 | MunirKP | E | June 14, 2022, 6:18 p.m. | OK | Java 11 | TESTS | 10 | 186 | 0 | ||
160688331 | MadDuke | E | June 15, 2022, 4:06 a.m. | OK | Java 11 | TESTS | 10 | 187 | 0 | ||
160675478 | sunaj | E | June 14, 2022, 9:31 p.m. | OK | Java 11 | TESTS | 10 | 187 | 0 | ||
160668423 | Ma-XD | E | June 14, 2022, 7:19 p.m. | OK | Java 11 | TESTS | 10 | 187 | 0 | ||
160682729 | JustJie | E | June 15, 2022, 2:09 a.m. | OK | Java 11 | TESTS | 10 | 202 | 0 | ||
160658793 | Aaryendra | E | June 14, 2022, 5:36 p.m. | OK | Java 11 | TESTS | 10 | 202 | 0 | ||
160669421 | akshaykumar200042 | E | June 14, 2022, 7:32 p.m. | OK | Java 8 | TESTS | 10 | 109 | 0 | ||
160664217 | arutsudar | E | June 14, 2022, 6:27 p.m. | OK | Java 8 | TESTS | 10 | 109 | 0 | ||
160655446 | Eslam_Ahmed | E | June 14, 2022, 5:11 p.m. | OK | Java 8 | TESTS | 10 | 109 | 0 | ||
160682802 | ayafayed | E | June 15, 2022, 2:11 a.m. | OK | Java 8 | TESTS | 10 | 124 | 0 | ||
160663868 | FirePegasus | E | June 14, 2022, 6:23 p.m. | OK | Java 8 | TESTS | 10 | 124 | 0 | ||
160654817 | WrongAnswerOnTestCase2 | E | June 14, 2022, 5:08 p.m. | OK | Java 8 | TESTS | 10 | 124 | 0 | ||
160690692 | moyan_01 | E | June 15, 2022, 4:45 a.m. | OK | Java 8 | TESTS | 10 | 140 | 1536000 | ||
160695513 | swaggy_baba | E | June 15, 2022, 5:56 a.m. | OK | Java 8 | TESTS | 10 | 171 | 4096000 | ||
160656271 | KhadijaBadrawy | E | June 14, 2022, 5:17 p.m. | OK | Java 8 | TESTS | 10 | 186 | 25190400 | ||
160695545 | sushmitha_198 | E | June 15, 2022, 5:56 a.m. | OK | Java 8 | TESTS | 10 | 358 | 0 | ||
160677897 | Hakiobo | E | June 14, 2022, 10:58 p.m. | OK | Kotlin 1.4 | TESTS | 10 | 124 | 0 | ||
160676006 | KemPi | E | June 14, 2022, 9:48 p.m. | OK | MS C++ 2017 | TESTS | 10 | 171 | 4096000 | ||
160689693 | TemporalBloom | E | June 15, 2022, 4:30 a.m. | OK | MS C++ 2017 | TESTS | 10 | 187 | 1331200 | ||
160662145 | voicon | E | June 14, 2022, 6:05 p.m. | OK | PyPy 3 | TESTS | 10 | 170 | 10137600 | ||
160670254 | hxu10 | E | June 14, 2022, 7:44 p.m. | OK | PyPy 3 | TESTS | 10 | 171 | 13209600 | ||
160695115 | ramjeeraghu | E | June 15, 2022, 5:51 a.m. | OK | PyPy 3 | TESTS | 10 | 202 | 18227200 | ||
160685544 | wyxfwxh250821 | E | June 15, 2022, 3:13 a.m. | OK | PyPy 3 | TESTS | 10 | 311 | 18534400 | ||
160675152 | Beerus789 | E | June 14, 2022, 9:22 p.m. | OK | PyPy 3 | TESTS | 10 | 436 | 13209600 | ||
160663933 | pratyanch_jain | E | June 14, 2022, 6:23 p.m. | OK | PyPy 3 | TESTS | 10 | 452 | 33894400 | ||
160677371 | osama_a_rehman | E | June 14, 2022, 10:36 p.m. | OK | PyPy 3 | TESTS | 10 | 530 | 15360000 | ||
160676253 | crapcode | E | June 14, 2022, 9:57 p.m. | OK | PyPy 3-64 | TESTS | 10 | 124 | 21708800 | ||
160660119 | iron_nicko | E | June 14, 2022, 5:47 p.m. | OK | PyPy 3-64 | TESTS | 10 | 139 | 18124800 | ||
160668910 | SSCoding123 | E | June 14, 2022, 7:26 p.m. | OK | PyPy 3-64 | TESTS | 10 | 139 | 19968000 | ||
160664901 | IkshitG | E | June 14, 2022, 6:34 p.m. | OK | PyPy 3-64 | TESTS | 10 | 140 | 23142400 | ||
160663677 | hash1023 | E | June 14, 2022, 6:21 p.m. | OK | PyPy 3-64 | TESTS | 10 | 140 | 26624000 | ||
160658009 | raushnn | E | June 14, 2022, 5:30 p.m. | OK | PyPy 3-64 | TESTS | 10 | 155 | 22528000 | ||
160676150 | crapcode | E | June 14, 2022, 9:53 p.m. | OK | PyPy 3-64 | TESTS | 10 | 156 | 21708800 | ||
160658640 | feelme | E | June 14, 2022, 5:34 p.m. | OK | PyPy 3-64 | TESTS | 10 | 186 | 30924800 | ||
160664430 | only_for_kav_tripathi | E | June 14, 2022, 6:29 p.m. | OK | PyPy 3-64 | TESTS | 10 | 187 | 21606400 | ||
160655899 | krishna369 | E | June 14, 2022, 5:14 p.m. | OK | PyPy 3-64 | TESTS | 10 | 187 | 26112000 | ||
160681192 | husnain | E | June 15, 2022, 1:25 a.m. | OK | Python 3 | TESTS | 10 | 186 | 3788800 | ||
160659852 | jaygaur99 | E | June 14, 2022, 5:45 p.m. | OK | Python 3 | TESTS | 10 | 187 | 10342400 | ||
160670673 | vipul_mehra | E | June 14, 2022, 7:51 p.m. | OK | Python 3 | TESTS | 10 | 202 | 3481600 | ||
160655903 | wssccc | E | June 14, 2022, 5:14 p.m. | OK | Python 3 | TESTS | 10 | 202 | 3891200 | ||
160690678 | CodeLord1104 | E | June 15, 2022, 4:45 a.m. | OK | Python 3 | TESTS | 10 | 217 | 3993600 | ||
160670834 | vipul_mehra | E | June 14, 2022, 7:53 p.m. | OK | Python 3 | TESTS | 10 | 218 | 3481600 | ||
160665693 | fhhuo | E | June 14, 2022, 6:44 p.m. | OK | Python 3 | TESTS | 10 | 233 | 3891200 | ||
160661780 | dima_niyau | E | June 14, 2022, 6:02 p.m. | OK | Python 3 | TESTS | 10 | 233 | 18227200 | ||
160687960 | hr4_harsh | E | June 15, 2022, 3:59 a.m. | OK | Python 3 | TESTS | 10 | 249 | 4300800 | ||
160668515 | RomeCaesar | E | June 14, 2022, 7:20 p.m. | OK | Python 3 | TESTS | 10 | 249 | 4300800 | ||
160680536 | Ayalla | E | June 15, 2022, 1:02 a.m. | OK | Ruby 3 | TESTS | 10 | 779 | 27443200 | ||
160681487 | Thallium54 | E | June 15, 2022, 1:33 a.m. | OK | Rust 2021 | TESTS | 10 | 15 | 1843200 | ||
160693234 | Sempr | E | June 15, 2022, 5:23 a.m. | OK | Rust 2021 | TESTS | 10 | 15 | 2867200 | ||
160658724 | Tomx | E | June 14, 2022, 5:35 p.m. | OK | Rust 2021 | TESTS | 10 | 31 | 12390400 |
Back to search problems