Task: | Queue |
Sender: | rip |
Submission time: | 2017-09-05 17:22:00 +0300 |
Language: | C++ |
Status: | READY |
Result: | WRONG ANSWER |
test | verdict | time | |
---|---|---|---|
#1 | ACCEPTED | 0.03 s | details |
#2 | ACCEPTED | 0.03 s | details |
#3 | ACCEPTED | 0.04 s | details |
#4 | ACCEPTED | 0.04 s | details |
#5 | ACCEPTED | 0.04 s | details |
#6 | ACCEPTED | 0.04 s | details |
#7 | ACCEPTED | 0.05 s | details |
#8 | ACCEPTED | 0.04 s | details |
#9 | ACCEPTED | 0.03 s | details |
#10 | ACCEPTED | 0.04 s | details |
#11 | ACCEPTED | 0.03 s | details |
#12 | WRONG ANSWER | 0.04 s | details |
#13 | ACCEPTED | 0.03 s | details |
#14 | ACCEPTED | 0.03 s | details |
#15 | ACCEPTED | 0.04 s | details |
#16 | WRONG ANSWER | 0.03 s | details |
#17 | WRONG ANSWER | 0.04 s | details |
#18 | WRONG ANSWER | 0.04 s | details |
#19 | ACCEPTED | 0.05 s | details |
#20 | ACCEPTED | 0.05 s | details |
#21 | WRONG ANSWER | 0.04 s | details |
#22 | WRONG ANSWER | 0.04 s | details |
#23 | WRONG ANSWER | 0.05 s | details |
#24 | WRONG ANSWER | 0.04 s | details |
#25 | WRONG ANSWER | 0.04 s | details |
#26 | WRONG ANSWER | 0.05 s | details |
#27 | WRONG ANSWER | 0.04 s | details |
#28 | WRONG ANSWER | 0.03 s | details |
#29 | WRONG ANSWER | 0.03 s | details |
#30 | WRONG ANSWER | 0.05 s | details |
#31 | WRONG ANSWER | 0.04 s | details |
#32 | ACCEPTED | 0.04 s | details |
#33 | ACCEPTED | 0.04 s | details |
#34 | ACCEPTED | 0.04 s | details |
#35 | ACCEPTED | 0.04 s | details |
#36 | WRONG ANSWER | 0.04 s | details |
#37 | WRONG ANSWER | 0.03 s | details |
#38 | WRONG ANSWER | 0.04 s | details |
#39 | WRONG ANSWER | 0.04 s | details |
#40 | WRONG ANSWER | 0.04 s | details |
#41 | WRONG ANSWER | 0.05 s | details |
#42 | WRONG ANSWER | 0.05 s | details |
#43 | WRONG ANSWER | 0.04 s | details |
#44 | WRONG ANSWER | 0.05 s | details |
#45 | WRONG ANSWER | 0.07 s | details |
#46 | WRONG ANSWER | 0.04 s | details |
#47 | WRONG ANSWER | 0.04 s | details |
#48 | WRONG ANSWER | 0.06 s | details |
#49 | WRONG ANSWER | 0.06 s | details |
#50 | WRONG ANSWER | 0.05 s | details |
#51 | WRONG ANSWER | 0.05 s | details |
#52 | WRONG ANSWER | 0.04 s | details |
#53 | WRONG ANSWER | 0.05 s | details |
#54 | WRONG ANSWER | 0.06 s | details |
#55 | WRONG ANSWER | 0.05 s | details |
#56 | WRONG ANSWER | 0.05 s | details |
#57 | WRONG ANSWER | 0.04 s | details |
#58 | WRONG ANSWER | 0.06 s | details |
#59 | WRONG ANSWER | 0.07 s | details |
#60 | WRONG ANSWER | 0.06 s | details |
Code
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define F first #define S second #define N 101010 int t[N]; pair<int,int> c[N]; int main(){ ios::sync_with_stdio(0); cin.tie(0); int n, m, k; cin >> n >> m >> k; for(int i=1; i<=n; ++i){ int a; cin >> a; --a; c[a].F = max(c[a].F, i); --c[a].S; } sort(c, c+m); int d = 0, V = 0; for(int i=0; i<m; ++i){ int a = -c[i].S; V = max(V, c[i].F); if(d+a <= k) d+= a; if(n-d <= k) break; } if(d > k || n-d > k) cout << "-1"; else cout << V*d+(n-d)*n; }
Test details
Test 1
Verdict: ACCEPTED
input |
---|
4 3 2 1 1 1 1 |
correct output |
---|
-1 |
user output |
---|
-1 |
Test 2
Verdict: ACCEPTED
input |
---|
6 6 5 2 1 2 2 2 1 |
correct output |
---|
32 |
user output |
---|
32 |
Test 3
Verdict: ACCEPTED
input |
---|
3 2 3 1 1 1 |
correct output |
---|
9 |
user output |
---|
9 |
Test 4
Verdict: ACCEPTED
input |
---|
3 1 3 1 1 1 |
correct output |
---|
9 |
user output |
---|
9 |
Test 5
Verdict: ACCEPTED
input |
---|
2 2 2 1 2 |
correct output |
---|
3 |
user output |
---|
3 |
Test 6
Verdict: ACCEPTED
input |
---|
10 9 5 1 1 1 1 2 9 9 9 9 9 |
correct output |
---|
75 |
user output |
---|
75 |
Test 7
Verdict: ACCEPTED
input |
---|
8 2 7 1 1 1 1 1 2 2 2 |
correct output |
---|
49 |
user output |
---|
49 |
Test 8
Verdict: ACCEPTED
input |
---|
10 6 7 1 1 1 1 1 1 6 6 6 6 |
correct output |
---|
76 |
user output |
---|
76 |
Test 9
Verdict: ACCEPTED
input |
---|
6 3 4 3 3 3 3 2 3 |
correct output |
---|
-1 |
user output |
---|
-1 |
Test 10
Verdict: ACCEPTED
input |
---|
3 3 2 1 1 1 |
correct output |
---|
-1 |
user output |
---|
-1 |
Test 11
Verdict: ACCEPTED
input |
---|
43893 9 34336 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ... |
correct output |
---|
1498448497 |
user output |
---|
1498448497 |
Test 12
Verdict: WRONG ANSWER
input |
---|
17481 8 11137 3 2 5 2 6 1 8 6 1 6 1 7 5 1 1 ... |
correct output |
---|
305552418 |
user output |
---|
305555569 |
Test 13
Verdict: ACCEPTED
input |
---|
28826 9 20049 1 1 3 1 1 3 1 2 1 1 2 1 2 1 1 ... |
correct output |
---|
830887525 |
user output |
---|
830887525 |
Test 14
Verdict: ACCEPTED
input |
---|
39533 8 27095 1 1 1 1 1 1 1 1 1 1 1 1 2 1 1 ... |
correct output |
---|
-1 |
user output |
---|
-1 |
Test 15
Verdict: ACCEPTED
input |
---|
71270 6 53774 4 4 1 2 6 1 1 6 4 3 1 2 5 5 5 ... |
correct output |
---|
-1 |
user output |
---|
-1 |
Test 16
Verdict: WRONG ANSWER
input |
---|
41203 8 24337 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ... |
correct output |
---|
1320922405 |
user output |
---|
1337286925 |
Test 17
Verdict: WRONG ANSWER
input |
---|
47138 7 40668 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ... |
correct output |
---|
1671316774 |
user output |
---|
1673427244 |
Test 18
Verdict: WRONG ANSWER
input |
---|
7651 7 4893 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ... |
correct output |
---|
43907177 |
user output |
---|
43911003 |
Test 19
Verdict: ACCEPTED
input |
---|
34482 4 23135 4 1 2 2 2 3 3 2 2 1 1 3 4 1 1 ... |
correct output |
---|
1188973626 |
user output |
---|
1188973626 |
Test 20
Verdict: ACCEPTED
input |
---|
55403 4 28518 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ... |
correct output |
---|
-1 |
user output |
---|
-1 |
Test 21
Verdict: WRONG ANSWER
input |
---|
32814 412 28236 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ... |
correct output |
---|
963667791 |
user output |
---|
997090908 |
Test 22
Verdict: WRONG ANSWER
input |
---|
26243 357 18652 181 4 163 158 15 132 2 75 127 ... |
correct output |
---|
685896169 |
user output |
---|
685939897 |
Test 23
Verdict: WRONG ANSWER
input |
---|
41483 1432 33362 25 33 220 218 134 4 129 165 26... |
correct output |
---|
1712939621 |
user output |
---|
1712980879 |
Test 24
Verdict: WRONG ANSWER
input |
---|
47007 1501 42152 108 21 18 106 68 67 18 39 46 2... |
correct output |
---|
2206183867 |
user output |
---|
-2088218721 |
Test 25
Verdict: WRONG ANSWER
input |
---|
83160 244 71321 173 221 90 62 126 105 108 183 ... |
correct output |
---|
6908701076 |
user output |
---|
-1681046568 |
Test 26
Verdict: WRONG ANSWER
input |
---|
75458 761 55759 6 4 8 4 9 32 15 42 21 4 9 7 6 ... |
correct output |
---|
4361407820 |
user output |
---|
645919428 |
Test 27
Verdict: WRONG ANSWER
input |
---|
35163 867 24205 1 1 4 4 1 2 2 1 1 1 1 1 1 2 6 ... |
correct output |
---|
927749839 |
user output |
---|
984668167 |
Test 28
Verdict: WRONG ANSWER
input |
---|
20899 1205 20082 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ... |
correct output |
---|
327576151 |
user output |
---|
424214179 |
Test 29
Verdict: WRONG ANSWER
input |
---|
52868 1263 34676 874 8 846 137 306 1005 349 632... |
correct output |
---|
2770414204 |
user output |
---|
-1524342708 |
Test 30
Verdict: WRONG ANSWER
input |
---|
6634 1439 6197 1 1 1 1 1 1 1 1 1 1 1 1 1 1 12... |
correct output |
---|
38501796 |
user output |
---|
41772652 |
Test 31
Verdict: WRONG ANSWER
input |
---|
984 524 694 1 1 1 1 1 1 103 447 47 46 302 ... |
correct output |
---|
826296 |
user output |
---|
839052 |
Test 32
Verdict: ACCEPTED
input |
---|
351 263 185 17 123 178 84 19 41 70 70 174 ... |
correct output |
---|
107763 |
user output |
---|
107763 |
Test 33
Verdict: ACCEPTED
input |
---|
2607 363 1692 105 111 52 81 33 41 82 88 43 7... |
correct output |
---|
6677793 |
user output |
---|
6677793 |
Test 34
Verdict: ACCEPTED
input |
---|
1896 65 1326 1 11 4 1 2 2 4 4 1 1 5 3 1 3 2... |
correct output |
---|
3589614 |
user output |
---|
3589614 |
Test 35
Verdict: ACCEPTED
input |
---|
1435 19 770 2 6 11 2 18 19 19 12 17 12 12 ... |
correct output |
---|
-1 |
user output |
---|
-1 |
Test 36
Verdict: WRONG ANSWER
input |
---|
2014 961 1228 18 41 4 6 31 8 9 6 47 55 1 9 4... |
correct output |
---|
3052817 |
user output |
---|
3219106 |
Test 37
Verdict: WRONG ANSWER
input |
---|
2510 863 1932 1 9 1 1 3 3 1 1 2 1 2 6 6 1 2 ... |
correct output |
---|
4725076 |
user output |
---|
5514105 |
Test 38
Verdict: WRONG ANSWER
input |
---|
2279 800 2005 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ... |
correct output |
---|
3895381 |
user output |
---|
3898822 |
Test 39
Verdict: WRONG ANSWER
input |
---|
3044 1282 2850 231 1226 166 709 882 1231 1041... |
correct output |
---|
8304793 |
user output |
---|
8850970 |
Test 40
Verdict: WRONG ANSWER
input |
---|
1560 1559 1482 1 1 1 1 579 629 68 256 1543 10... |
correct output |
---|
2036808 |
user output |
---|
2322763 |
Test 41
Verdict: WRONG ANSWER
input |
---|
100000 2000 78605 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ... |
correct output |
---|
8957965216 |
user output |
---|
491320112 |
Test 42
Verdict: WRONG ANSWER
input |
---|
100000 2000 94147 325 343 6 1583 1423 143 710 43... |
correct output |
---|
9938031990 |
user output |
---|
1375855507 |
Test 43
Verdict: WRONG ANSWER
input |
---|
100000 2000 65865 458 353 288 679 148 706 164 58... |
correct output |
---|
9972374542 |
user output |
---|
1382806826 |
Test 44
Verdict: WRONG ANSWER
input |
---|
100000 2000 53937 106 33 37 110 24 8 10 25 171 7... |
correct output |
---|
9993018364 |
user output |
---|
1403083772 |
Test 45
Verdict: WRONG ANSWER
input |
---|
100000 2000 89553 529 222 626 1397 1697 910 1394... |
correct output |
---|
9764828240 |
user output |
---|
1174893648 |
Test 46
Verdict: WRONG ANSWER
input |
---|
100000 2000 83767 25 17 88 123 18 34 4 111 1 7 1... |
correct output |
---|
7631468065 |
user output |
---|
569462372 |
Test 47
Verdict: WRONG ANSWER
input |
---|
100000 2000 86917 3 7 1 1 6 1 11 2 2 1 9 2 10 1 ... |
correct output |
---|
7504708607 |
user output |
---|
708095948 |
Test 48
Verdict: WRONG ANSWER
input |
---|
100000 2000 93483 1 1 1 1 1 1 1 1 1 1 1 2 1 1 1 ... |
correct output |
---|
7500000000 |
user output |
---|
936545568 |
Test 49
Verdict: WRONG ANSWER
input |
---|
100000 2000 54022 491 448 31 519 1204 1123 1050 ... |
correct output |
---|
9926723265 |
user output |
---|
1336795200 |
Test 50
Verdict: WRONG ANSWER
input |
---|
100000 2000 76351 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ... |
correct output |
---|
8965046209 |
user output |
---|
457653563 |
Test 51
Verdict: WRONG ANSWER
input |
---|
100000 2000 88758 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ... |
correct output |
---|
8953639248 |
user output |
---|
757342183 |
Test 52
Verdict: WRONG ANSWER
input |
---|
100000 2000 76483 813 438 96 1605 334 27 1280 76... |
correct output |
---|
9940504263 |
user output |
---|
1352196368 |
Test 53
Verdict: WRONG ANSWER
input |
---|
100000 2000 66902 8 663 43 227 365 376 315 61 49... |
correct output |
---|
9972854726 |
user output |
---|
1382981858 |
Test 54
Verdict: WRONG ANSWER
input |
---|
100000 2000 78996 126 6 55 50 171 68 98 53 164 1... |
correct output |
---|
9990578620 |
user output |
---|
1400815678 |
Test 55
Verdict: WRONG ANSWER
input |
---|
100000 2000 57456 552 543 1137 875 1129 1105 116... |
correct output |
---|
9995460868 |
user output |
---|
1405526276 |
Test 56
Verdict: WRONG ANSWER
input |
---|
100000 2000 94581 66 8 30 11 5 10 20 28 7 1 207 ... |
correct output |
---|
7623200605 |
user output |
---|
1130100224 |
Test 57
Verdict: WRONG ANSWER
input |
---|
100000 2000 99344 2 2 15 10 1 3 15 4 1 3 3 8 2 1... |
correct output |
---|
7503153298 |
user output |
---|
1372063964 |
Test 58
Verdict: WRONG ANSWER
input |
---|
100000 2000 52595 1 1 1 1 1 1 1 1 1 1 1 2 1 1 2 ... |
correct output |
---|
7500000009 |
user output |
---|
-1030354336 |
Test 59
Verdict: WRONG ANSWER
input |
---|
100000 2000 90834 478 937 1119 766 1425 368 1620... |
correct output |
---|
9924835834 |
user output |
---|
1366054233 |
Test 60
Verdict: WRONG ANSWER
input |
---|
100000 2000 94089 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ... |
correct output |
---|
8950028575 |
user output |
---|
1002446005 |