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"It's Christmas time! PolandBall and his friends will be giving themselves gifts. There are n Balls overall. Each Ball has someone for whom he should bring a present according to some permutation p, pi xe2 x80 x89 xe2 x89 xa0 xe2 x80 x89i for all i. Unfortunately, Balls are quite clumsy. We know earlier that exactly k of them will forget to bring their gift. A Ball number i will get his present if the following two constraints will hold: What is minimum and maximum possible number of kids who will not get their present if exactly k Balls will forget theirs? The first line of input contains two integers n and k (2 xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89n xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89106, 0 xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89k xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89n), representing the number of Balls and the number of Balls who will forget to bring their presents. The second line contains the permutation p of integers from 1 to n, where pi is the index of Ball who should get a gift from the i-th Ball. For all i, pi xe2 x80 x89 xe2 x89 xa0 xe2 x80 x89i holds. You should output two values -- minimum and maximum possible number of Balls who will not get their presents, in that order. In the first sample, if the third and the first balls will forget to bring their presents, they will be th only balls not getting a present. Thus the minimum answer is 2. However, if the first ans the second balls will forget to bring their presents, then only the fifth ball will get a present. So, the maximum answer is 4. "... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
24452199 |
b0bble |
F |
Feb. 5, 2017, 1:30 p.m. |
OK |
FPC |
TESTS |
145 |
249 |
14643200 |
|
2600 |
24451356 |
b0bble |
F |
Feb. 5, 2017, 12:38 p.m. |
OK |
FPC |
TESTS |
145 |
249 |
14643200 |
|
2600 |
24489997 |
b0bble |
F |
Feb. 7, 2017, 2:29 p.m. |
OK |
FPC |
TESTS |
145 |
265 |
14643200 |
|
2600 |
24452788 |
b0bble |
F |
Feb. 5, 2017, 2 p.m. |
OK |
FPC |
TESTS |
145 |
265 |
14643200 |
|
2600 |
24432166 |
b0bble |
F |
Feb. 4, 2017, 12:40 p.m. |
OK |
FPC |
TESTS |
145 |
265 |
14643200 |
|
2600 |
24414020 |
b0bble |
F |
Feb. 3, 2017, 3:21 p.m. |
OK |
FPC |
TESTS |
145 |
265 |
17715200 |
|
2600 |
40114047 |
rainboy |
F |
July 9, 2018, 1:31 p.m. |
OK |
GNU C |
TESTS |
145 |
218 |
10035200 |
|
2600 |
40096530 |
rainboy |
F |
July 8, 2018, 11:35 p.m. |
OK |
GNU C |
TESTS |
145 |
608 |
18124800 |
|
2600 |
27197313 |
zhan8855 |
F |
May 18, 2017, 1:16 p.m. |
OK |
GNU C++ |
TESTS |
145 |
93 |
29900800 |
|
2600 |
28729846 |
Izanagi |
F |
July 20, 2017, 4:46 p.m. |
OK |
GNU C++ |
TESTS |
145 |
155 |
31948800 |
|
2600 |
41551899 |
Hacheylight |
F |
Aug. 13, 2018, 8:49 a.m. |
OK |
GNU C++ |
TESTS |
145 |
156 |
9216000 |
|
2600 |
41551898 |
vjudge4 |
F |
Aug. 13, 2018, 8:49 a.m. |
OK |
GNU C++ |
TESTS |
145 |
156 |
9216000 |
|
2600 |
30772680 |
yhy |
F |
Sept. 27, 2017, 9:25 a.m. |
OK |
GNU C++ |
TESTS |
145 |
186 |
23347200 |
|
2600 |
23864300 |
pparys |
F |
Jan. 15, 2017, 6:55 p.m. |
OK |
GNU C++ |
TESTS |
145 |
202 |
10240000 |
|
2600 |
27176895 |
jiyutian |
F |
May 17, 2017, 10:18 a.m. |
OK |
GNU C++ |
TESTS |
145 |
202 |
12185600 |
|
2600 |
23881207 |
CuSO45H2O |
F |
Jan. 16, 2017, 12:13 p.m. |
OK |
GNU C++ |
TESTS |
145 |
218 |
15462400 |
|
2600 |
23865084 |
KrK |
F |
Jan. 15, 2017, 7:02 p.m. |
OK |
GNU C++ |
TESTS |
145 |
218 |
18534400 |
|
2600 |
41557184 |
Siyuan |
F |
Aug. 13, 2018, 12:03 p.m. |
OK |
GNU C++ |
TESTS |
145 |
233 |
17203200 |
|
2600 |
40982770 |
ReaLNero1 |
F |
July 30, 2018, 6:34 p.m. |
OK |
GNU C++11 |
TESTS |
145 |
93 |
11059200 |
|
2600 |
23860207 |
FatalEagle |
F |
Jan. 15, 2017, 6:14 p.m. |
OK |
GNU C++11 |
TESTS |
145 |
108 |
13107200 |
|
2600 |
23859165 |
eddy1021 |
F |
Jan. 15, 2017, 6:05 p.m. |
OK |
GNU C++11 |
TESTS |
145 |
109 |
19456000 |
|
2600 |
23864999 |
Heisenbug |
F |
Jan. 15, 2017, 7:01 p.m. |
OK |
GNU C++11 |
TESTS |
145 |
124 |
9318400 |
|
2600 |
23985661 |
Al.Cash |
F |
Jan. 20, 2017, 10:09 a.m. |
OK |
GNU C++11 |
TESTS |
145 |
140 |
12390400 |
|
2600 |
30858207 |
Amayoneko |
F |
Sept. 30, 2017, 7:45 a.m. |
OK |
GNU C++11 |
TESTS |
145 |
140 |
16179200 |
|
2600 |
57168557 |
Fugtemypt |
F |
July 17, 2019, 1:31 a.m. |
OK |
GNU C++11 |
TESTS |
145 |
155 |
13414400 |
|
2600 |
23864329 |
KADR |
F |
Jan. 15, 2017, 6:56 p.m. |
OK |
GNU C++11 |
TESTS |
145 |
156 |
10752000 |
|
2600 |
24280352 |
FizzyDavid |
F |
Jan. 31, 2017, 1:36 a.m. |
OK |
GNU C++11 |
TESTS |
145 |
156 |
11264000 |
|
2600 |
64541826 |
Jackpei |
F |
Nov. 8, 2019, 7 p.m. |
OK |
GNU C++11 |
TESTS |
145 |
156 |
16384000 |
|
2600 |
23867602 |
Egor.Lifar |
F |
Jan. 15, 2017, 8:07 p.m. |
OK |
GNU C++14 |
TESTS |
145 |
108 |
23347200 |
|
2600 |
23987338 |
Al.Cash |
F |
Jan. 20, 2017, 11:42 a.m. |
OK |
GNU C++14 |
TESTS |
145 |
109 |
11161600 |
|
2600 |
23986624 |
Al.Cash |
F |
Jan. 20, 2017, 11:03 a.m. |
OK |
GNU C++14 |
TESTS |
145 |
109 |
11161600 |
|
2600 |
24328917 |
MrDindows |
F |
Jan. 31, 2017, 10:42 p.m. |
OK |
GNU C++14 |
TESTS |
145 |
109 |
14336000 |
|
2600 |
24328800 |
MrDindows |
F |
Jan. 31, 2017, 10:33 p.m. |
OK |
GNU C++14 |
TESTS |
145 |
109 |
14336000 |
|
2600 |
23878182 |
YakutovDmitriy |
F |
Jan. 16, 2017, 9:18 a.m. |
OK |
GNU C++14 |
TESTS |
145 |
109 |
35430400 |
|
2600 |
24329451 |
MrDindows |
F |
Jan. 31, 2017, 11:27 p.m. |
OK |
GNU C++14 |
TESTS |
145 |
124 |
10240000 |
|
2600 |
24355262 |
MrDindows |
F |
Feb. 1, 2017, 9:37 p.m. |
OK |
GNU C++14 |
TESTS |
145 |
124 |
11161600 |
|
2600 |
24329377 |
MrDindows |
F |
Jan. 31, 2017, 11:21 p.m. |
OK |
GNU C++14 |
TESTS |
145 |
124 |
14131200 |
|
2600 |
24355154 |
MrDindows |
F |
Feb. 1, 2017, 9:26 p.m. |
OK |
GNU C++14 |
TESTS |
145 |
124 |
14336000 |
|
2600 |
69231313 |
aryanv |
F |
Jan. 21, 2020, 9:36 a.m. |
OK |
GNU C++17 |
TESTS |
145 |
327 |
9420800 |
|
2600 |
66595900 |
animeFORever |
F |
Dec. 10, 2019, 2:40 p.m. |
OK |
GNU C++17 |
TESTS |
145 |
327 |
21401600 |
|
2600 |
45547308 |
despair |
F |
Nov. 11, 2018, 3:23 a.m. |
OK |
GNU C++17 |
TESTS |
145 |
342 |
8601600 |
|
2600 |
45444171 |
Shayan.P |
F |
Nov. 8, 2018, 12:34 p.m. |
OK |
GNU C++17 |
TESTS |
145 |
342 |
9625600 |
|
2600 |
65164096 |
Bohun |
F |
Nov. 16, 2019, 12:35 p.m. |
OK |
GNU C++17 |
TESTS |
145 |
342 |
12390400 |
|
2600 |
49168595 |
AliShahali1382 |
F |
Jan. 29, 2019, 5:19 p.m. |
OK |
GNU C++17 |
TESTS |
145 |
343 |
12800000 |
|
2600 |
68451669 |
kostia244 |
F |
Jan. 9, 2020, 2:34 p.m. |
OK |
GNU C++17 |
TESTS |
145 |
343 |
21196800 |
|
2600 |
46690752 |
UoA_ZQC |
F |
Dec. 6, 2018, 4:25 p.m. |
OK |
GNU C++17 |
TESTS |
145 |
358 |
9216000 |
|
2600 |
68451380 |
kostia244 |
F |
Jan. 9, 2020, 2:28 p.m. |
OK |
GNU C++17 |
TESTS |
145 |
358 |
21196800 |
|
2600 |
58285474 |
Rzepa |
F |
Aug. 4, 2019, 5:15 p.m. |
OK |
GNU C++17 |
TESTS |
145 |
373 |
5529600 |
|
2600 |
24100708 |
akshay_miterani |
F |
Jan. 24, 2017, 9:41 p.m. |
OK |
Java 8 |
TESTS |
145 |
264 |
26726400 |
|
2600 |
23860029 |
Egor |
F |
Jan. 15, 2017, 6:13 p.m. |
OK |
Java 8 |
TESTS |
145 |
265 |
24576000 |
|
2600 |
23901850 |
noopers |
F |
Jan. 17, 2017, 12:36 p.m. |
OK |
Java 8 |
TESTS |
145 |
296 |
26419200 |
|
2600 |
23932733 |
IgorKoval |
F |
Jan. 18, 2017, 11:09 p.m. |
OK |
Java 8 |
TESTS |
145 |
311 |
26419200 |
|
2600 |
24066106 |
JialinOuyang |
F |
Jan. 23, 2017, 8:07 a.m. |
OK |
Java 8 |
TESTS |
145 |
311 |
26931200 |
|
2600 |
31235301 |
happybelly |
F |
Oct. 12, 2017, 8:15 a.m. |
OK |
Java 8 |
TESTS |
145 |
327 |
2355200 |
|
2600 |
31234973 |
happybelly |
F |
Oct. 12, 2017, 7:53 a.m. |
OK |
Java 8 |
TESTS |
145 |
327 |
2355200 |
|
2600 |
31234712 |
happybelly |
F |
Oct. 12, 2017, 7:38 a.m. |
OK |
Java 8 |
TESTS |
145 |
327 |
2355200 |
|
2600 |
31234585 |
happybelly |
F |
Oct. 12, 2017, 7:31 a.m. |
OK |
Java 8 |
TESTS |
145 |
327 |
2457600 |
|
2600 |
31235054 |
happybelly |
F |
Oct. 12, 2017, 7:58 a.m. |
OK |
Java 8 |
TESTS |
145 |
342 |
2355200 |
|
2600 |
23868639 |
dyukha |
F |
Jan. 15, 2017, 8:56 p.m. |
OK |
Kotlin |
TESTS |
145 |
701 |
68300800 |
|
2600 |
23867410 |
og.kostya |
F |
Jan. 15, 2017, 8:02 p.m. |
OK |
MS C# |
TESTS |
145 |
171 |
24576000 |
|
2600 |
23867454 |
og.kostya |
F |
Jan. 15, 2017, 8:03 p.m. |
OK |
MS C# |
TESTS |
145 |
202 |
24780800 |
|
2600 |
26969801 |
camypaper |
F |
May 9, 2017, 8:16 a.m. |
OK |
MS C# |
TESTS |
145 |
327 |
9318400 |
|
2600 |
26969913 |
camypaper |
F |
May 9, 2017, 8:25 a.m. |
OK |
MS C# |
TESTS |
145 |
358 |
9318400 |
|
2600 |
24468836 |
camypaper |
F |
Feb. 6, 2017, 1:08 p.m. |
OK |
MS C# |
TESTS |
145 |
374 |
18022400 |
|
2600 |
24467650 |
camypaper |
F |
Feb. 6, 2017, 11:50 a.m. |
OK |
MS C# |
TESTS |
145 |
389 |
18022400 |
|
2600 |
24467496 |
camypaper |
F |
Feb. 6, 2017, 11:37 a.m. |
OK |
MS C# |
TESTS |
145 |
389 |
18636800 |
|
2600 |
24467659 |
camypaper |
F |
Feb. 6, 2017, 11:51 a.m. |
OK |
MS C# |
TESTS |
145 |
405 |
18022400 |
|
2600 |
24468928 |
camypaper |
F |
Feb. 6, 2017, 1:14 p.m. |
OK |
MS C# |
TESTS |
145 |
405 |
18124800 |
|
2600 |
24467619 |
camypaper |
F |
Feb. 6, 2017, 11:48 a.m. |
OK |
MS C# |
TESTS |
145 |
452 |
18022400 |
|
2600 |
23864204 |
amethyst0 |
F |
Jan. 15, 2017, 6:55 p.m. |
OK |
MS C++ |
TESTS |
145 |
311 |
15769600 |
|
2600 |
23869384 |
Auster |
F |
Jan. 15, 2017, 9:55 p.m. |
OK |
MS C++ |
TESTS |
145 |
390 |
15462400 |
|
2600 |
23877357 |
Filyan |
F |
Jan. 16, 2017, 8:33 a.m. |
OK |
MS C++ |
TESTS |
145 |
592 |
18432000 |
|
2600 |
23976647 |
Milanin |
F |
Jan. 20, 2017, 1:01 a.m. |
OK |
MS C++ |
TESTS |
145 |
1263 |
14848000 |
|
2600 |
remove filters
Back to search problems