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 |
1951
|
Codeforces Global Round 25 |
FINISHED |
False |
10800 |
24765863 |
April 6, 2024, 2:35 p.m. |
Problems
B"There are n cows participating in a coding tournament. Cow i has a Cowdeforces rating of a_i (all distinct), and is initially in position i . The tournament consists of n-1 matches as follows: You are the owner of cow k . For you, winning the tournament is not important; rather, you want your cow to win in as many matches as possible. As an acquaintance of the tournament organizers, you can ask them to swap the position of your cow with another cow only once, or you can choose to do nothing. Find the maximum number of wins your cow can achieve. Each test contains multiple test cases. The first line contains an integer t ( 1 <= t <= 10^4 ) -- the number of test cases. The description of the test cases follows. The first line of each test case contains two integers n and k ( 2 <= n <= 10^5, 1 <= k <= n ) -- the number of cows and your cow's index. The second line of each test case contains n integers a_1, a_2, ldots, a_n ( 1 <= a_i <= 10^9 ) -- the Cowdeforces rating of the cows. It is guaranteed that a_i 's are pairwise different. It is guaranteed that the sum of n over all test cases does not exceed 10^5 . For each test case, print one integer: the maximum number of wins cow k can achieve if you choose to swap (or do nothing) optimally. In the first test case, it is optimal to do nothing. Let a' be the Cowdeforces rating of the cows in the original order (with your cow's rating bolded), then In the second test case, it is optimal to swap your cow to position 3 . Then, let a' be the Cowdeforces rating of the cows in the order after the swap. "... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
255404125 |
karamkontar |
B |
April 7, 2024, 2:29 a.m. |
OK |
C# 10 |
TESTS |
13 |
108 |
11776000 |
|
|
255403562 |
karamkontar |
B |
April 7, 2024, 2:20 a.m. |
OK |
C# 10 |
TESTS |
13 |
124 |
11571200 |
|
|
255399648 |
Bree_Cui |
B |
April 7, 2024, 1:11 a.m. |
OK |
C++14 (GCC 6-32) |
TESTS |
13 |
62 |
409600 |
|
|
255396845 |
chenhongrui |
B |
April 7, 2024, 12:18 a.m. |
OK |
C++14 (GCC 6-32) |
TESTS |
13 |
62 |
819200 |
|
|
255376033 |
sojaljain02 |
B |
April 6, 2024, 7:51 p.m. |
OK |
C++14 (GCC 6-32) |
TESTS |
13 |
77 |
0 |
|
|
255396973 |
srujanwadkar13 |
B |
April 7, 2024, 12:20 a.m. |
OK |
C++14 (GCC 6-32) |
TESTS |
13 |
77 |
0 |
|
|
255396819 |
quyawm126 |
B |
April 7, 2024, 12:17 a.m. |
OK |
C++14 (GCC 6-32) |
TESTS |
13 |
77 |
0 |
|
|
255366797 |
Le_Gusto |
B |
April 6, 2024, 6:36 p.m. |
OK |
C++14 (GCC 6-32) |
TESTS |
13 |
77 |
102400 |
|
|
255419463 |
sg2349 |
B |
April 7, 2024, 5:45 a.m. |
OK |
C++14 (GCC 6-32) |
TESTS |
13 |
77 |
102400 |
|
|
255413345 |
BaiDongLin |
B |
April 7, 2024, 4:42 a.m. |
OK |
C++14 (GCC 6-32) |
TESTS |
13 |
77 |
102400 |
|
|
255398603 |
Crushxl |
B |
April 7, 2024, 12:51 a.m. |
OK |
C++14 (GCC 6-32) |
TESTS |
13 |
77 |
102400 |
|
|
255387456 |
soumyatus12345 |
B |
April 6, 2024, 9:46 p.m. |
OK |
C++14 (GCC 6-32) |
TESTS |
13 |
77 |
102400 |
|
|
255406194 |
_Ramba_ |
B |
April 7, 2024, 3:03 a.m. |
OK |
C++17 (GCC 7-32) |
TESTS |
13 |
61 |
102400 |
|
|
255411619 |
NoBody_Can_Beats_Me |
B |
April 7, 2024, 4:22 a.m. |
OK |
C++17 (GCC 7-32) |
TESTS |
13 |
62 |
0 |
|
|
255419035 |
swayampal_2003 |
B |
April 7, 2024, 5:41 a.m. |
OK |
C++17 (GCC 7-32) |
TESTS |
13 |
62 |
0 |
|
|
255417655 |
PK__CODER |
B |
April 7, 2024, 5:29 a.m. |
OK |
C++17 (GCC 7-32) |
TESTS |
13 |
62 |
0 |
|
|
255410964 |
HarshaNP |
B |
April 7, 2024, 4:13 a.m. |
OK |
C++17 (GCC 7-32) |
TESTS |
13 |
62 |
0 |
|
|
255410025 |
coding_bit |
B |
April 7, 2024, 4 a.m. |
OK |
C++17 (GCC 7-32) |
TESTS |
13 |
62 |
0 |
|
|
255407821 |
zaogaijieshu |
B |
April 7, 2024, 3:29 a.m. |
OK |
C++17 (GCC 7-32) |
TESTS |
13 |
62 |
0 |
|
|
255407013 |
ELSE_IF_TRIDIB21 |
B |
April 7, 2024, 3:18 a.m. |
OK |
C++17 (GCC 7-32) |
TESTS |
13 |
62 |
0 |
|
|
255406477 |
anikthe |
B |
April 7, 2024, 3:08 a.m. |
OK |
C++17 (GCC 7-32) |
TESTS |
13 |
62 |
0 |
|
|
255404417 |
Insert_Username_Here |
B |
April 7, 2024, 2:34 a.m. |
OK |
C++17 (GCC 7-32) |
TESTS |
13 |
62 |
0 |
|
|
255397102 |
shift. |
B |
April 7, 2024, 12:23 a.m. |
OK |
C++20 (GCC 13-64) |
TESTS |
13 |
61 |
0 |
|
|
255395915 |
__Satrix |
B |
April 7, 2024, midnight |
OK |
C++20 (GCC 13-64) |
TESTS |
13 |
61 |
0 |
|
|
255403880 |
sumanth_Bobby |
B |
April 7, 2024, 2:25 a.m. |
OK |
C++20 (GCC 13-64) |
TESTS |
13 |
61 |
102400 |
|
|
255403318 |
MeIoN_is_UMP45 |
B |
April 7, 2024, 2:16 a.m. |
OK |
C++20 (GCC 13-64) |
TESTS |
13 |
61 |
102400 |
|
|
255397969 |
SunXiaoChuan |
B |
April 7, 2024, 12:39 a.m. |
OK |
C++20 (GCC 13-64) |
TESTS |
13 |
61 |
102400 |
|
|
255415792 |
RaghadMusleh |
B |
April 7, 2024, 5:10 a.m. |
OK |
C++20 (GCC 13-64) |
TESTS |
13 |
61 |
102400 |
|
|
255396548 |
ywc... |
B |
April 7, 2024, 12:13 a.m. |
OK |
C++20 (GCC 13-64) |
TESTS |
13 |
61 |
102400 |
|
|
255414799 |
ShadowDrunk |
B |
April 7, 2024, 4:59 a.m. |
OK |
C++20 (GCC 13-64) |
TESTS |
13 |
62 |
0 |
|
|
255420136 |
phantomzs |
B |
April 7, 2024, 5:51 a.m. |
OK |
C++20 (GCC 13-64) |
TESTS |
13 |
62 |
0 |
|
|
255414017 |
msp_008987 |
B |
April 7, 2024, 4:50 a.m. |
OK |
C++20 (GCC 13-64) |
TESTS |
13 |
62 |
0 |
|
|
255401412 |
bluemegane |
B |
April 7, 2024, 1:43 a.m. |
OK |
C# 8 |
TESTS |
13 |
155 |
9625600 |
|
|
255355728 |
mobrei |
B |
April 6, 2024, 5:24 p.m. |
OK |
GNU C11 |
TESTS |
13 |
77 |
409600 |
|
|
255414430 |
nguyenquocthao00 |
B |
April 7, 2024, 4:55 a.m. |
OK |
Go |
TESTS |
13 |
62 |
4915200 |
|
|
255412986 |
Specter_TheUnchained |
B |
April 7, 2024, 4:38 a.m. |
OK |
Go |
TESTS |
13 |
108 |
4915200 |
|
|
255354682 |
priyaroy3370 |
B |
April 6, 2024, 5:21 p.m. |
OK |
Java 21 |
TESTS |
13 |
249 |
921600 |
|
|
255402008 |
xin2002 |
B |
April 7, 2024, 1:53 a.m. |
OK |
Java 21 |
TESTS |
13 |
250 |
4710400 |
|
|
255355241 |
aks_den |
B |
April 6, 2024, 5:23 p.m. |
OK |
Java 21 |
TESTS |
13 |
280 |
409600 |
|
|
255414341 |
amit_roy |
B |
April 7, 2024, 4:54 a.m. |
OK |
Java 21 |
TESTS |
13 |
280 |
716800 |
|
|
255412618 |
wizwilzo |
B |
April 7, 2024, 4:34 a.m. |
OK |
Java 21 |
TESTS |
13 |
281 |
2867200 |
|
|
255354604 |
ash_79 |
B |
April 6, 2024, 5:21 p.m. |
OK |
Java 21 |
TESTS |
13 |
312 |
614400 |
|
|
255404719 |
_ShenHua_ |
B |
April 7, 2024, 2:39 a.m. |
OK |
Java 21 |
TESTS |
13 |
327 |
716800 |
|
|
255418177 |
BruceHuang |
B |
April 7, 2024, 5:34 a.m. |
OK |
Java 21 |
TESTS |
13 |
467 |
1228800 |
|
|
255378684 |
dawn_raja |
B |
April 6, 2024, 8:15 p.m. |
OK |
Java 21 |
TESTS |
13 |
468 |
1126400 |
|
|
255373530 |
dawn_raja |
B |
April 6, 2024, 7:29 p.m. |
OK |
Java 21 |
TESTS |
13 |
468 |
2662400 |
|
|
255391742 |
vatsal_04 |
B |
April 6, 2024, 10:47 p.m. |
OK |
Java 8 |
TESTS |
13 |
156 |
0 |
|
|
255366018 |
Yousef_Badr |
B |
April 6, 2024, 6:31 p.m. |
OK |
Java 8 |
TESTS |
13 |
171 |
0 |
|
|
255365938 |
faresbadr316 |
B |
April 6, 2024, 6:31 p.m. |
OK |
Java 8 |
TESTS |
13 |
171 |
0 |
|
|
255390250 |
Meghnath_IJ |
B |
April 6, 2024, 10:25 p.m. |
OK |
Java 8 |
TESTS |
13 |
171 |
6758400 |
|
|
255413839 |
y_a_s |
B |
April 7, 2024, 4:48 a.m. |
OK |
Java 8 |
TESTS |
13 |
187 |
0 |
|
|
255410857 |
2210080003 |
B |
April 7, 2024, 4:11 a.m. |
OK |
Java 8 |
TESTS |
13 |
342 |
0 |
|
|
255354675 |
vinuthna2412 |
B |
April 6, 2024, 5:21 p.m. |
OK |
Java 8 |
TESTS |
13 |
374 |
0 |
|
|
255399411 |
ShadowBeast_13 |
B |
April 7, 2024, 1:07 a.m. |
OK |
Java 8 |
TESTS |
13 |
421 |
0 |
|
|
255422335 |
abhay_30281125 |
B |
April 7, 2024, 5:58 a.m. |
OK |
PyPy 3 |
TESTS |
13 |
437 |
10854400 |
|
|
255383208 |
ck_1 |
B |
April 6, 2024, 8:57 p.m. |
OK |
PyPy 3 |
TESTS |
13 |
499 |
10649600 |
|
|
255365310 |
__rose |
B |
April 6, 2024, 6:27 p.m. |
OK |
PyPy 3 |
TESTS |
13 |
515 |
10649600 |
|
|
255365503 |
_still_learning__ |
B |
April 6, 2024, 6:28 p.m. |
OK |
PyPy 3 |
TESTS |
13 |
531 |
10444800 |
|
|
255356491 |
srujithchaithanya |
B |
April 6, 2024, 5:26 p.m. |
OK |
PyPy 3 |
TESTS |
13 |
546 |
10444800 |
|
|
255401422 |
voicon |
B |
April 7, 2024, 1:43 a.m. |
OK |
PyPy 3-64 |
TESTS |
13 |
249 |
13209600 |
|
|
255365202 |
sanctus |
B |
April 6, 2024, 6:27 p.m. |
OK |
PyPy 3-64 |
TESTS |
13 |
249 |
13312000 |
|
|
255388065 |
Libe12 |
B |
April 6, 2024, 9:54 p.m. |
OK |
PyPy 3-64 |
TESTS |
13 |
249 |
15155200 |
|
|
255412801 |
yuki_keshiki |
B |
April 7, 2024, 4:36 a.m. |
OK |
PyPy 3-64 |
TESTS |
13 |
264 |
15360000 |
|
|
255393775 |
_yoru_ |
B |
April 6, 2024, 11:22 p.m. |
OK |
PyPy 3-64 |
TESTS |
13 |
280 |
17203200 |
|
|
255405961 |
mikeac |
B |
April 7, 2024, 2:59 a.m. |
OK |
PyPy 3-64 |
TESTS |
13 |
281 |
13414400 |
|
|
255368657 |
akshayjadhavkrishnaholic |
B |
April 6, 2024, 6:50 p.m. |
OK |
PyPy 3-64 |
TESTS |
13 |
296 |
13107200 |
|
|
255413429 |
redcar |
B |
April 7, 2024, 4:44 a.m. |
OK |
PyPy 3-64 |
TESTS |
13 |
296 |
14643200 |
|
|
255369301 |
logong |
B |
April 6, 2024, 6:55 p.m. |
OK |
PyPy 3-64 |
TESTS |
13 |
312 |
15052800 |
|
|
255374595 |
mega_bot |
B |
April 6, 2024, 7:38 p.m. |
OK |
PyPy 3-64 |
TESTS |
13 |
327 |
13414400 |
|
|
255366600 |
OLOGY |
B |
April 6, 2024, 6:35 p.m. |
OK |
Python 2 |
TESTS |
13 |
156 |
5939200 |
|
|
255380490 |
OLOGY |
B |
April 6, 2024, 8:31 p.m. |
OK |
Python 2 |
TESTS |
13 |
171 |
6041600 |
|
|
255379960 |
OLOGY |
B |
April 6, 2024, 8:26 p.m. |
OK |
Python 2 |
TESTS |
13 |
171 |
6041600 |
|
|
255401931 |
Marshmello |
B |
April 7, 2024, 1:52 a.m. |
OK |
Python 2 |
TESTS |
13 |
265 |
5222400 |
|
|
255388670 |
MTA9402 |
B |
April 6, 2024, 10:02 p.m. |
OK |
Python 3 |
TESTS |
13 |
124 |
12697600 |
|
|
255370345 |
bebsk397160 |
B |
April 6, 2024, 7:04 p.m. |
OK |
Python 3 |
TESTS |
13 |
139 |
14028800 |
|
|
255379794 |
brijmohan6499 |
B |
April 6, 2024, 8:25 p.m. |
OK |
Python 3 |
TESTS |
13 |
140 |
14131200 |
|
|
255372509 |
Mekan5050 |
B |
April 6, 2024, 7:22 p.m. |
OK |
Python 3 |
TESTS |
13 |
155 |
14131200 |
|
|
255371860 |
_Tremor_ |
B |
April 6, 2024, 7:16 p.m. |
OK |
Python 3 |
TESTS |
13 |
156 |
14131200 |
|
|
255385545 |
medfadiabaidi1 |
B |
April 6, 2024, 9:23 p.m. |
OK |
Python 3 |
TESTS |
13 |
171 |
14131200 |
|
|
255367007 |
Isfak |
B |
April 6, 2024, 6:38 p.m. |
OK |
Python 3 |
TESTS |
13 |
202 |
12595200 |
|
|
255354863 |
Ephyg |
B |
April 6, 2024, 5:22 p.m. |
OK |
Python 3 |
TESTS |
13 |
202 |
14131200 |
|
|
255360054 |
ashwinkumari.cse2022 |
B |
April 6, 2024, 5:34 p.m. |
OK |
Python 3 |
TESTS |
13 |
249 |
14131200 |
|
|
255414559 |
a.dot |
B |
April 7, 2024, 4:56 a.m. |
OK |
Rust 2021 |
TESTS |
13 |
62 |
0 |
|
|
255369738 |
pumpkincheshire |
B |
April 6, 2024, 6:59 p.m. |
OK |
Rust 2021 |
TESTS |
13 |
77 |
4812800 |
|
|
255413449 |
a.dot |
B |
April 7, 2024, 4:44 a.m. |
OK |
Rust 2021 |
TESTS |
13 |
203 |
0 |
|
|
remove filters
Back to search problems