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"As you might remember from our previous rounds, Vova really likes computer games. Now he is playing a strategy game known as Rage of Empires. In the game Vova can hire n different warriors; ith warrior has the type ai. Vova wants to create a balanced army hiring some subset of warriors. An army is called balanced if for each type of warrior present in the game there are not more than k warriors of this type in the army. Of course, Vova wants his army to be as large as possible. To make things more complicated, Vova has to consider q different plans of creating his army. ith plan allows him to hire only warriors whose numbers are not less than li and not greater than ri. Help Vova to determine the largest size of a balanced army for each plan. Be aware that the plans are given in a modified way. See input section for details. The first line contains two integers n and k (1 xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89n, xe2 x80 x89k xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89100000). The second line contains n integers a1, a2, ... an (1 xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89ai xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89100000). The third line contains one integer q (1 xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89q xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89100000). Then q lines follow. ith line contains two numbers xi and yi which represent ith plan (1 xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89xi, xe2 x80 x89yi xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89n). You have to keep track of the answer to the last plan (let's call it last). In the beginning last xe2 x80 x89= xe2 x80 x890. Then to restore values of li and ri for the ith plan, you have to do the following: Print q numbers. ith number must be equal to the maximum size of a balanced army when considering ith plan. In the first example the real plans are: "... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
27747315 |
fluffyowl |
E |
June 13, 2017, 2:15 a.m. |
OK |
D |
TESTS |
34 |
967 |
53452800 |
|
2300 |
35970955 |
slavik228 |
E |
March 5, 2018, 3:51 p.m. |
OK |
FPC |
TESTS |
34 |
404 |
33075200 |
|
2300 |
35970919 |
slavik228 |
E |
March 5, 2018, 3:50 p.m. |
OK |
FPC |
TESTS |
34 |
405 |
33075200 |
|
2300 |
35970894 |
slavik228 |
E |
March 5, 2018, 3:50 p.m. |
OK |
FPC |
TESTS |
34 |
405 |
33075200 |
|
2300 |
35970966 |
slavik228 |
E |
March 5, 2018, 3:51 p.m. |
OK |
FPC |
TESTS |
34 |
421 |
33075200 |
|
2300 |
35970936 |
slavik228 |
E |
March 5, 2018, 3:51 p.m. |
OK |
FPC |
TESTS |
34 |
421 |
33075200 |
|
2300 |
35970914 |
slavik228 |
E |
March 5, 2018, 3:50 p.m. |
OK |
FPC |
TESTS |
34 |
436 |
33075200 |
|
2300 |
35969932 |
slavik228 |
E |
March 5, 2018, 3:11 p.m. |
OK |
FPC |
TESTS |
34 |
577 |
135987200 |
|
2300 |
30306941 |
imone |
E |
Sept. 13, 2017, 12:35 p.m. |
OK |
GNU C++ |
TESTS |
34 |
109 |
26316800 |
|
2300 |
28714572 |
tick |
E |
July 20, 2017, 6:42 a.m. |
OK |
GNU C++ |
TESTS |
34 |
109 |
34918400 |
|
2300 |
27616102 |
AkaneSasu |
E |
June 6, 2017, 2:28 p.m. |
OK |
GNU C++ |
TESTS |
34 |
109 |
39526400 |
|
2300 |
27596808 |
crowworks695 |
E |
June 5, 2017, 5:19 p.m. |
OK |
GNU C++ |
TESTS |
34 |
109 |
122880000 |
|
2300 |
27684232 |
Talon_F |
E |
June 9, 2017, 7:21 a.m. |
OK |
GNU C++ |
TESTS |
34 |
124 |
31027200 |
|
2300 |
36891150 |
GuessYCB |
E |
April 3, 2018, 1:32 a.m. |
OK |
GNU C++ |
TESTS |
34 |
124 |
42393600 |
|
2300 |
40980799 |
ReaLNero1 |
E |
July 30, 2018, 5:42 p.m. |
OK |
GNU C++ |
TESTS |
34 |
124 |
122880000 |
|
2300 |
36869689 |
luogu_bot2 |
E |
April 2, 2018, 6:29 a.m. |
OK |
GNU C++ |
TESTS |
34 |
139 |
66355200 |
|
2300 |
36202145 |
luogu_bot2 |
E |
March 11, 2018, 1:59 p.m. |
OK |
GNU C++ |
TESTS |
34 |
140 |
28774400 |
|
2300 |
28210142 |
zqh_wz |
E |
July 2, 2017, 12:27 p.m. |
OK |
GNU C++ |
TESTS |
34 |
140 |
29593600 |
|
2300 |
47796163 |
rainboy |
E |
Dec. 31, 2018, 5:10 p.m. |
OK |
GNU C11 |
TESTS |
34 |
499 |
44851200 |
|
2300 |
69215963 |
Rachel_in |
E |
Jan. 21, 2020, 12:38 a.m. |
OK |
GNU C++11 |
TESTS |
34 |
93 |
33587200 |
|
2300 |
69215988 |
luogu_bot1 |
E |
Jan. 21, 2020, 12:40 a.m. |
OK |
GNU C++11 |
TESTS |
34 |
93 |
33587200 |
|
2300 |
51278477 |
vjudge3 |
E |
March 14, 2019, 12:47 a.m. |
OK |
GNU C++11 |
TESTS |
34 |
109 |
27545600 |
|
2300 |
50302676 |
nianheng |
E |
Feb. 22, 2019, 3:41 a.m. |
OK |
GNU C++11 |
TESTS |
34 |
109 |
41574400 |
|
2300 |
50302679 |
luogu_bot3 |
E |
Feb. 22, 2019, 3:42 a.m. |
OK |
GNU C++11 |
TESTS |
34 |
109 |
41574400 |
|
2300 |
52134690 |
yyyz04 |
E |
April 1, 2019, 1:04 a.m. |
OK |
GNU C++11 |
TESTS |
34 |
124 |
27955200 |
|
2300 |
37894143 |
RNS_MHB |
E |
May 5, 2018, 1:55 a.m. |
OK |
GNU C++11 |
TESTS |
34 |
124 |
28774400 |
|
2300 |
37894165 |
RNS_MHB |
E |
May 5, 2018, 1:57 a.m. |
OK |
GNU C++11 |
TESTS |
34 |
124 |
28774400 |
|
2300 |
51278467 |
vjudge2 |
E |
March 14, 2019, 12:46 a.m. |
OK |
GNU C++11 |
TESTS |
34 |
124 |
39526400 |
|
2300 |
63723865 |
hs-black |
E |
Oct. 29, 2019, 12:08 p.m. |
OK |
GNU C++11 |
TESTS |
34 |
124 |
42188800 |
|
2300 |
53435659 |
risujiroh |
E |
April 27, 2019, 7:01 p.m. |
OK |
GNU C++14 |
TESTS |
34 |
124 |
4505600 |
|
2300 |
27684075 |
hamayanhamayan |
E |
June 9, 2017, 7:11 a.m. |
OK |
GNU C++14 |
TESTS |
34 |
124 |
17920000 |
|
2300 |
34004044 |
Marco_L_T |
E |
Jan. 8, 2018, 1:04 p.m. |
OK |
GNU C++14 |
TESTS |
34 |
124 |
45158400 |
|
2300 |
51555666 |
Amorphophallus |
E |
March 20, 2019, 4:42 a.m. |
OK |
GNU C++14 |
TESTS |
34 |
155 |
43827200 |
|
2300 |
31452686 |
ivan100sic |
E |
Oct. 17, 2017, 2:45 p.m. |
OK |
GNU C++14 |
TESTS |
34 |
171 |
11366400 |
|
2300 |
27690717 |
jasonvictoryan |
E |
June 9, 2017, 2:11 p.m. |
OK |
GNU C++14 |
TESTS |
34 |
171 |
27340800 |
|
2300 |
34355848 |
Rezwan.Arefin01 |
E |
Jan. 20, 2018, 2:29 p.m. |
OK |
GNU C++14 |
TESTS |
34 |
171 |
29593600 |
|
2300 |
27707217 |
la1la1la |
E |
June 10, 2017, 1:35 p.m. |
OK |
GNU C++14 |
TESTS |
34 |
171 |
30003200 |
|
2300 |
60709677 |
vjudge2 |
E |
Sept. 17, 2019, 7:32 a.m. |
OK |
GNU C++14 |
TESTS |
34 |
171 |
34508800 |
|
2300 |
27602008 |
Bassel |
E |
June 5, 2017, 11:40 p.m. |
OK |
GNU C++14 |
TESTS |
34 |
186 |
20070400 |
|
2300 |
60721329 |
vjudge5 |
E |
Sept. 17, 2019, 12:28 p.m. |
OK |
GNU C++17 |
TESTS |
34 |
156 |
51814400 |
|
2300 |
49469914 |
markotee |
E |
Feb. 4, 2019, 4:41 p.m. |
OK |
GNU C++17 |
TESTS |
34 |
171 |
8294400 |
|
2300 |
59550463 |
Asagami |
E |
Aug. 27, 2019, 2:30 a.m. |
OK |
GNU C++17 |
TESTS |
34 |
171 |
27750400 |
|
2300 |
63216723 |
luogu_bot3 |
E |
Oct. 23, 2019, 6:21 a.m. |
OK |
GNU C++17 |
TESTS |
34 |
171 |
40140800 |
|
2300 |
63299349 |
AlexPanda |
E |
Oct. 24, 2019, 1:51 p.m. |
OK |
GNU C++17 |
TESTS |
34 |
171 |
63795200 |
|
2300 |
64877520 |
A_root_A |
E |
Nov. 14, 2019, 10:26 a.m. |
OK |
GNU C++17 |
TESTS |
34 |
171 |
157798400 |
|
2300 |
57201108 |
Top_xiao |
E |
July 17, 2019, 1:45 p.m. |
OK |
GNU C++17 |
TESTS |
34 |
186 |
51404800 |
|
2300 |
51667096 |
vjudge3 |
E |
March 22, 2019, 6:34 a.m. |
OK |
GNU C++17 |
TESTS |
34 |
187 |
24883200 |
|
2300 |
52672112 |
HIT_Attacker |
E |
April 13, 2019, 8 a.m. |
OK |
GNU C++17 |
TESTS |
34 |
187 |
29184000 |
|
2300 |
51564725 |
tiandong123 |
E |
March 20, 2019, 9:17 a.m. |
OK |
GNU C++17 |
TESTS |
34 |
187 |
46182400 |
|
2300 |
65736129 |
synapse |
E |
Nov. 26, 2019, 7:53 a.m. |
OK |
Go |
TESTS |
34 |
655 |
86425600 |
|
2300 |
27609923 |
U_Square |
E |
June 6, 2017, 9:40 a.m. |
OK |
Java 8 |
TESTS |
34 |
358 |
15564800 |
|
2300 |
29631573 |
JialinOuyang |
E |
Aug. 20, 2017, 10:43 p.m. |
OK |
Java 8 |
TESTS |
34 |
358 |
33280000 |
|
2300 |
27722499 |
Imaginary |
E |
June 11, 2017, 2:30 p.m. |
OK |
Java 8 |
TESTS |
34 |
374 |
12288000 |
|
2300 |
61935769 |
ZeyadKhattab |
E |
Oct. 5, 2019, 5:41 p.m. |
OK |
Java 8 |
TESTS |
34 |
420 |
14848000 |
|
2300 |
27595538 |
MazzForces |
E |
June 5, 2017, 4:50 p.m. |
OK |
Java 8 |
TESTS |
34 |
421 |
26112000 |
|
2300 |
67144911 |
Taran_1407 |
E |
Dec. 18, 2019, 8:25 a.m. |
OK |
Java 8 |
TESTS |
34 |
436 |
155136000 |
|
2300 |
27601078 |
uwi |
E |
June 5, 2017, 9:42 p.m. |
OK |
Java 8 |
TESTS |
34 |
499 |
50483200 |
|
2300 |
42992456 |
IDzekh |
E |
Sept. 17, 2018, 11 a.m. |
OK |
Java 8 |
TESTS |
34 |
514 |
18534400 |
|
2300 |
27591719 |
pitfall |
E |
June 5, 2017, 4:02 p.m. |
OK |
Java 8 |
TESTS |
34 |
545 |
14848000 |
|
2300 |
27960333 |
Sagar_Savaliya |
E |
June 22, 2017, 8:23 a.m. |
OK |
Java 8 |
TESTS |
34 |
624 |
58675200 |
|
2300 |
27905186 |
leign |
E |
June 19, 2017, 1:06 p.m. |
OK |
Mono C# |
TESTS |
34 |
670 |
59289600 |
|
2300 |
29201257 |
leign |
E |
Aug. 4, 2017, 6:08 p.m. |
OK |
Mono C# |
TESTS |
34 |
685 |
68608000 |
|
2300 |
55518681 |
cen |
E |
June 13, 2019, 7:07 a.m. |
OK |
Mono C# |
TESTS |
34 |
873 |
58675200 |
|
2300 |
28369553 |
kawazaki |
E |
July 8, 2017, 12:58 p.m. |
OK |
MS C# |
TESTS |
34 |
826 |
47513600 |
|
2300 |
53091780 |
vjudge5 |
E |
April 21, 2019, 11:34 a.m. |
OK |
MS C++ |
TESTS |
34 |
170 |
40652800 |
|
2300 |
51279893 |
vjudge2 |
E |
March 14, 2019, 2:41 a.m. |
OK |
MS C++ |
TESTS |
34 |
202 |
43110400 |
|
2300 |
67261577 |
vjudge5 |
E |
Dec. 20, 2019, 3:50 a.m. |
OK |
MS C++ |
TESTS |
34 |
655 |
170598400 |
|
2300 |
27605678 |
azim__ |
E |
June 6, 2017, 5:32 a.m. |
OK |
MS C++ |
TESTS |
34 |
716 |
22220800 |
|
2300 |
32086053 |
pschuprikov |
E |
Nov. 6, 2017, 1:30 a.m. |
OK |
Rust |
TESTS |
34 |
982 |
23244800 |
|
2300 |
remove filters
Back to search problems