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.
Problems
B"Alice and Bob are playing a game. They have an array of positive integers a of size n . Before starting the game, Alice chooses an integer k ge 0 . The game lasts for k stages, the stages are numbered from 1 to k . During the i -th stage, Alice must remove an element from the array that is less than or equal to k - i + 1 . After that, if the array is not empty, Bob must add k - i + 1 to an arbitrary element of the array. Note that both Alice's move and Bob's move are two parts of the same stage of the game. If Alice can't delete an element during some stage, she loses. If the k -th stage ends and Alice hasn't lost yet, she wins. Your task is to determine the maximum value of k such that Alice can win if both players play optimally. Bob plays against Alice, so he tries to make her lose the game, if it's possible. The first line contains a single integer t ( 1 <= t <= 100 ) -- the number of test cases. The first line of each test case contains a single integer n ( 1 <= n <= 100 ) -- the size of the array a . The second line contains n integers a_1, a_2, ... , a_n ( 1 <= a_i <= n ). For each test case, print one integer -- the maximum value of k such that Alice can win if both players play optimally. "... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
177210198 |
tumyalis |
C |
Oct. 20, 2022, 4:33 p.m. |
OK |
C# 10 |
TESTS |
5 |
46 |
921600 |
|
|
177261729 |
Wlf0000 |
C |
Oct. 21, 2022, 5:29 a.m. |
OK |
Clang++20 Diagnostics |
TESTS |
5 |
46 |
0 |
|
|
177239348 |
NenadDapic |
C |
Oct. 20, 2022, 9:38 p.m. |
OK |
FPC |
TESTS |
5 |
31 |
0 |
|
|
177202652 |
chethan58 |
C |
Oct. 20, 2022, 4:14 p.m. |
OK |
GNU C11 |
TESTS |
5 |
15 |
0 |
|
|
177220446 |
XiaoDou |
C |
Oct. 20, 2022, 5:35 p.m. |
OK |
GNU C11 |
TESTS |
5 |
15 |
0 |
|
|
177244108 |
EVERNEWBIE |
C |
Oct. 20, 2022, 11:48 p.m. |
OK |
GNU C++14 |
TESTS |
5 |
0 |
0 |
|
|
177208709 |
gautamjain09 |
C |
Oct. 20, 2022, 4:30 p.m. |
OK |
GNU C++14 |
TESTS |
5 |
0 |
0 |
|
|
177207533 |
watermelon_Learn |
C |
Oct. 20, 2022, 4:27 p.m. |
OK |
GNU C++14 |
TESTS |
5 |
0 |
0 |
|
|
177207414 |
Yisin030 |
C |
Oct. 20, 2022, 4:27 p.m. |
OK |
GNU C++14 |
TESTS |
5 |
0 |
0 |
|
|
177254695 |
Neerajjoshi2003 |
C |
Oct. 21, 2022, 3:38 a.m. |
OK |
GNU C++14 |
TESTS |
5 |
0 |
0 |
|
|
177202090 |
HLY-JXT |
C |
Oct. 20, 2022, 4:13 p.m. |
OK |
GNU C++14 |
TESTS |
5 |
0 |
0 |
|
|
177247591 |
Fantasyli |
C |
Oct. 21, 2022, 1:17 a.m. |
OK |
GNU C++14 |
TESTS |
5 |
0 |
0 |
|
|
177247468 |
Neko668 |
C |
Oct. 21, 2022, 1:14 a.m. |
OK |
GNU C++14 |
TESTS |
5 |
0 |
0 |
|
|
177246696 |
A.I.S |
C |
Oct. 21, 2022, 12:56 a.m. |
OK |
GNU C++14 |
TESTS |
5 |
0 |
0 |
|
|
177245896 |
Daniel777 |
C |
Oct. 21, 2022, 12:35 a.m. |
OK |
GNU C++14 |
TESTS |
5 |
0 |
0 |
|
|
177257443 |
2865165847 |
C |
Oct. 21, 2022, 4:24 a.m. |
OK |
GNU C++17 |
TESTS |
5 |
0 |
0 |
|
|
177248156 |
Bipolar-niche |
C |
Oct. 21, 2022, 1:29 a.m. |
OK |
GNU C++17 |
TESTS |
5 |
0 |
0 |
|
|
177247607 |
weeeww |
C |
Oct. 21, 2022, 1:17 a.m. |
OK |
GNU C++17 |
TESTS |
5 |
0 |
0 |
|
|
177245027 |
PUNGqw |
C |
Oct. 21, 2022, 12:13 a.m. |
OK |
GNU C++17 |
TESTS |
5 |
0 |
0 |
|
|
177234558 |
hasan_smndar |
C |
Oct. 20, 2022, 8:19 p.m. |
OK |
GNU C++17 |
TESTS |
5 |
0 |
0 |
|
|
177229276 |
binary_monk |
C |
Oct. 20, 2022, 7:06 p.m. |
OK |
GNU C++17 |
TESTS |
5 |
0 |
0 |
|
|
177227096 |
LikhithRaj-1259 |
C |
Oct. 20, 2022, 6:40 p.m. |
OK |
GNU C++17 |
TESTS |
5 |
0 |
0 |
|
|
177226128 |
epsilon_573 |
C |
Oct. 20, 2022, 6:30 p.m. |
OK |
GNU C++17 |
TESTS |
5 |
0 |
0 |
|
|
177259234 |
DrIsaac |
C |
Oct. 21, 2022, 4:54 a.m. |
OK |
GNU C++17 |
TESTS |
5 |
0 |
0 |
|
|
177263733 |
kshitijmaurya |
C |
Oct. 21, 2022, 5:54 a.m. |
OK |
GNU C++17 |
TESTS |
5 |
0 |
0 |
|
|
177246114 |
xiwenT |
C |
Oct. 21, 2022, 12:41 a.m. |
OK |
GNU C++17 (64) |
TESTS |
5 |
0 |
0 |
|
|
177255023 |
-Victory |
C |
Oct. 21, 2022, 3:43 a.m. |
OK |
GNU C++17 (64) |
TESTS |
5 |
0 |
0 |
|
|
177250494 |
leo22 |
C |
Oct. 21, 2022, 2:21 a.m. |
OK |
GNU C++17 (64) |
TESTS |
5 |
0 |
0 |
|
|
177249081 |
Time_JYF |
C |
Oct. 21, 2022, 1:52 a.m. |
OK |
GNU C++17 (64) |
TESTS |
5 |
0 |
0 |
|
|
177248937 |
yaoveil |
C |
Oct. 21, 2022, 1:48 a.m. |
OK |
GNU C++17 (64) |
TESTS |
5 |
0 |
0 |
|
|
177247707 |
joao.breno.ro17 |
C |
Oct. 21, 2022, 1:19 a.m. |
OK |
GNU C++17 (64) |
TESTS |
5 |
0 |
0 |
|
|
177233667 |
kevin_007 |
C |
Oct. 20, 2022, 8:06 p.m. |
OK |
GNU C++17 (64) |
TESTS |
5 |
0 |
0 |
|
|
177218681 |
chiruno233 |
C |
Oct. 20, 2022, 5:21 p.m. |
OK |
GNU C++17 (64) |
TESTS |
5 |
0 |
0 |
|
|
177217568 |
chiruno233 |
C |
Oct. 20, 2022, 5:12 p.m. |
OK |
GNU C++17 (64) |
TESTS |
5 |
0 |
0 |
|
|
177211556 |
CurryWOE |
C |
Oct. 20, 2022, 4:37 p.m. |
OK |
GNU C++17 (64) |
TESTS |
5 |
0 |
0 |
|
|
177263391 |
livlyf_168 |
C |
Oct. 21, 2022, 5:49 a.m. |
OK |
GNU C++20 (64) |
TESTS |
5 |
0 |
0 |
|
|
177261890 |
chandram.ayush |
C |
Oct. 21, 2022, 5:31 a.m. |
OK |
GNU C++20 (64) |
TESTS |
5 |
0 |
0 |
|
|
177261278 |
pavankalyanpallapolu |
C |
Oct. 21, 2022, 5:23 a.m. |
OK |
GNU C++20 (64) |
TESTS |
5 |
0 |
0 |
|
|
177259583 |
ritik2245 |
C |
Oct. 21, 2022, 5 a.m. |
OK |
GNU C++20 (64) |
TESTS |
5 |
0 |
0 |
|
|
177258811 |
kitkat9 |
C |
Oct. 21, 2022, 4:47 a.m. |
OK |
GNU C++20 (64) |
TESTS |
5 |
0 |
0 |
|
|
177256947 |
_BottomCoder_ |
C |
Oct. 21, 2022, 4:16 a.m. |
OK |
GNU C++20 (64) |
TESTS |
5 |
0 |
0 |
|
|
177256942 |
Shiki_ |
C |
Oct. 21, 2022, 4:16 a.m. |
OK |
GNU C++20 (64) |
TESTS |
5 |
0 |
0 |
|
|
177256526 |
GeorgeMaharis |
C |
Oct. 21, 2022, 4:08 a.m. |
OK |
GNU C++20 (64) |
TESTS |
5 |
0 |
0 |
|
|
177263530 |
GENIUS_CODER_ |
C |
Oct. 21, 2022, 5:51 a.m. |
OK |
GNU C++20 (64) |
TESTS |
5 |
0 |
0 |
|
|
177264002 |
OMAR7FO |
C |
Oct. 21, 2022, 5:57 a.m. |
OK |
GNU C++20 (64) |
TESTS |
5 |
0 |
0 |
|
|
177202050 |
arun07 |
C |
Oct. 20, 2022, 4:12 p.m. |
OK |
Go |
TESTS |
5 |
15 |
1331200 |
|
|
177246608 |
the_unseen |
C |
Oct. 21, 2022, 12:54 a.m. |
OK |
Java 11 |
TESTS |
5 |
155 |
0 |
|
|
177217778 |
Kanishka_bansode |
C |
Oct. 20, 2022, 5:13 p.m. |
OK |
Java 11 |
TESTS |
5 |
155 |
0 |
|
|
177252338 |
aditya2024 |
C |
Oct. 21, 2022, 2:56 a.m. |
OK |
Java 11 |
TESTS |
5 |
170 |
0 |
|
|
177229671 |
Jackyjuman |
C |
Oct. 20, 2022, 7:11 p.m. |
OK |
Java 11 |
TESTS |
5 |
170 |
0 |
|
|
177253128 |
yknischal |
C |
Oct. 21, 2022, 3:10 a.m. |
OK |
Java 11 |
TESTS |
5 |
171 |
0 |
|
|
177218638 |
jyoti360 |
C |
Oct. 20, 2022, 5:20 p.m. |
OK |
Java 11 |
TESTS |
5 |
171 |
0 |
|
|
177210069 |
Wld |
C |
Oct. 20, 2022, 4:33 p.m. |
OK |
Java 11 |
TESTS |
5 |
171 |
0 |
|
|
177208578 |
Prime369 |
C |
Oct. 20, 2022, 4:29 p.m. |
OK |
Java 11 |
TESTS |
5 |
171 |
0 |
|
|
177204529 |
RockStar_14 |
C |
Oct. 20, 2022, 4:19 p.m. |
OK |
Java 11 |
TESTS |
5 |
171 |
0 |
|
|
177210406 |
Wld |
C |
Oct. 20, 2022, 4:33 p.m. |
OK |
Java 11 |
TESTS |
5 |
186 |
0 |
|
|
177204672 |
TCchen |
C |
Oct. 20, 2022, 4:19 p.m. |
OK |
Java 17 |
TESTS |
5 |
155 |
512000 |
|
|
177253815 |
kovay27290 |
C |
Oct. 21, 2022, 3:23 a.m. |
OK |
Java 17 |
TESTS |
5 |
186 |
307200 |
|
|
177253426 |
smlj |
C |
Oct. 21, 2022, 3:16 a.m. |
OK |
Java 17 |
TESTS |
5 |
187 |
614400 |
|
|
177253409 |
smlj |
C |
Oct. 21, 2022, 3:16 a.m. |
OK |
Java 17 |
TESTS |
5 |
202 |
204800 |
|
|
177247007 |
kkz666 |
C |
Oct. 21, 2022, 1:03 a.m. |
OK |
Java 17 |
TESTS |
5 |
218 |
0 |
|
|
177247427 |
wzdycxy |
C |
Oct. 21, 2022, 1:13 a.m. |
OK |
Java 17 |
TESTS |
5 |
249 |
0 |
|
|
177208983 |
cpchenpi |
C |
Oct. 20, 2022, 4:30 p.m. |
OK |
Java 17 |
TESTS |
5 |
249 |
0 |
|
|
177260786 |
BloCamLimb |
C |
Oct. 21, 2022, 5:16 a.m. |
OK |
Java 17 |
TESTS |
5 |
265 |
409600 |
|
|
177212042 |
Eslam_Ahmed |
C |
Oct. 20, 2022, 4:39 p.m. |
OK |
Java 17 |
TESTS |
5 |
389 |
0 |
|
|
177204625 |
HateCodE |
C |
Oct. 20, 2022, 4:19 p.m. |
OK |
Java 17 |
TESTS |
5 |
404 |
614400 |
|
|
177214348 |
Diaa12360 |
C |
Oct. 20, 2022, 4:50 p.m. |
OK |
Java 8 |
TESTS |
5 |
92 |
0 |
|
|
177218154 |
yashpandey73 |
C |
Oct. 20, 2022, 5:16 p.m. |
OK |
Java 8 |
TESTS |
5 |
93 |
0 |
|
|
177215187 |
priyaroy3370 |
C |
Oct. 20, 2022, 4:55 p.m. |
OK |
Java 8 |
TESTS |
5 |
93 |
0 |
|
|
177214047 |
Atuer |
C |
Oct. 20, 2022, 4:49 p.m. |
OK |
Java 8 |
TESTS |
5 |
93 |
0 |
|
|
177212668 |
DWSHR |
C |
Oct. 20, 2022, 4:42 p.m. |
OK |
Java 8 |
TESTS |
5 |
93 |
0 |
|
|
177209813 |
liomsv |
C |
Oct. 20, 2022, 4:32 p.m. |
OK |
Java 8 |
TESTS |
5 |
93 |
0 |
|
|
177202213 |
Zahid_Hasan_Sahin |
C |
Oct. 20, 2022, 4:13 p.m. |
OK |
Java 8 |
TESTS |
5 |
93 |
0 |
|
|
177229831 |
The_Bigbull |
C |
Oct. 20, 2022, 7:12 p.m. |
OK |
Java 8 |
TESTS |
5 |
109 |
0 |
|
|
177208728 |
ganesh_6 |
C |
Oct. 20, 2022, 4:30 p.m. |
OK |
Java 8 |
TESTS |
5 |
109 |
0 |
|
|
177211528 |
abhishek9875 |
C |
Oct. 20, 2022, 4:37 p.m. |
OK |
Java 8 |
TESTS |
5 |
140 |
0 |
|
|
177258819 |
CtrlACtrlV |
C |
Oct. 21, 2022, 4:47 a.m. |
OK |
MS C++ 2017 |
TESTS |
5 |
15 |
0 |
|
|
177205726 |
KKastaneda |
C |
Oct. 20, 2022, 4:22 p.m. |
OK |
MS C++ 2017 |
TESTS |
5 |
15 |
0 |
|
|
177214851 |
kun2605879979 |
C |
Oct. 20, 2022, 4:53 p.m. |
OK |
MS C++ 2017 |
TESTS |
5 |
15 |
16076800 |
|
|
177258530 |
CtrlACtrlV |
C |
Oct. 21, 2022, 4:43 a.m. |
OK |
MS C++ 2017 |
TESTS |
5 |
31 |
0 |
|
|
177207494 |
Gao_zhenchuan |
C |
Oct. 20, 2022, 4:27 p.m. |
OK |
MS C++ 2017 |
TESTS |
5 |
31 |
0 |
|
|
177203468 |
Yangsp |
C |
Oct. 20, 2022, 4:16 p.m. |
OK |
MS C++ 2017 |
TESTS |
5 |
187 |
0 |
|
|
177210523 |
XYShaoKang |
C |
Oct. 20, 2022, 4:34 p.m. |
OK |
Node.js |
TESTS |
5 |
46 |
819200 |
|
|
177220765 |
34z12000 |
C |
Oct. 20, 2022, 5:38 p.m. |
OK |
PyPy 3 |
TESTS |
5 |
92 |
1433600 |
|
|
177212686 |
lemoon_05 |
C |
Oct. 20, 2022, 4:42 p.m. |
OK |
PyPy 3 |
TESTS |
5 |
93 |
1638400 |
|
|
177219405 |
Talurist |
C |
Oct. 20, 2022, 5:26 p.m. |
OK |
PyPy 3 |
TESTS |
5 |
93 |
1945600 |
|
|
177214483 |
prateek.goel.cs.2019 |
C |
Oct. 20, 2022, 4:51 p.m. |
OK |
PyPy 3 |
TESTS |
5 |
93 |
2355200 |
|
|
177248266 |
hxu10 |
C |
Oct. 21, 2022, 1:32 a.m. |
OK |
PyPy 3 |
TESTS |
5 |
108 |
2560000 |
|
|
177216843 |
Pooja96 |
C |
Oct. 20, 2022, 5:06 p.m. |
OK |
PyPy 3 |
TESTS |
5 |
109 |
2457600 |
|
|
177216868 |
prateek.goel.cs.2019 |
C |
Oct. 20, 2022, 5:07 p.m. |
OK |
PyPy 3 |
TESTS |
5 |
124 |
2355200 |
|
|
177217086 |
prateek.goel.cs.2019 |
C |
Oct. 20, 2022, 5:08 p.m. |
OK |
PyPy 3 |
TESTS |
5 |
124 |
2457600 |
|
|
177218419 |
mnkp |
C |
Oct. 20, 2022, 5:18 p.m. |
OK |
PyPy 3 |
TESTS |
5 |
155 |
3072000 |
|
|
177247733 |
samchen123 |
C |
Oct. 21, 2022, 1:20 a.m. |
OK |
PyPy 3-64 |
TESTS |
5 |
46 |
1536000 |
|
|
177207870 |
doudin |
C |
Oct. 20, 2022, 4:28 p.m. |
OK |
PyPy 3-64 |
TESTS |
5 |
62 |
1843200 |
|
|
177226933 |
sushmanth.dampur8780 |
C |
Oct. 20, 2022, 6:39 p.m. |
OK |
PyPy 3-64 |
TESTS |
5 |
62 |
1945600 |
|
|
177224778 |
H3X460N157 |
C |
Oct. 20, 2022, 6:16 p.m. |
OK |
PyPy 3-64 |
TESTS |
5 |
62 |
2048000 |
|
|
177216848 |
bekbolbolatov |
C |
Oct. 20, 2022, 5:06 p.m. |
OK |
PyPy 3-64 |
TESTS |
5 |
62 |
2048000 |
|
|
177259443 |
riroan |
C |
Oct. 21, 2022, 4:57 a.m. |
OK |
PyPy 3-64 |
TESTS |
5 |
62 |
2252800 |
|
|
177257556 |
abhijeet.panihar.cse20 |
C |
Oct. 21, 2022, 4:26 a.m. |
OK |
PyPy 3-64 |
TESTS |
5 |
62 |
2252800 |
|
|
177216499 |
Maltsev_Kir |
C |
Oct. 20, 2022, 5:04 p.m. |
OK |
PyPy 3-64 |
TESTS |
5 |
62 |
2252800 |
|
|
177226839 |
nitin4184 |
C |
Oct. 20, 2022, 6:38 p.m. |
OK |
PyPy 3-64 |
TESTS |
5 |
62 |
2355200 |
|
|
177202132 |
skull.zju |
C |
Oct. 20, 2022, 4:13 p.m. |
OK |
PyPy 3-64 |
TESTS |
5 |
62 |
3481600 |
|
|
177249534 |
Unknown_OP |
C |
Oct. 21, 2022, 2:01 a.m. |
OK |
Python 3 |
TESTS |
5 |
46 |
0 |
|
|
177219687 |
Korneli |
C |
Oct. 20, 2022, 5:29 p.m. |
OK |
Python 3 |
TESTS |
5 |
46 |
0 |
|
|
177210573 |
Pawan_Lahoti |
C |
Oct. 20, 2022, 4:34 p.m. |
OK |
Python 3 |
TESTS |
5 |
46 |
0 |
|
|
177204042 |
Priyaranjan_Khan |
C |
Oct. 20, 2022, 4:18 p.m. |
OK |
Python 3 |
TESTS |
5 |
46 |
0 |
|
|
177259271 |
MohamedHamed123 |
C |
Oct. 21, 2022, 4:55 a.m. |
OK |
Python 3 |
TESTS |
5 |
61 |
0 |
|
|
177245037 |
juandavidarce |
C |
Oct. 21, 2022, 12:13 a.m. |
OK |
Python 3 |
TESTS |
5 |
61 |
102400 |
|
|
177226811 |
MohamedHamed123 |
C |
Oct. 20, 2022, 6:37 p.m. |
OK |
Python 3 |
TESTS |
5 |
62 |
102400 |
|
|
177216436 |
D_evil |
C |
Oct. 20, 2022, 5:03 p.m. |
OK |
Python 3 |
TESTS |
5 |
62 |
819200 |
|
|
177211697 |
abcsumit |
C |
Oct. 20, 2022, 4:38 p.m. |
OK |
Python 3 |
TESTS |
5 |
77 |
0 |
|
|
177255900 |
monu_dixit |
C |
Oct. 21, 2022, 3:57 a.m. |
OK |
Python 3 |
TESTS |
5 |
202 |
0 |
|
|
177253166 |
Sempr |
C |
Oct. 21, 2022, 3:11 a.m. |
OK |
Rust 2021 |
TESTS |
5 |
15 |
0 |
|
|
remove filters
Back to search problems