Task: | Gift |
Sender: | Yytsi |
Submission time: | 2019-02-15 14:57:59 +0200 |
Language: | C++ |
Status: | READY |
Result: | 0 |
group | verdict | score |
---|---|---|
#1 | WRONG ANSWER | 0 |
#2 | WRONG ANSWER | 0 |
#3 | WRONG ANSWER | 0 |
#4 | RUNTIME ERROR | 0 |
#5 | WRONG ANSWER | 0 |
test | verdict | time | group | |
---|---|---|---|---|
#1 | WRONG ANSWER | 0.04 s | 1, 2, 3, 5 | details |
#2 | WRONG ANSWER | 0.04 s | 1, 2, 3, 5 | details |
#3 | ACCEPTED | 0.05 s | 1, 2, 3, 5 | details |
#4 | WRONG ANSWER | 0.04 s | 1, 2, 3, 5 | details |
#5 | ACCEPTED | 0.04 s | 1, 2, 3, 5 | details |
#6 | ACCEPTED | 0.05 s | 1, 2, 3, 5 | details |
#7 | WRONG ANSWER | 0.03 s | 1, 2, 3, 5 | details |
#8 | ACCEPTED | 0.04 s | 2, 3, 5 | details |
#9 | WRONG ANSWER | 0.05 s | 2, 3, 5 | details |
#10 | WRONG ANSWER | 0.04 s | 2, 3, 5 | details |
#11 | WRONG ANSWER | 0.10 s | 2, 3, 5 | details |
#12 | WRONG ANSWER | 0.10 s | 2, 3, 5 | details |
#13 | WRONG ANSWER | 0.06 s | 2, 3, 5 | details |
#14 | WRONG ANSWER | 0.07 s | 2, 3, 5 | details |
#15 | WRONG ANSWER | 0.08 s | 2, 3, 5 | details |
#16 | WRONG ANSWER | 0.06 s | 2, 3, 5 | details |
#17 | WRONG ANSWER | 0.07 s | 3, 5 | details |
#18 | WRONG ANSWER | 0.05 s | 3, 5 | details |
#19 | WRONG ANSWER | 0.06 s | 3, 5 | details |
#20 | WRONG ANSWER | 0.07 s | 3, 5 | details |
#21 | WRONG ANSWER | 0.06 s | 3, 5 | details |
#22 | WRONG ANSWER | 0.06 s | 3, 5 | details |
#23 | RUNTIME ERROR | 1.99 s | 4, 5 | details |
#24 | TIME LIMIT EXCEEDED | -- | 4, 5 | details |
#25 | TIME LIMIT EXCEEDED | -- | 4, 5 | details |
#26 | TIME LIMIT EXCEEDED | -- | 4, 5 | details |
#27 | TIME LIMIT EXCEEDED | -- | 4, 5 | details |
#28 | TIME LIMIT EXCEEDED | -- | 4, 5 | details |
#29 | TIME LIMIT EXCEEDED | -- | 4, 5 | details |
#30 | TIME LIMIT EXCEEDED | -- | 4, 5 | details |
#31 | TIME LIMIT EXCEEDED | -- | 4, 5 | details |
#32 | TIME LIMIT EXCEEDED | -- | 4, 5 | details |
#33 | TIME LIMIT EXCEEDED | -- | 4, 5 | details |
#34 | RUNTIME ERROR | 0.56 s | 5 | details |
#35 | RUNTIME ERROR | 0.56 s | 5 | details |
#36 | RUNTIME ERROR | 0.39 s | 5 | details |
#37 | RUNTIME ERROR | 0.28 s | 4, 5 | details |
#38 | RUNTIME ERROR | 1.71 s | 5 | details |
#39 | RUNTIME ERROR | 1.71 s | 5 | details |
#40 | RUNTIME ERROR | 0.66 s | 5 | details |
#41 | TIME LIMIT EXCEEDED | -- | 5 | details |
#42 | TIME LIMIT EXCEEDED | -- | 5 | details |
#43 | TIME LIMIT EXCEEDED | -- | 5 | details |
#44 | RUNTIME ERROR | 1.69 s | 5 | details |
#45 | RUNTIME ERROR | 1.68 s | 5 | details |
#46 | RUNTIME ERROR | 1.89 s | 5 | details |
#47 | TIME LIMIT EXCEEDED | -- | 5 | details |
#48 | TIME LIMIT EXCEEDED | -- | 5 | details |
#49 | TIME LIMIT EXCEEDED | -- | 5 | details |
#50 | TIME LIMIT EXCEEDED | -- | 5 | details |
#51 | TIME LIMIT EXCEEDED | -- | 5 | details |
#52 | TIME LIMIT EXCEEDED | -- | 5 | details |
#53 | TIME LIMIT EXCEEDED | -- | 5 | details |
#54 | TIME LIMIT EXCEEDED | -- | 5 | details |
#55 | TIME LIMIT EXCEEDED | -- | 5 | details |
#56 | TIME LIMIT EXCEEDED | -- | 5 | details |
Compiler report
input/code.cpp: In function 'int main()': input/code.cpp:31:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] if (s.size() < k) qaq(); ~~~~~~~~~^~~
Code
#include <bits/stdc++.h> using namespace std; #define FOR(i, a, b) for (int i=a; i<(b); i++) #define IO ios_base::sync_with_stdio(0); cin.tie(0) #define F first #define S second #define pb push_back typedef long long ll; typedef pair<int, int> pii; typedef pair<ll, ll> pll; #define N 1010101 int n, k; set<pll> s; vector<int> idx[N]; void qaq() { cout<<"-1\n"; exit(0); } int main() { IO; cin>>n>>k; FOR(i,1,n+1) { ll x; cin>>x; s.insert({x, i}); } int cur_oper = 0; // Greedy -> take 1 out of k largest. while (!s.empty()) { if (s.size() < k) qaq(); cur_oper++; vector<pll> taken; FOR(i,0,k) { pll big = *s.rbegin(); idx[cur_oper].pb(big.S); s.erase(big); big.F--; taken.pb(big); } for (pll v : taken) { if (v.F) s.insert(v); } } FOR(i,1,cur_oper+1) { cout<<"1 "; for (int v : idx[i]) cout<<v<<" "; cout<<"\n"; } }
Test details
Test 1
Group: 1, 2, 3, 5
Verdict: WRONG ANSWER
input |
---|
4 2
2 3 3 2 |
correct output |
---|
3
2 3 1 1 3 2 2 2 4 |
user output |
---|
1 3 2 1 4 3 1 2 1 1 4 3 1 2 1 |
Test 2
Group: 1, 2, 3, 5
Verdict: WRONG ANSWER
input |
---|
3 2
2 1 1 |
correct output |
---|
2
1 1 2 1 1 3 |
user output |
---|
1 1 3 1 2 1 |
Test 3
Group: 1, 2, 3, 5
Verdict: ACCEPTED
input |
---|
3 2
1 2 4 |
correct output |
---|
-1 |
user output |
---|
-1 |
Test 4
Group: 1, 2, 3, 5
Verdict: WRONG ANSWER
input |
---|
4 2
1 2 3 4 |
correct output |
---|
3
1 1 3 2 2 4 2 3 4 |
user output |
---|
1 4 3 1 4 3 1 4 2 1 4 3 1 2 1 |
Test 5
Group: 1, 2, 3, 5
Verdict: ACCEPTED
input |
---|
4 2
1 2 1 5 |
correct output |
---|
-1 |
user output |
---|
-1 |
Test 6
Group: 1, 2, 3, 5
Verdict: ACCEPTED
input |
---|
2 2
4 5 |
correct output |
---|
-1 |
user output |
---|
-1 |
Test 7
Group: 1, 2, 3, 5
Verdict: WRONG ANSWER
input |
---|
5 2
2 1 3 1 1 |
correct output |
---|
3
2 1 3 1 2 4 1 3 5 |
user output |
---|
1 3 1 1 3 5 1 4 3 1 2 1 |
Test 8
Group: 2, 3, 5
Verdict: ACCEPTED
input |
---|
8 2
1 1 9101 17 161 57013 7 567 |
correct output |
---|
-1 |
user output |
---|
-1 |
Test 9
Group: 2, 3, 5
Verdict: WRONG ANSWER
input |
---|
14 2
36 117 358 64 1319 1355 5322 5... |
correct output |
---|
14
36 1 12 117 2 12 358 3 12 64 4 12 ... |
user output |
---|
1 13 12 1 13 12 1 13 12 1 13 12 1 13 12 ... Truncated |
Test 10
Group: 2, 3, 5
Verdict: WRONG ANSWER
input |
---|
11 2
1 7192 2 49 3973 1 1 68 5274 6... |
correct output |
---|
11
1 1 5 2586 2 5 1 2 6 1 2 7 ... |
user output |
---|
1 2 9 1 2 9 1 2 9 1 2 9 1 2 9 ... Truncated |
Test 11
Group: 2, 3, 5
Verdict: WRONG ANSWER
input |
---|
50000 2
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ... |
correct output |
---|
42250
1 1 33212 1 2 33212 1 3 33212 1 4 33212 ... |
user output |
---|
1 33212 41667 1 33212 41667 1 33212 41667 1 33212 41667 1 33212 41667 ... Truncated |
Test 12
Group: 2, 3, 5
Verdict: WRONG ANSWER
input |
---|
50000 2
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ... |
correct output |
---|
40020
1 1 27450 1 2 27450 1 3 27450 1 4 27450 ... |
user output |
---|
1 35035 5675 1 35035 5675 1 35035 5675 1 35035 5675 1 35035 5675 ... Truncated |
Test 13
Group: 2, 3, 5
Verdict: WRONG ANSWER
input |
---|
10 2
2730 1860 241 33771 20985 1391... |
correct output |
---|
10
2730 1 5 1860 2 5 241 3 5 4756 4 5 ... |
user output |
---|
1 4 10 1 4 10 1 4 10 1 4 10 1 4 10 ... Truncated |
Test 14
Group: 2, 3, 5
Verdict: WRONG ANSWER
input |
---|
685 2
118 132 114 115 123 136 122 10... |
correct output |
---|
683
21 1 340 97 1 341 36 2 341 96 2 342 ... |
user output |
---|
1 123 513 1 123 513 1 384 123 1 513 384 1 123 513 ... Truncated |
Test 15
Group: 2, 3, 5
Verdict: WRONG ANSWER
input |
---|
623 2
150 137 159 157 138 153 137 14... |
correct output |
---|
622
77 1 312 73 1 313 72 2 313 65 2 314 ... |
user output |
---|
1 582 398 1 582 30 1 582 398 1 582 30 1 582 426 ... Truncated |
Test 16
Group: 2, 3, 5
Verdict: WRONG ANSWER
input |
---|
973 2
58 52 54 57 52 71 46 58 64 45 ... |
correct output |
---|
963
48 1 490 10 1 491 44 2 491 8 2 492 ... |
user output |
---|
1 892 304 1 892 304 1 892 849 1 304 892 1 849 304 ... Truncated |
Test 17
Group: 3, 5
Verdict: WRONG ANSWER
input |
---|
989 3
102 100 91 75 103 79 85 83 98 ... |
correct output |
---|
982
10 1 328 659 33 1 329 659 59 1 329 660 4 2 329 660 ... |
user output |
---|
1 316 170 855 1 431 316 170 1 855 814 431 1 316 170 855 1 814 431 316 ... Truncated |
Test 18
Group: 3, 5
Verdict: WRONG ANSWER
input |
---|
563 8
91 104 85 106 99 84 94 118 94 ... |
correct output |
---|
547
21 1 71 143 213 283 355 425 49... |
user output |
---|
1 257 523 473 263 8 533 285 47... Truncated |
Test 19
Group: 3, 5
Verdict: WRONG ANSWER
input |
---|
592 23
161 178 166 168 144 152 152 16... |
correct output |
---|
547
6 1 26 52 78 104 130 156 182 2... |
user output |
---|
1 94 396 426 200 543 498 475 4... Truncated |
Test 20
Group: 3, 5
Verdict: WRONG ANSWER
input |
---|
938 15
102 104 89 123 105 111 90 98 9... |
correct output |
---|
871
5 1 62 125 188 251 313 377 439... |
user output |
---|
1 931 107 217 94 684 929 4 591... Truncated |
Test 21
Group: 3, 5
Verdict: WRONG ANSWER
input |
---|
747 10
96 88 99 82 108 68 82 110 97 8... |
correct output |
---|
704
16 1 74 149 224 298 373 449 52... |
user output |
---|
1 638 172 18 537 649 313 685 8... Truncated |
Test 22
Group: 3, 5
Verdict: WRONG ANSWER
input |
---|
991 13
83 76 94 77 76 88 79 91 85 69 ... |
correct output |
---|
930
17 1 76 152 229 305 381 458 53... |
user output |
---|
1 739 37 171 940 835 429 22 12... Truncated |
Test 23
Group: 4, 5
Verdict: RUNTIME ERROR
input |
---|
1000000 2
1000000000000 1000000000000 10... |
correct output |
---|
500000
1000000000000 1 500001 1000000000000 2 500002 1000000000000 3 500003 1000000000000 4 500004 ... |
user output |
---|
(empty) |
Test 24
Group: 4, 5
Verdict: TIME LIMIT EXCEEDED
input |
---|
666666 3
1500001500001 1500001500001 15... |
correct output |
---|
222222
1500001500001 1 222223 444445 ... |
user output |
---|
(empty) |
Test 25
Group: 4, 5
Verdict: TIME LIMIT EXCEEDED
input |
---|
400000 5
2500000000000 2500000000000 25... |
correct output |
---|
80000
2500000000000 1 80001 160001 2... |
user output |
---|
(empty) |
Test 26
Group: 4, 5
Verdict: TIME LIMIT EXCEEDED
input |
---|
285714 7
3500003500000 3500003500000 35... |
correct output |
---|
285714
500000500000 1 40817 81633 122... |
user output |
---|
(empty) |
Test 27
Group: 4, 5
Verdict: TIME LIMIT EXCEEDED
input |
---|
20000 100
50000000000000 50000000000000 ... |
correct output |
---|
200
50000000000000 1 201 401 601 8... |
user output |
---|
(empty) |
Test 28
Group: 4, 5
Verdict: TIME LIMIT EXCEEDED
input |
---|
181818 11
5500005500000 5500005500000 55... |
correct output |
---|
181818
500000500000 1 16529 33058 495... |
user output |
---|
(empty) |
Test 29
Group: 4, 5
Verdict: TIME LIMIT EXCEEDED
input |
---|
10000 200
100000000000000 10000000000000... |
correct output |
---|
50
100000000000000 1 51 101 151 2... |
user output |
---|
(empty) |
Test 30
Group: 4, 5
Verdict: TIME LIMIT EXCEEDED
input |
---|
6666 300
150015001500150 15001500150015... |
correct output |
---|
1111
3000300030003 1 23 45 67 89 11... |
user output |
---|
(empty) |
Test 31
Group: 4, 5
Verdict: TIME LIMIT EXCEEDED
input |
---|
4000 500
250000000000000 25000000000000... |
correct output |
---|
8
250000000000000 1 9 17 25 33 4... |
user output |
---|
(empty) |
Test 32
Group: 4, 5
Verdict: TIME LIMIT EXCEEDED
input |
---|
2857 700
350017500875000 35001750087500... |
correct output |
---|
2857
500025001250 1 5 9 13 17 21 25... |
user output |
---|
(empty) |
Test 33
Group: 4, 5
Verdict: TIME LIMIT EXCEEDED
input |
---|
2000 1000
500000000000000 50000000000000... |
correct output |
---|
2
500000000000000 1 3 5 7 9 11 1... |
user output |
---|
(empty) |
Test 34
Group: 5
Verdict: RUNTIME ERROR
input |
---|
23514 2
18103 5348 3625 12835 15660 90... |
correct output |
---|
23513
6865 1 11793 11202 1 11794 36 1 11795 5348 2 11795 ... |
user output |
---|
(empty) |
Test 35
Group: 5
Verdict: RUNTIME ERROR
input |
---|
23514 2
18292 21082 22492 20359 17760 ... |
correct output |
---|
23514
8265 1 11746 8926 1 11747 1101 1 11748 9890 2 11748 ... |
user output |
---|
(empty) |
Test 36
Group: 5
Verdict: RUNTIME ERROR
input |
---|
940 2
73 1 1 1 1 1 1 1 1 1 1 1 1 1 1... |
correct output |
---|
940
73 1 640 1 2 640 1 3 640 1 4 640 ... |
user output |
---|
(empty) |
Test 37
Group: 4, 5
Verdict: RUNTIME ERROR
input |
---|
2 2
50000000000000 50000000000000 |
correct output |
---|
1
50000000000000 1 2 |
user output |
---|
(empty) |
Test 38
Group: 5
Verdict: RUNTIME ERROR
input |
---|
100000 5
134 153 148 128 126 146 165 16... |
correct output |
---|
98678
33 1 20010 40009 59997 80000 10 1 20010 40010 59997 80000 3 1 20010 40010 59997 80001 58 1 20011 40010 59997 80001 ... |
user output |
---|
(empty) |
Test 39
Group: 5
Verdict: RUNTIME ERROR
input |
---|
100000 5
152 137 163 145 132 157 183 15... |
correct output |
---|
98711
1 1 19996 40005 60007 80009 71 1 19996 40005 60008 80009 46 1 19997 40005 60008 80009 24 1 19997 40005 60008 80010 ... |
user output |
---|
(empty) |
Test 40
Group: 5
Verdict: RUNTIME ERROR
input |
---|
10 5
1499332 1501242 1498874 150016... |
correct output |
---|
10
574 1 2 5 7 9 1498721 1 3 5 7 9 37 1 3 6 7 9 116 2 3 6 7 9 ... |
user output |
---|
(empty) |
Test 41
Group: 5
Verdict: TIME LIMIT EXCEEDED
input |
---|
100 50
1002132999440 1001266333597 10... |
correct output |
---|
100
1267999683 1 2 4 6 8 10 12 14 ... |
user output |
---|
(empty) |
Test 42
Group: 5
Verdict: TIME LIMIT EXCEEDED
input |
---|
1000 50
100346633179 101226632849 1003... |
correct output |
---|
1000
1839998687 1 20 40 60 80 100 1... |
user output |
---|
(empty) |
Test 43
Group: 5
Verdict: TIME LIMIT EXCEEDED
input |
---|
1000000 2
1 2 3 4 5 6 7 8 9 10 11 12 13 ... |
correct output |
---|
999996
1 1 707107 2 2 707107 3 3 707107 4 4 707107 ... |
user output |
---|
(empty) |
Test 44
Group: 5
Verdict: RUNTIME ERROR
input |
---|
1000000 2
999999551533 1000000473528 100... |
correct output |
---|
1000000
146192314 1 500000 999853359219 1 500001 146463134 2 500001 999854010394 2 500002 ... |
user output |
---|
(empty) |
Test 45
Group: 5
Verdict: RUNTIME ERROR
input |
---|
666666 3
1500001336447 1500001298201 15... |
correct output |
---|
666666
1499958849879 1 222223 444445 ... |
user output |
---|
(empty) |
Test 46
Group: 5
Verdict: RUNTIME ERROR
input |
---|
400000 5
2499999946636 2500000060399 25... |
correct output |
---|
400000
2499910300054 1 80001 160001 2... |
user output |
---|
(empty) |
Test 47
Group: 5
Verdict: TIME LIMIT EXCEEDED
input |
---|
2336 856
42808218598 42808218183 428082... |
correct output |
---|
2336
10257 1 3 6 9 11 14 17 20 22 2... |
user output |
---|
(empty) |
Test 48
Group: 5
Verdict: TIME LIMIT EXCEEDED
input |
---|
285714 7
3500003576920 3500003507271 35... |
correct output |
---|
285714
499997032073 1 40817 81633 122... |
user output |
---|
(empty) |
Test 49
Group: 5
Verdict: TIME LIMIT EXCEEDED
input |
---|
181818 11
5500005515540 5500005459088 55... |
correct output |
---|
181818
500002072749 1 16529 33058 495... |
user output |
---|
(empty) |
Test 50
Group: 5
Verdict: TIME LIMIT EXCEEDED
input |
---|
40000 50
25000000005730 24999999994976 ... |
correct output |
---|
40000
4690 1 800 1600 2401 3200 4001... |
user output |
---|
(empty) |
Test 51
Group: 5
Verdict: TIME LIMIT EXCEEDED
input |
---|
20000 100
50000000003586 50000000000483 ... |
correct output |
---|
19998
3844 1 201 401 600 801 1001 12... |
user output |
---|
(empty) |
Test 52
Group: 5
Verdict: TIME LIMIT EXCEEDED
input |
---|
10000 200
100000000000713 99999999996921... |
correct output |
---|
9995
84 1 51 100 151 201 250 301 35... |
user output |
---|
(empty) |
Test 53
Group: 5
Verdict: TIME LIMIT EXCEEDED
input |
---|
6666 300
150015001497695 15001500150098... |
correct output |
---|
6666
6771 1 23 45 67 89 112 134 156... |
user output |
---|
(empty) |
Test 54
Group: 5
Verdict: TIME LIMIT EXCEEDED
input |
---|
4000 500
250000000001078 24999999999820... |
correct output |
---|
3979
93 1 9 16 24 32 40 48 56 64 72... |
user output |
---|
(empty) |
Test 55
Group: 5
Verdict: TIME LIMIT EXCEEDED
input |
---|
2857 700
350017500876401 35001750087429... |
correct output |
---|
2857
500024974229 1 5 9 13 17 21 25... |
user output |
---|
(empty) |
Test 56
Group: 5
Verdict: TIME LIMIT EXCEEDED
input |
---|
2000 1000
499999999999833 50000000000035... |
correct output |
---|
1955
1 1 2 4 6 8 11 13 15 17 19 21 ... |
user output |
---|
(empty) |