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'You are given array a of length n . You can choose one segment [l, r] ( 1 <= l <= r <= n ) and integer value k (positive, negative or even zero) and change a_l, a_{l + 1}, ... , a_r by k each (i.e. a_i := a_i + k for each l <= i <= r ). What is the maximum possible number of elements with value c that can be obtained after one such operation? The first line contains two integers n and c ( 1 <= n <= 5 cdot 10^5 , 1 <= c <= 5 cdot 10^5 ) -- the length of array and the value c to obtain. The second line contains n integers a_1, a_2, ... , a_n ( 1 <= a_i <= 5 cdot 10^5 ) -- array a . Print one integer -- the maximum possible number of elements with value c which can be obtained after performing operation described above. In the first example we can choose any segment and k = 0 . The array will stay same. In the second example we can choose segment [1, 3] and k = -4 . The array will become [2, -2, 2] . '... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
46477560 |
vjudge5 |
E |
Dec. 2, 2018, 8:19 a.m. |
OK |
Clang++17 Diagnostics |
TESTS |
65 |
1091 |
38297600 |
|
2000 |
65318690 |
LaSWeeG |
E |
Nov. 18, 2019, 6:38 p.m. |
OK |
FPC |
TESTS |
65 |
936 |
10137600 |
|
2000 |
46389822 |
Sempr |
E |
Nov. 30, 2018, 4:45 a.m. |
OK |
GNU C11 |
TESTS |
65 |
93 |
10035200 |
|
2000 |
46471905 |
shreya_2004 |
E |
Dec. 2, 2018, 7:36 a.m. |
OK |
GNU C11 |
TESTS |
65 |
93 |
10035200 |
|
2000 |
48576412 |
MYNAMEISSHARIFUL |
E |
Jan. 19, 2019, 2:16 p.m. |
OK |
GNU C11 |
TESTS |
65 |
171 |
12083200 |
|
2000 |
49112996 |
rainboy |
E |
Jan. 28, 2019, 3:44 p.m. |
OK |
GNU C11 |
TESTS |
65 |
202 |
7987200 |
|
2000 |
47394473 |
COLINGAO |
E |
Dec. 23, 2018, 10:18 a.m. |
OK |
GNU C++11 |
TESTS |
65 |
31 |
3993600 |
|
2000 |
52461208 |
lyzqs |
E |
April 7, 2019, 1:31 p.m. |
OK |
GNU C++11 |
TESTS |
65 |
31 |
3993600 |
|
2000 |
46391511 |
Sooke |
E |
Nov. 30, 2018, 6:16 a.m. |
OK |
GNU C++11 |
TESTS |
65 |
31 |
6041600 |
|
2000 |
46705628 |
PaulShi |
E |
Dec. 7, 2018, 6:54 a.m. |
OK |
GNU C++11 |
TESTS |
65 |
31 |
6041600 |
|
2000 |
46834855 |
SovietPower |
E |
Dec. 10, 2018, 12:42 a.m. |
OK |
GNU C++11 |
TESTS |
65 |
31 |
6860800 |
|
2000 |
48366846 |
xkjcom |
E |
Jan. 13, 2019, 11:17 p.m. |
OK |
GNU C++11 |
TESTS |
65 |
31 |
12185600 |
|
2000 |
47887037 |
luogu_bot4 |
E |
Jan. 4, 2019, 1:04 a.m. |
OK |
GNU C++11 |
TESTS |
65 |
46 |
3788800 |
|
2000 |
47887043 |
fks20011206 |
E |
Jan. 4, 2019, 1:04 a.m. |
OK |
GNU C++11 |
TESTS |
65 |
46 |
3788800 |
|
2000 |
47394546 |
SGColin |
E |
Dec. 23, 2018, 10:21 a.m. |
OK |
GNU C++11 |
TESTS |
65 |
46 |
3993600 |
|
2000 |
47547295 |
ahaha254 |
E |
Dec. 27, 2018, 10:55 a.m. |
OK |
GNU C++11 |
TESTS |
65 |
46 |
3993600 |
|
2000 |
46830053 |
neal |
E |
Dec. 9, 2018, 9:24 p.m. |
OK |
GNU C++14 |
TESTS |
65 |
31 |
6041600 |
|
2000 |
46829921 |
neal |
E |
Dec. 9, 2018, 9:14 p.m. |
OK |
GNU C++14 |
TESTS |
65 |
46 |
3993600 |
|
2000 |
46829925 |
neal |
E |
Dec. 9, 2018, 9:15 p.m. |
OK |
GNU C++14 |
TESTS |
65 |
46 |
3993600 |
|
2000 |
46829915 |
neal |
E |
Dec. 9, 2018, 9:14 p.m. |
OK |
GNU C++14 |
TESTS |
65 |
46 |
3993600 |
|
2000 |
46829983 |
neal |
E |
Dec. 9, 2018, 9:19 p.m. |
OK |
GNU C++14 |
TESTS |
65 |
46 |
4096000 |
|
2000 |
46829893 |
neal |
E |
Dec. 9, 2018, 9:12 p.m. |
OK |
GNU C++14 |
TESTS |
65 |
46 |
4096000 |
|
2000 |
46829988 |
neal |
E |
Dec. 9, 2018, 9:20 p.m. |
OK |
GNU C++14 |
TESTS |
65 |
46 |
4096000 |
|
2000 |
47275321 |
neal |
E |
Dec. 19, 2018, 6:56 p.m. |
OK |
GNU C++14 |
TESTS |
65 |
46 |
6041600 |
|
2000 |
46830048 |
neal |
E |
Dec. 9, 2018, 9:23 p.m. |
OK |
GNU C++14 |
TESTS |
65 |
46 |
6041600 |
|
2000 |
46830044 |
neal |
E |
Dec. 9, 2018, 9:23 p.m. |
OK |
GNU C++14 |
TESTS |
65 |
46 |
6041600 |
|
2000 |
46409002 |
jcode777 |
E |
Nov. 30, 2018, 4:07 p.m. |
OK |
GNU C++17 |
TESTS |
65 |
109 |
1945600 |
|
2000 |
47189210 |
yinwuxiao |
E |
Dec. 18, 2018, 11:19 a.m. |
OK |
GNU C++17 |
TESTS |
65 |
109 |
58675200 |
|
2000 |
46357606 |
kshitij98 |
E |
Nov. 29, 2018, 9:14 a.m. |
OK |
GNU C++17 |
TESTS |
65 |
124 |
2048000 |
|
2000 |
46468644 |
sqdbibibi |
E |
Dec. 2, 2018, 5:57 a.m. |
OK |
GNU C++17 |
TESTS |
65 |
124 |
2048000 |
|
2000 |
46406097 |
nobody123 |
E |
Nov. 30, 2018, 2:40 p.m. |
OK |
GNU C++17 |
TESTS |
65 |
124 |
6041600 |
|
2000 |
46365379 |
Summer1989 |
E |
Nov. 29, 2018, 1 p.m. |
OK |
GNU C++17 |
TESTS |
65 |
124 |
6041600 |
|
2000 |
69862604 |
wan-_-s |
E |
Jan. 30, 2020, 7:04 p.m. |
OK |
GNU C++17 |
TESTS |
65 |
124 |
6041600 |
|
2000 |
62604194 |
Star-Platinum |
E |
Oct. 15, 2019, 7 a.m. |
OK |
GNU C++17 |
TESTS |
65 |
124 |
6041600 |
|
2000 |
56420082 |
huxiaotaostasy |
E |
July 2, 2019, 6:55 a.m. |
OK |
GNU C++17 |
TESTS |
65 |
124 |
6041600 |
|
2000 |
47164585 |
vjudge2 |
E |
Dec. 17, 2018, 11:51 a.m. |
OK |
GNU C++17 |
TESTS |
65 |
124 |
6041600 |
|
2000 |
51283709 |
aminul |
E |
March 14, 2019, 5:58 a.m. |
OK |
Java 8 |
TESTS |
65 |
140 |
17817600 |
|
2000 |
46542006 |
dyhu083 |
E |
Dec. 3, 2018, 12:30 p.m. |
OK |
Java 8 |
TESTS |
65 |
155 |
0 |
|
2000 |
63850774 |
A5SAS51N |
E |
Oct. 30, 2019, 3:40 p.m. |
OK |
Java 8 |
TESTS |
65 |
155 |
54784000 |
|
2000 |
46347968 |
Ahmad |
E |
Nov. 28, 2018, 7:19 p.m. |
OK |
Java 8 |
TESTS |
65 |
156 |
10342400 |
|
2000 |
59706674 |
yaoct |
E |
Aug. 30, 2019, 12:58 p.m. |
OK |
Java 8 |
TESTS |
65 |
187 |
14438400 |
|
2000 |
46345237 |
Kharouba |
E |
Nov. 28, 2018, 5:45 p.m. |
OK |
Java 8 |
TESTS |
65 |
187 |
14745600 |
|
2000 |
51430588 |
Andres1 |
E |
March 17, 2019, 11:34 p.m. |
OK |
Java 8 |
TESTS |
65 |
202 |
16281600 |
|
2000 |
46547697 |
polyakoff |
E |
Dec. 3, 2018, 4:04 p.m. |
OK |
Java 8 |
TESTS |
65 |
202 |
17203200 |
|
2000 |
46345248 |
wolfib |
E |
Nov. 28, 2018, 5:45 p.m. |
OK |
Java 8 |
TESTS |
65 |
202 |
18022400 |
|
2000 |
48044435 |
SpargelTarzan |
E |
Jan. 7, 2019, 12:02 a.m. |
OK |
Java 8 |
TESTS |
65 |
202 |
19558400 |
|
2000 |
47387036 |
moss3s |
E |
Dec. 23, 2018, 5:51 a.m. |
OK |
Kotlin |
TESTS |
65 |
436 |
52019200 |
|
2000 |
46429937 |
Coder_D |
E |
Dec. 1, 2018, 4:43 a.m. |
OK |
Mono C# |
TESTS |
65 |
233 |
49049600 |
|
2000 |
46339735 |
eki |
E |
Nov. 28, 2018, 4:29 p.m. |
OK |
Mono C# |
TESTS |
65 |
311 |
65638400 |
|
2000 |
46720745 |
vjudge5 |
E |
Dec. 7, 2018, 1:05 p.m. |
OK |
MS C++ |
TESTS |
65 |
109 |
4505600 |
|
2000 |
46434194 |
vjudge1 |
E |
Dec. 1, 2018, 7:52 a.m. |
OK |
MS C++ |
TESTS |
65 |
124 |
6041600 |
|
2000 |
46572996 |
vjudge5 |
E |
Dec. 4, 2018, 7:03 a.m. |
OK |
MS C++ |
TESTS |
65 |
187 |
36147200 |
|
2000 |
46572880 |
vjudge3 |
E |
Dec. 4, 2018, 6:59 a.m. |
OK |
MS C++ |
TESTS |
65 |
187 |
36147200 |
|
2000 |
46434899 |
vjudge2 |
E |
Dec. 1, 2018, 8:24 a.m. |
OK |
MS C++ |
TESTS |
65 |
202 |
36147200 |
|
2000 |
46573252 |
vjudge4 |
E |
Dec. 4, 2018, 7:12 a.m. |
OK |
MS C++ |
TESTS |
65 |
202 |
36147200 |
|
2000 |
46357302 |
CtrlAlt |
E |
Nov. 29, 2018, 9:02 a.m. |
OK |
MS C++ |
TESTS |
65 |
217 |
16076800 |
|
2000 |
50501653 |
iloveori |
E |
Feb. 25, 2019, 5:31 p.m. |
OK |
MS C++ |
TESTS |
65 |
358 |
2048000 |
|
2000 |
51789444 |
vjudge5 |
E |
March 24, 2019, 12:09 p.m. |
OK |
MS C++ |
TESTS |
65 |
358 |
7987200 |
|
2000 |
51790681 |
vjudge1 |
E |
March 24, 2019, 12:40 p.m. |
OK |
MS C++ |
TESTS |
65 |
374 |
3993600 |
|
2000 |
57269040 |
ZSTU-2018329621261 |
E |
July 18, 2019, 8:14 a.m. |
OK |
MS C++ 2017 |
TESTS |
65 |
358 |
6041600 |
|
2000 |
59640534 |
siwei |
E |
Aug. 29, 2019, 1:03 a.m. |
OK |
MS C++ 2017 |
TESTS |
65 |
421 |
6041600 |
|
2000 |
46343030 |
c1729 |
E |
Nov. 28, 2018, 4:55 p.m. |
OK |
PyPy 2 |
TESTS |
65 |
405 |
51200000 |
|
2000 |
47331014 |
YESMAths |
E |
Dec. 21, 2018, 12:56 p.m. |
OK |
PyPy 2 |
TESTS |
65 |
436 |
36761600 |
|
2000 |
47338712 |
tiantian5 |
E |
Dec. 21, 2018, 4:18 p.m. |
OK |
PyPy 3 |
TESTS |
65 |
935 |
77004800 |
|
2000 |
46431059 |
only_training |
E |
Dec. 1, 2018, 5:41 a.m. |
OK |
PyPy 3 |
TESTS |
65 |
951 |
79974400 |
|
2000 |
46356776 |
TABball |
E |
Nov. 29, 2018, 8:45 a.m. |
OK |
Python 3 |
TESTS |
65 |
639 |
26112000 |
|
2000 |
63422557 |
MinecraftFuns |
E |
Oct. 26, 2019, 6:52 a.m. |
OK |
Python 3 |
TESTS |
65 |
686 |
26726400 |
|
2000 |
47018833 |
karpik |
E |
Dec. 14, 2018, 9:29 p.m. |
OK |
Python 3 |
TESTS |
65 |
717 |
25702400 |
|
2000 |
46339475 |
asvasil |
E |
Nov. 28, 2018, 4:28 p.m. |
OK |
Python 3 |
TESTS |
65 |
717 |
26112000 |
|
2000 |
46343619 |
tieros |
E |
Nov. 28, 2018, 5:04 p.m. |
OK |
Python 3 |
TESTS |
65 |
717 |
32460800 |
|
2000 |
52475954 |
vjudge5 |
E |
April 7, 2019, 11:01 p.m. |
OK |
Python 3 |
TESTS |
65 |
795 |
32153600 |
|
2000 |
52475941 |
tamahom |
E |
April 7, 2019, 10:59 p.m. |
OK |
Python 3 |
TESTS |
65 |
811 |
32051200 |
|
2000 |
46781330 |
knighthawk |
E |
Dec. 9, 2018, 2:44 a.m. |
OK |
Python 3 |
TESTS |
65 |
998 |
52531200 |
|
2000 |
47502420 |
CHelle |
E |
Dec. 25, 2018, 6:53 p.m. |
OK |
Python 3 |
TESTS |
65 |
1028 |
31539200 |
|
2000 |
47158058 |
whatshisbucket |
E |
Dec. 17, 2018, 8:08 a.m. |
OK |
Python 3 |
TESTS |
65 |
1232 |
73216000 |
|
2000 |
65505148 |
sansen |
E |
Nov. 21, 2019, 9:42 p.m. |
OK |
Rust |
TESTS |
65 |
124 |
22323200 |
|
2000 |
46347199 |
yakamoto |
E |
Nov. 28, 2018, 6:49 p.m. |
OK |
Scala |
TESTS |
65 |
592 |
34713600 |
|
2000 |
remove filters
Back to search problems