QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#767204 | #6339. Cookies | KiharaTouma | 6 | 2ms | 4216kb | C++23 | 1.8kb | 2024-11-20 20:10:33 | 2024-11-20 20:10:41 |
answer
//qoj6339
#include <bits/stdc++.h>
using namespace std;
const int N = 15010;
int n, m, a[N], b[N], c[N], pr[N], cnt[N], mx;
int f[N], fr[N];
pair<int, int> aa[N];
int main(){
scanf("%d", &n);
for(int i = 1; i <= n; ++ i){
scanf("%d", &a[i]);
mx = max(mx, a[i]);
aa[i] = make_pair(a[i], i);
for(int j = 1; j <= a[i]; ++ j){
++ c[j];
}
}
int tp = 0;
for(int i = 1; i <= mx; ++ i){
for(int j = 1; j <= c[i]; ++ j){
pr[++tp] = i;
cnt[tp] = j;
}
}
scanf("%d", &m);
for(int i = 1; i <= m; ++ i){
scanf("%d", &b[i]);
}
sort(aa + 1, aa + n + 1);
reverse(aa + 1, aa + n + 1);
sort(b + 1, b + m + 1);
reverse(b + 1, b + m + 1);
memset(f, 0x3f, sizeof(f));
f[0] = 0;
cnt[0] = 1e9;
for(int i = 1; i <= tp; ++ i){
for(int j = 1; j <= m; ++ j){
if(i >= b[j]){
if(pr[i] == pr[i-b[j]+1]){
f[i] = min(f[i], f[i-b[j]] + 1);
if(f[i] == f[i-b[j]] + 1){
fr[i] = i - b[j];
}
} else if(pr[i] == pr[i-b[j]+1] + 1 && cnt[i] < cnt[i-b[j]+1]){
f[i] = min(f[i], f[i-b[j]] + 1);
if(f[i] == f[i-b[j]] + 1){
fr[i] = i - b[j];
}
}
}
}
}
if(f[tp] > 100000){
puts("-1");
return 0;
}
printf("%d\n", f[tp]);
int x = tp;
for(int i = 1; i <= f[tp]; ++ i){
printf("%d ", x - fr[x]);
for(int j = fr[x] + 1; j <= x; ++ j){
printf("%d ", aa[cnt[j]].second);
}
puts("");
x = fr[x];
}
return 0;
}
詳細信息
Subtask #1:
score: 6
Accepted
Test #1:
score: 6
Accepted
time: 0ms
memory: 3936kb
input:
1 1 1 1
output:
1 1 1
result:
ok good!
Test #2:
score: 6
Accepted
time: 0ms
memory: 3932kb
input:
2 1 1 1 1
output:
2 1 1 1 2
result:
ok good!
Test #3:
score: 6
Accepted
time: 0ms
memory: 3928kb
input:
2 1 1 1 2
output:
1 2 2 1
result:
ok good!
Test #4:
score: 6
Accepted
time: 0ms
memory: 3860kb
input:
2 1 1 2 1 2
output:
1 2 2 1
result:
ok good!
Test #5:
score: 6
Accepted
time: 0ms
memory: 3996kb
input:
4 1 1 1 1 2 2 3
output:
2 2 2 1 2 4 3
result:
ok good!
Test #6:
score: 6
Accepted
time: 0ms
memory: 4008kb
input:
8 1 1 1 1 1 1 1 1 3 1 4 5
output:
2 4 4 3 2 1 4 8 7 6 5
result:
ok good!
Test #7:
score: 6
Accepted
time: 1ms
memory: 3920kb
input:
500 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...
output:
500 1 1 1 2 1 3 1 4 1 5 1 6 1 7 1 8 1 9 1 10 1 11 1 12 1 13 1 14 1 15 1 16 1 17 1 18 1 19 1 20 1 21 1 22 1 23 1 24 1 25 1 26 1 27 1 28 1 29 1 30 1 31 1 32 1 33 1 34 1 35 1 36 1 37 1 38 1 39 1 40 1 41 1 42 1 43 1 44 1 45 1 46 1 47 1 48 1 49 1 50 1 51 ...
result:
ok good!
Test #8:
score: 6
Accepted
time: 0ms
memory: 3920kb
input:
500 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...
output:
1 500 500 499 498 497 496 495 494 493 492 491 490 489 488 487 486 485 484 483 482 481 480 479 478 477 476 475 474 473 472 471 470 469 468 467 466 465 464 463 462 461 460 459 458 457 456 455 454 453 452 451 450 449 448 447 446 445 444 443 442 441 440 439 438 437 436 435 434 433 432 431 430 429 428 42...
result:
ok good!
Test #9:
score: 6
Accepted
time: 1ms
memory: 4048kb
input:
500 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...
output:
2 1 1 499 500 499 498 497 496 495 494 493 492 491 490 489 488 487 486 485 484 483 482 481 480 479 478 477 476 475 474 473 472 471 470 469 468 467 466 465 464 463 462 461 460 459 458 457 456 455 454 453 452 451 450 449 448 447 446 445 444 443 442 441 440 439 438 437 436 435 434 433 432 431 430 429 4...
result:
ok good!
Test #10:
score: 6
Accepted
time: 1ms
memory: 3788kb
input:
500 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...
output:
-1
result:
ok no solution
Test #11:
score: 6
Accepted
time: 1ms
memory: 3992kb
input:
500 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...
output:
11 40 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 46 86 85 84 83 82 81 80 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 46 132 131 130 129 128 127 126 125 124 1...
result:
ok good!
Test #12:
score: 6
Accepted
time: 1ms
memory: 3980kb
input:
500 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...
output:
250 2 2 1 2 4 3 2 6 5 2 8 7 2 10 9 2 12 11 2 14 13 2 16 15 2 18 17 2 20 19 2 22 21 2 24 23 2 26 25 2 28 27 2 30 29 2 32 31 2 34 33 2 36 35 2 38 37 2 40 39 2 42 41 2 44 43 2 46 45 2 48 47 2 50 49 2 52 51 2 54 53 2 56 55 2 58 57 2 60 59 2 62 61 2 64 63 2 66 65 2 68 67 ...
result:
ok good!
Test #13:
score: 6
Accepted
time: 1ms
memory: 4044kb
input:
484 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...
output:
22 22 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 22 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 22 88 87 86 85 84 83 82 81 80 79 78 77 76 75 74 73 72 71 70 69 68 67 22 110 109 108 107 106 105...
result:
ok good!
Test #14:
score: 6
Accepted
time: 1ms
memory: 3864kb
input:
495 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...
output:
55 9 9 8 7 6 5 4 3 2 1 9 18 17 16 15 14 13 12 11 10 9 27 26 25 24 23 22 21 20 19 9 36 35 34 33 32 31 30 29 28 9 45 44 43 42 41 40 39 38 37 9 54 53 52 51 50 49 48 47 46 9 63 62 61 60 59 58 57 56 55 9 72 71 70 69 68 67 66 65 64 9 81 80 79 78 77 76 75 74 73 9 90 89 88 87 86 85 84 83 82 9 99 9...
result:
ok good!
Test #15:
score: 6
Accepted
time: 1ms
memory: 4044kb
input:
500 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...
output:
4 125 125 124 123 122 121 120 119 118 117 116 115 114 113 112 111 110 109 108 107 106 105 104 103 102 101 100 99 98 97 96 95 94 93 92 91 90 89 88 87 86 85 84 83 82 81 80 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 3...
result:
ok good!
Test #16:
score: 6
Accepted
time: 0ms
memory: 4000kb
input:
499 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...
output:
27 5 5 4 3 2 1 5 10 9 8 7 6 5 15 14 13 12 11 5 20 19 18 17 16 17 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 21 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 21 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64 63 62 61 60 59 21 100 99 98 97 96 95 94 93 92 91 90 89 88 87...
result:
ok good!
Test #17:
score: 6
Accepted
time: 0ms
memory: 3940kb
input:
499 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...
output:
19 13 13 12 11 10 9 8 7 6 5 4 3 2 1 27 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 27 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 27 94 93 92 91 90 89 88 87 86 85 84 83 82 81 80 79 78 77 76 75 74 73 72 71 70 69 68 27 121 1...
result:
ok good!
Test #18:
score: 6
Accepted
time: 0ms
memory: 3980kb
input:
499 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...
output:
7 18 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 64 82 81 80 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 65 147 146 145 144 143 142 141 140 139 138 137 136 13...
result:
ok good!
Test #19:
score: 6
Accepted
time: 0ms
memory: 3984kb
input:
499 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...
output:
4 56 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 56 112 111 110 109 108 107 106 105 104 103 102 101 100 99 98 97 96 95 94 93 92 91 90 89 88 87 86 85 84 83 82 81 80 79 78 77 76 75 74 73...
result:
ok good!
Test #20:
score: 6
Accepted
time: 0ms
memory: 3916kb
input:
499 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...
output:
2 11 11 10 9 8 7 6 5 4 3 2 1 488 499 498 497 496 495 494 493 492 491 490 489 488 487 486 485 484 483 482 481 480 479 478 477 476 475 474 473 472 471 470 469 468 467 466 465 464 463 462 461 460 459 458 457 456 455 454 453 452 451 450 449 448 447 446 445 444 443 442 441 440 439 438 437 436 435 434 43...
result:
ok good!
Test #21:
score: 6
Accepted
time: 1ms
memory: 3724kb
input:
499 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...
output:
-1
result:
ok no solution
Test #22:
score: 6
Accepted
time: 0ms
memory: 3928kb
input:
499 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...
output:
-1
result:
ok no solution
Test #23:
score: 6
Accepted
time: 1ms
memory: 4040kb
input:
493 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...
output:
17 1 1 1 2 1 3 1 4 1 5 1 6 1 7 1 8 1 9 1 10 1 11 1 12 1 13 1 14 1 15 1 16 477 493 492 491 490 489 488 487 486 485 484 483 482 481 480 479 478 477 476 475 474 473 472 471 470 469 468 467 466 465 464 463 462 461 460 459 458 457 456 455 454 453 452 451 450 449 448 447 446 445 444 443 44...
result:
ok good!
Test #24:
score: 6
Accepted
time: 1ms
memory: 3996kb
input:
493 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...
output:
17 1 1 1 2 1 3 1 4 1 5 1 6 1 7 1 8 1 9 1 10 1 11 1 12 1 13 1 14 1 15 1 16 477 493 492 491 490 489 488 487 486 485 484 483 482 481 480 479 478 477 476 475 474 473 472 471 470 469 468 467 466 465 464 463 462 461 460 459 458 457 456 455 454 453 452 451 450 449 448 447 446 445 444 443 44...
result:
ok good!
Test #25:
score: 6
Accepted
time: 1ms
memory: 3860kb
input:
493 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...
output:
17 16 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 16 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 16 64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 16 80 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 16 96 95 94 93 92 91 90 89 88 87 86 85 84 83 8...
result:
ok good!
Test #26:
score: 6
Accepted
time: 1ms
memory: 3832kb
input:
493 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...
output:
17 16 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 16 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 16 64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 16 80 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 16 96 95 94 93 92 91 90 89 88 87 86 85 84 83 8...
result:
ok good!
Test #27:
score: 6
Accepted
time: 1ms
memory: 4048kb
input:
493 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...
output:
17 16 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 16 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 16 64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 16 80 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 16 96 95 94 93 92 91 90 89 88 87 86 85 84 83 8...
result:
ok good!
Subtask #2:
score: 0
Wrong Answer
Test #28:
score: 7
Accepted
time: 0ms
memory: 3936kb
input:
1 15 1 1
output:
15 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
result:
ok good!
Test #29:
score: 7
Accepted
time: 0ms
memory: 4016kb
input:
1 500 1 1
output:
500 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1...
result:
ok good!
Test #30:
score: 7
Accepted
time: 0ms
memory: 4048kb
input:
1 3000 1 1
output:
3000 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...
result:
ok good!
Test #31:
score: 7
Accepted
time: 2ms
memory: 4216kb
input:
1 15000 1 1
output:
15000 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...
result:
ok good!
Test #32:
score: 7
Accepted
time: 0ms
memory: 4040kb
input:
2 2 1 1 1
output:
3 1 1 1 2 1 1
result:
ok good!
Test #33:
score: 7
Accepted
time: 0ms
memory: 3772kb
input:
2 1 2 1 2
output:
-1
result:
ok no solution
Test #34:
score: 7
Accepted
time: 0ms
memory: 3980kb
input:
3 1 2 3 1 2
output:
3 2 2 3 2 1 3 2 3 2
result:
ok good!
Test #35:
score: 7
Accepted
time: 0ms
memory: 3916kb
input:
3 3 2 1 1 3
output:
-1
result:
ok no solution
Test #36:
score: 7
Accepted
time: 0ms
memory: 3992kb
input:
3 2 2 2 1 2
output:
3 2 2 1 2 1 3 2 3 2
result:
ok good!
Test #37:
score: 0
Wrong Answer
time: 0ms
memory: 3732kb
input:
15 50 49 48 47 46 45 44 43 42 41 40 2 1 1 1 1 10
output:
-1
result:
wrong answer you didn't find a solution but jury did
Subtask #3:
score: 0
Wrong Answer
Test #45:
score: 12
Accepted
time: 0ms
memory: 3992kb
input:
2 7 8 2 1 2
output:
8 1 2 2 2 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2 1
result:
ok good!
Test #46:
score: 12
Accepted
time: 0ms
memory: 3896kb
input:
3 5 4 6 2 2 3
output:
6 2 1 3 2 2 3 2 3 1 3 3 1 2 3 3 1 2 3 3 1 2
result:
ok good!
Test #47:
score: 12
Accepted
time: 0ms
memory: 4008kb
input:
3 4 2 9 3 1 2 3
output:
9 1 3 1 3 1 3 1 3 1 3 2 3 1 2 3 1 3 3 1 2 3 3 1 2
result:
ok good!
Test #48:
score: 0
Wrong Answer
time: 0ms
memory: 3728kb
input:
4 3 5 4 3 2 3 4
output:
-1
result:
wrong answer you didn't find a solution but jury did
Subtask #4:
score: 0
Skipped
Dependency #1:
100%
Accepted
Dependency #3:
0%
Subtask #5:
score: 0
Skipped
Dependency #4:
0%
Subtask #6:
score: 0
Skipped
Dependency #1:
100%
Accepted
Dependency #2:
0%