QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#238327 | #5131. Grinding Gravel | Froranzen | AC ✓ | 38ms | 413732kb | C++23 | 3.0kb | 2023-11-04 16:24:38 | 2023-11-04 16:24:38 |
Judging History
answer
#include <bits/stdc++.h>
#define rep(i, f, t) for(int i(f); i <= t; ++i)
#define re(i, t) for(int i(1); i <= t; ++i)
#define per(i, t, f) for(int i(t); i >= f; --i)
#define pe(i, t) for(int i(t); i >= 1; --i)
#define nx(i, u) for(int i(head[u]); i; i = e[i].nxt)
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
// #define int long long
using namespace std;
typedef pair <int, int> pii;
#define pb push_back
#define fi first
#define se second
#define ix(l, r) ((l + r) | (l != r))
#define ls (ix(l, mid))
#define rs (ix(mid + 1, r))
#define mp(i, j) (make_pair(i, j))
#define inf 0x3f3f3f3f
#define INF 0x3f3f3f3f3f3f3f3f
#define eps 1e-10
#define look_memory cerr<<abs(&sT-&eD)/1024.0/1024<<'\n'
bool sT;
namespace IO {
char buf[1 << 21], *p1 = buf, *p2 = buf, buf1[1 << 21];
inline char gc() {
return p1 == p2 && (p2 = (p1 = buf) + fread(buf, 1, 1 << 21, stdin), p1 == p2) ? EOF : *p1++;
}
#ifndef ONLINE_JUDGE
#endif
// #define gc getchar
template<class I>
inline void read(I &x) {
x = 0;
I f = 1;
char c = gc();
while (c < '0' || c > '9') {
if (c == '-')
f = -1;
c = gc();
}
while (c >= '0' && c <= '9') {
x = x * 10 + c - '0';
c = gc();
}
x *= f;
}
template<class I>
inline void write(I x) {
if (x == 0) {
putchar('0');
return;
}
I tmp = x > 0 ? x : -x;
if (x < 0)
putchar('-');
int cnt = 0;
while (tmp > 0) {
buf1[cnt++] = tmp % 10 + '0';
tmp /= 10;
}
while (cnt > 0)
putchar(buf1[--cnt]);
}
#define in(x) read(x)
#define outn(x) write(x), putchar('\n')
#define out(x) write(x), putchar(' ')
} using namespace IO;
const int N = 105;
int n, k, m;
int a[N], b[10], lst[10];
int ans;
int f[105000005];
int solve () {
int res = 0;
re(i, n) {
res = res * (m+1) + b[i] + 1;
}
if(f[res] != inf) return f[res];
int sum = 0;
re(i, n) {
sum += (lst[i] - b[i]) * a[i];
}
sum %= k;
re(i, n) {
if(b[i]) {
--b[i];
f[res] = min(f[res], solve() + ((sum + a[i]) > k));
++b[i];
}
}
return f[res];
}
int main () {
memset(f, 0x3f, sizeof(f));
read(n), read(k);
re(i, n) {
read(a[0]);
ans += a[0] / k;
a[0] %= k;
if(a[0]) {
++b[a[0]];
}
else --ans;
}
re(i, k-1) {
if(k - i > i) {
int w = min(b[i], b[k-i]);
b[i] -= w, b[k-i] -= w;
}
else if(k - i == i) {
b[i] = b[i] & 1;
}
}
n = 0;
re(i, k-1) {
if(b[i]) {
a[++n] = i;
b[n] = b[i];
m += b[n];
}
}
int res = 0;
re(i, n) res = res * (m+1) + 1;
f[res] = 0;
re(i, n) lst[i] = b[i];
int w = solve();
ans += w;
outn(ans);
return 0;
}
详细
Test #1:
score: 100
Accepted
time: 15ms
memory: 413560kb
input:
5 8 2 4 5 6 7
output:
1
result:
ok single line: '1'
Test #2:
score: 0
Accepted
time: 20ms
memory: 413428kb
input:
2 5 12 13
output:
4
result:
ok single line: '4'
Test #3:
score: 0
Accepted
time: 24ms
memory: 413672kb
input:
1 1 1
output:
0
result:
ok single line: '0'
Test #4:
score: 0
Accepted
time: 3ms
memory: 413552kb
input:
1 8 8
output:
0
result:
ok single line: '0'
Test #5:
score: 0
Accepted
time: 8ms
memory: 413544kb
input:
4 8 7 7 7 3
output:
2
result:
ok single line: '2'
Test #6:
score: 0
Accepted
time: 19ms
memory: 413588kb
input:
7 8 7 7 7 7 7 7 6
output:
5
result:
ok single line: '5'
Test #7:
score: 0
Accepted
time: 15ms
memory: 413676kb
input:
6 8 7 7 6 6 3 3
output:
2
result:
ok single line: '2'
Test #8:
score: 0
Accepted
time: 7ms
memory: 413588kb
input:
1 1 100
output:
99
result:
ok single line: '99'
Test #9:
score: 0
Accepted
time: 12ms
memory: 413676kb
input:
2 2 99 123
output:
110
result:
ok single line: '110'
Test #10:
score: 0
Accepted
time: 16ms
memory: 413480kb
input:
3 4 1 1 2
output:
0
result:
ok single line: '0'
Test #11:
score: 0
Accepted
time: 12ms
memory: 413560kb
input:
6 7 1 6 2 5 3 4
output:
0
result:
ok single line: '0'
Test #12:
score: 0
Accepted
time: 12ms
memory: 413480kb
input:
3 6 3 9 6
output:
1
result:
ok single line: '1'
Test #13:
score: 0
Accepted
time: 19ms
memory: 413592kb
input:
6 6 5 5 5 5 5 5
output:
4
result:
ok single line: '4'
Test #14:
score: 0
Accepted
time: 8ms
memory: 413556kb
input:
12 6 5 5 5 5 5 5 5 5 5 5 5 5
output:
8
result:
ok single line: '8'
Test #15:
score: 0
Accepted
time: 11ms
memory: 413720kb
input:
4 6 11 91 53 13
output:
26
result:
ok single line: '26'
Test #16:
score: 0
Accepted
time: 23ms
memory: 413528kb
input:
2 4 2 2
output:
0
result:
ok single line: '0'
Test #17:
score: 0
Accepted
time: 4ms
memory: 413556kb
input:
2 6 3 3
output:
0
result:
ok single line: '0'
Test #18:
score: 0
Accepted
time: 20ms
memory: 413680kb
input:
2 8 4 4
output:
0
result:
ok single line: '0'
Test #19:
score: 0
Accepted
time: 11ms
memory: 413588kb
input:
2 8 3 5
output:
0
result:
ok single line: '0'
Test #20:
score: 0
Accepted
time: 8ms
memory: 413704kb
input:
2 8 2 6
output:
0
result:
ok single line: '0'
Test #21:
score: 0
Accepted
time: 7ms
memory: 413420kb
input:
2 8 1 7
output:
0
result:
ok single line: '0'
Test #22:
score: 0
Accepted
time: 4ms
memory: 413680kb
input:
2 8 8 8
output:
0
result:
ok single line: '0'
Test #23:
score: 0
Accepted
time: 8ms
memory: 413520kb
input:
2 7 3 4
output:
0
result:
ok single line: '0'
Test #24:
score: 0
Accepted
time: 3ms
memory: 413540kb
input:
2 7 2 5
output:
0
result:
ok single line: '0'
Test #25:
score: 0
Accepted
time: 3ms
memory: 413716kb
input:
2 7 1 6
output:
0
result:
ok single line: '0'
Test #26:
score: 0
Accepted
time: 16ms
memory: 413476kb
input:
2 7 7 7
output:
0
result:
ok single line: '0'
Test #27:
score: 0
Accepted
time: 7ms
memory: 413524kb
input:
6 4 3 3 3 3 2 2
output:
2
result:
ok single line: '2'
Test #28:
score: 0
Accepted
time: 27ms
memory: 413716kb
input:
7 6 5 5 5 5 4 3 3
output:
3
result:
ok single line: '3'
Test #29:
score: 0
Accepted
time: 16ms
memory: 413556kb
input:
9 6 5 5 5 5 5 5 2 2 2
output:
3
result:
ok single line: '3'
Test #30:
score: 0
Accepted
time: 8ms
memory: 413524kb
input:
12 8 7 7 7 7 7 7 7 7 2 2 2 2
output:
4
result:
ok single line: '4'
Test #31:
score: 0
Accepted
time: 0ms
memory: 413552kb
input:
11 8 7 7 7 7 7 7 7 7 4 2 2
output:
5
result:
ok single line: '5'
Test #32:
score: 0
Accepted
time: 16ms
memory: 413548kb
input:
12 8 7 7 7 7 7 7 7 7 7 3 3 3
output:
6
result:
ok single line: '6'
Test #33:
score: 0
Accepted
time: 38ms
memory: 413552kb
input:
13 8 7 7 7 7 7 7 7 7 7 3 2 2 2
output:
5
result:
ok single line: '5'
Test #34:
score: 0
Accepted
time: 21ms
memory: 413556kb
input:
22 8 3 7 7 7 7 7 3 7 7 7 7 2 7 7 7 7 2 7 7 3 7 3
output:
10
result:
ok single line: '10'
Test #35:
score: 0
Accepted
time: 12ms
memory: 413524kb
input:
23 8 2 7 2 7 2 7 7 7 7 2 7 7 7 7 7 2 7 2 7 7 7 7 4
output:
9
result:
ok single line: '9'
Test #36:
score: 0
Accepted
time: 7ms
memory: 413540kb
input:
35 8 7 4 7 2 2 2 7 7 2 7 7 2 7 2 7 7 2 7 7 7 7 7 7 2 7 2 7 7 2 7 7 7 7 7 7
output:
13
result:
ok single line: '13'
Test #37:
score: 0
Accepted
time: 15ms
memory: 413540kb
input:
34 8 7 7 2 7 7 7 4 2 7 7 7 2 7 7 4 7 7 2 2 7 7 7 7 7 7 7 7 7 2 2 2 7 7 7
output:
14
result:
ok single line: '14'
Test #38:
score: 0
Accepted
time: 23ms
memory: 413428kb
input:
2 1 7 1
output:
6
result:
ok single line: '6'
Test #39:
score: 0
Accepted
time: 27ms
memory: 413520kb
input:
5 3 9 8 9 1 3
output:
6
result:
ok single line: '6'
Test #40:
score: 0
Accepted
time: 15ms
memory: 413520kb
input:
7 8 9 7 9 4 1 1 1
output:
2
result:
ok single line: '2'
Test #41:
score: 0
Accepted
time: 20ms
memory: 413552kb
input:
10 8 7 6 9 1 9 2 9 2 3 8
output:
3
result:
ok single line: '3'
Test #42:
score: 0
Accepted
time: 11ms
memory: 413716kb
input:
8 8 7 7 7 7 7 7 7 7
output:
6
result:
ok single line: '6'
Test #43:
score: 0
Accepted
time: 3ms
memory: 413560kb
input:
24 2 514 646 507 336 663 582 44 119 14 255 477 733 868 695 689 438 436 834 755 279 835 261 45 1
output:
5496
result:
ok single line: '5496'
Test #44:
score: 0
Accepted
time: 19ms
memory: 413668kb
input:
51 6 364 684 415 206 236 516 26 553 159 909 523 179 872 497 467 57 71 92 160 576 530 331 873 396 143 869 252 353 383 465 74 292 752 447 397 440 785 56 833 620 476 15 272 624 181 897 848 10 83 256 5
output:
3394
result:
ok single line: '3394'
Test #45:
score: 0
Accepted
time: 11ms
memory: 413544kb
input:
92 2 347 813 321 822 432 867 59 210 454 727 589 145 908 258 260 393 613 221 926 412 952 548 841 431 1000 659 414 108 424 968 298 177 778 759 718 916 179 356 225 318 133 933 466 311 179 132 273 328 576 503 310 86 274 877 51 795 351 664 438 517 64 442 87 656 381 320 186 540 978 916 375 102 302 982 361...
output:
22144
result:
ok single line: '22144'
Test #46:
score: 0
Accepted
time: 7ms
memory: 413428kb
input:
100 2 331 105 883 924 945 224 148 722 773 404 804 756 686 376 638 198 484 671 468 914 970 914 596 634 63 920 539 817 71 500 71 909 770 332 9 244 542 88 851 470 719 22 617 458 559 240 158 420 109 308 995 898 770 996 103 393 148 147 689 993 80 840 686 490 126 309 970 358 233 320 103 565 679 567 798 37...
output:
23957
result:
ok single line: '23957'
Test #47:
score: 0
Accepted
time: 20ms
memory: 413536kb
input:
100 5 694943 322344 846836 825949 994558 54484 662239 389207 9277 14943 124401 985751 197760 397802 169567 864822 621922 673296 749626 994716 827790 978968 873809 683602 109800 55780 303680 858150 637396 475321 817565 925924 623876 852112 33705 245041 183564 485136 988383 455143 248185 266343 485841...
output:
10497604
result:
ok single line: '10497604'
Test #48:
score: 0
Accepted
time: 3ms
memory: 413548kb
input:
100 6 435596 446821 134399 836412 964534 995193 943569 642741 767304 805570 794333 252951 40657 106229 175570 779085 957248 865523 194905 823131 638463 677759 173867 579834 878465 216776 33282 737953 258742 240672 437265 914318 648560 232749 118472 487873 410290 683231 951215 909125 22724 460916 789...
output:
8165264
result:
ok single line: '8165264'
Test #49:
score: 0
Accepted
time: 8ms
memory: 413592kb
input:
100 7 158625 248802 217683 277847 632126 692209 970195 240134 431167 982189 101717 750386 973285 873007 189259 7288 102849 500152 542934 251100 168435 861148 5870 374679 113137 142311 841457 722087 306901 12351 790024 807149 519962 650653 406542 555654 880141 230768 99951 357709 367797 785507 361980...
output:
7096796
result:
ok single line: '7096796'
Test #50:
score: 0
Accepted
time: 11ms
memory: 413520kb
input:
100 8 315124 213896 145551 468189 777719 386335 991854 912135 312080 390897 439376 945117 110230 591971 89997 32931 622760 939742 152296 831645 482862 585683 401528 295826 610527 116113 55299 810350 696828 907235 166458 428368 587875 666540 858861 250579 406124 731389 374462 390227 553459 191227 918...
output:
5958658
result:
ok single line: '5958658'
Test #51:
score: 0
Accepted
time: 7ms
memory: 413728kb
input:
100 8 359681 814588 567161 817942 847670 382389 302368 310100 793078 153410 481082 818222 286048 672955 25105 347219 774994 472511 366743 866725 474321 111067 899516 941737 663624 176449 315944 357749 718033 90904 596027 913623 765277 187115 774014 95862 525048 431785 420871 823719 16913 228363 9616...
output:
6396049
result:
ok single line: '6396049'
Test #52:
score: 0
Accepted
time: 7ms
memory: 413548kb
input:
100 1 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 100000...
output:
98999901
result:
ok single line: '98999901'
Test #53:
score: 0
Accepted
time: 16ms
memory: 413548kb
input:
100 8 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 100000...
output:
12374901
result:
ok single line: '12374901'
Test #54:
score: 0
Accepted
time: 19ms
memory: 413672kb
input:
100 1 2 2 1 2 2 1 1 1 2 2 1 2 1 2 1 2 1 1 1 1 2 2 1 1 1 1 1 2 1 2 2 2 2 1 2 1 2 1 2 1 2 1 1 2 1 2 1 2 1 2 2 1 1 2 2 1 1 2 1 1 2 2 2 2 2 2 1 2 1 2 1 1 2 2 1 2 1 1 1 1 2 2 1 2 1 2 1 1 1 2 2 1 1 2 1 2 1 2 2 2
output:
50
result:
ok single line: '50'
Test #55:
score: 0
Accepted
time: 0ms
memory: 413528kb
input:
2 2 1 1
output:
0
result:
ok single line: '0'
Test #56:
score: 0
Accepted
time: 19ms
memory: 413552kb
input:
100 2 2 1 1 2 1 1 2 2 1 2 1 1 2 2 1 2 1 2 2 1 2 1 2 2 2 2 2 1 1 1 1 2 1 1 1 2 1 1 1 1 1 1 1 1 1 2 2 1 2 1 2 1 2 2 2 1 1 2 1 2 1 1 2 1 1 2 2 1 2 1 1 1 2 2 2 2 1 2 1 1 2 1 2 2 2 2 1 1 1 2 2 2 1 2 2 1 2 2 2 2
output:
0
result:
ok single line: '0'
Test #57:
score: 0
Accepted
time: 24ms
memory: 413564kb
input:
99 3 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 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:
0
result:
ok single line: '0'
Test #58:
score: 0
Accepted
time: 4ms
memory: 413556kb
input:
100 3 1 1 1 2 1 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 1 1 1 2 1 2 1 1 1 2 1 1 2 1 2 2 1 1 1 1 2 2 1 2 2 1 2 2 1 1 2 2 2 1 1 2 1 1 1 2 2 1 1 2 2 2 2 2 1 2 2 1 2 1 1 1 2 2 1 1 2 2 1 1 2 2 1 2 2 2 2 2 1 1 2 2 2 2 1 2
output:
0
result:
ok single line: '0'
Test #59:
score: 0
Accepted
time: 20ms
memory: 413732kb
input:
97 3 3 3 2 3 2 2 3 1 3 1 3 3 2 1 2 3 3 2 3 2 3 2 2 3 3 3 3 1 3 3 2 3 3 2 2 2 2 1 2 2 1 3 3 3 3 3 1 3 3 3 2 3 3 3 2 2 3 3 3 2 3 3 2 2 2 2 1 3 1 3 1 3 3 1 3 2 3 2 3 3 3 3 2 1 2 2 2 3 2 2 3 3 3 2 3 1 2
output:
7
result:
ok single line: '7'
Test #60:
score: 0
Accepted
time: 24ms
memory: 413524kb
input:
67 4 2 3 2 2 2 3 3 3 2 3 3 3 3 3 2 2 2 2 2 1 3 2 2 3 3 3 3 2 2 2 2 3 3 2 2 2 3 3 3 3 3 2 2 2 2 2 3 2 2 3 2 2 2 3 3 2 3 2 2 3 3 2 2 3 2 3 3
output:
15
result:
ok single line: '15'
Test #61:
score: 0
Accepted
time: 8ms
memory: 413728kb
input:
98 5 4 4 3 3 3 3 4 3 4 3 3 3 4 3 4 4 3 3 3 4 4 3 4 4 3 4 4 4 4 3 3 4 3 4 3 4 4 4 4 4 4 3 3 4 3 4 4 3 3 4 4 3 3 3 4 3 4 3 4 4 4 4 4 4 4 4 3 4 4 3 4 4 3 3 4 3 3 4 4 4 4 3 3 4 4 4 3 4 4 4 3 3 3 4 4 3 4 3
output:
42
result:
ok single line: '42'
Test #62:
score: 0
Accepted
time: 4ms
memory: 413672kb
input:
100 5 2 2 4 4 4 4 4 4 4 2 4 2 2 2 2 4 2 4 2 4 4 4 2 4 4 2 4 4 2 2 2 2 2 4 2 4 4 4 4 4 4 4 4 4 2 4 2 2 2 4 4 4 4 4 4 2 4 2 4 4 4 4 4 4 2 4 4 4 2 4 4 4 4 2 2 2 2 2 2 2 2 2 2 2 4 4 4 4 4 4 4 2 2 1 2 2 4 4 2 4
output:
31
result:
ok single line: '31'
Test #63:
score: 0
Accepted
time: 11ms
memory: 413516kb
input:
67 6 2 2 5 2 5 2 5 2 5 5 2 5 2 2 5 5 5 5 2 5 2 5 2 2 2 3 5 2 5 5 5 2 5 5 5 2 2 5 2 2 2 5 2 5 2 2 5 5 5 5 5 5 2 5 2 5 2 5 2 2 2 5 2 2 2 5 2
output:
17
result:
ok single line: '17'
Test #64:
score: 0
Accepted
time: 15ms
memory: 413680kb
input:
100 6 5 3 5 5 5 2 5 5 2 5 2 2 5 2 5 2 2 2 5 5 5 5 2 2 5 2 5 5 2 5 5 2 5 2 2 5 5 2 2 5 5 5 5 5 5 5 5 2 2 5 5 5 2 5 2 5 2 5 2 2 2 5 2 2 2 2 5 5 2 5 5 2 2 5 2 2 2 2 5 2 2 5 5 2 2 2 2 2 2 2 2 5 2 2 5 5 2 2 5 5
output:
25
result:
ok single line: '25'
Test #65:
score: 0
Accepted
time: 4ms
memory: 413596kb
input:
99 6 5 5 2 2 5 5 5 2 2 5 5 2 2 5 2 2 5 5 2 2 2 2 5 2 2 5 2 5 2 2 5 2 2 5 2 2 5 5 5 5 5 5 5 5 2 5 5 2 2 2 2 2 2 2 5 5 5 5 2 2 2 5 2 2 5 2 5 5 2 2 2 5 2 5 5 5 2 2 2 2 5 5 2 5 2 5 2 2 5 5 2 5 5 5 5 5 5 2 5
output:
25
result:
ok single line: '25'
Test #66:
score: 0
Accepted
time: 12ms
memory: 413548kb
input:
99 7 2 1 2 2 2 1 1 4 1 4 4 2 2 2 4 2 4 1 1 4 2 4 1 1 2 1 1 1 1 1 4 1 4 4 2 2 1 4 1 2 1 2 2 1 4 1 4 4 4 2 1 2 4 4 2 4 4 1 4 2 4 2 1 4 2 2 2 4 2 1 2 4 2 1 4 2 2 1 1 1 2 1 2 1 4 2 2 4 4 4 4 1 2 4 4 1 1 4 1
output:
0
result:
ok single line: '0'
Test #67:
score: 0
Accepted
time: 12ms
memory: 413524kb
input:
100 8 2 2 1 1 1 2 1 3 3 2 3 3 1 1 2 2 3 1 1 1 1 3 3 3 1 1 3 1 2 2 1 2 2 2 3 1 2 3 3 3 3 2 1 2 2 3 1 2 3 1 3 3 3 1 3 2 1 3 3 3 1 2 1 2 3 2 2 1 3 2 3 1 3 3 1 1 1 2 1 2 3 2 3 1 2 2 2 1 1 2 2 3 1 1 3 2 2 3 2 2
output:
0
result:
ok single line: '0'
Test #68:
score: 0
Accepted
time: 20ms
memory: 413420kb
input:
100 8 2 4 2 2 1 1 2 3 2 1 2 1 3 3 2 1 1 3 3 1 3 3 3 2 1 1 1 3 3 3 1 1 2 1 1 3 3 3 1 2 1 2 2 1 2 3 1 1 3 3 2 2 1 1 2 3 3 2 1 3 2 2 3 1 3 1 2 1 3 2 3 1 2 2 2 2 3 2 2 1 1 2 2 3 1 1 3 3 1 3 1 2 3 2 1 2 2 1 3 3
output:
0
result:
ok single line: '0'
Test #69:
score: 0
Accepted
time: 19ms
memory: 413524kb
input:
100 8 5 2 2 7 7 7 7 5 2 5 7 7 5 5 5 5 5 7 2 7 5 2 5 2 7 2 2 2 5 2 7 7 7 7 5 5 7 5 5 2 5 7 5 5 4 7 2 2 7 5 2 7 2 7 5 5 2 7 2 5 5 5 2 5 2 7 2 2 5 5 7 7 2 2 5 2 2 7 5 7 2 7 7 7 5 7 5 5 2 2 2 7 7 2 7 5 2 2 5 2
output:
33
result:
ok single line: '33'
Test #70:
score: 0
Accepted
time: 12ms
memory: 413680kb
input:
100 8 5 5 6 6 5 7 5 7 7 5 7 6 7 5 7 7 5 7 7 5 5 7 6 7 6 6 6 6 6 7 5 5 7 6 7 7 5 5 7 6 5 7 6 6 6 6 5 7 7 7 5 7 7 7 5 5 6 5 7 5 6 6 7 6 7 6 6 5 6 7 7 6 6 5 6 7 5 5 6 5 6 5 5 5 4 6 6 6 7 7 5 6 7 5 6 6 5 7 5 7
output:
50
result:
ok single line: '50'
Test #71:
score: 0
Accepted
time: 4ms
memory: 413680kb
input:
100 8 7 6 4 6 6 5 4 6 5 6 4 5 5 6 5 6 5 6 7 6 4 4 5 6 7 6 4 4 6 6 7 7 7 4 5 4 5 6 4 4 4 5 4 5 5 6 7 6 7 5 4 7 6 5 6 4 4 7 5 5 4 7 7 5 6 7 5 7 7 7 6 6 4 4 6 7 7 7 5 5 5 4 6 7 7 4 4 6 4 6 7 5 5 7 7 6 7 5 4 5
output:
38
result:
ok single line: '38'
Test #72:
score: 0
Accepted
time: 19ms
memory: 413716kb
input:
98 7 5 6 4 6 4 5 3 5 5 4 6 1 6 2 2 1 5 3 5 1 2 6 1 2 7 4 3 3 2 7 4 3 6 5 5 6 7 7 3 3 3 6 7 7 6 1 7 2 4 6 4 3 2 7 5 6 1 3 4 1 7 5 5 3 1 3 6 1 1 3 2 2 4 1 7 7 1 7 2 4 5 7 1 2 3 6 1 5 6 2 5 7 4 4 2 4 4 2
output:
0
result:
ok single line: '0'
Test #73:
score: 0
Accepted
time: 19ms
memory: 413480kb
input:
96 7 1 4 3 4 5 6 1 2 6 5 3 6 1 2 4 1 5 3 2 6 2 6 1 2 2 3 1 5 4 3 4 4 1 3 2 3 5 4 6 4 5 2 4 5 4 3 3 3 5 4 1 2 6 6 3 5 5 3 4 4 5 4 4 6 6 5 5 5 1 6 6 1 6 2 3 1 3 2 4 1 2 5 2 6 1 1 3 2 3 6 2 1 2 5 6 1
output:
0
result:
ok single line: '0'
Test #74:
score: 0
Accepted
time: 16ms
memory: 413672kb
input:
96 8 6 3 7 5 8 7 5 7 2 2 8 8 6 5 3 4 6 2 5 6 2 5 5 1 3 2 2 4 8 7 5 4 7 7 8 1 6 6 7 5 8 4 3 1 1 4 6 3 2 4 8 6 3 4 6 3 7 5 3 7 8 1 2 1 3 7 3 4 2 1 6 4 1 3 5 4 8 2 1 1 6 6 3 4 1 8 5 7 2 4 7 5 1 8 8 2
output:
0
result:
ok single line: '0'
Test #75:
score: 0
Accepted
time: 7ms
memory: 413560kb
input:
98 8 1 2 7 4 7 3 1 4 2 2 5 4 4 6 2 7 3 6 6 2 4 4 2 4 7 3 7 7 4 7 3 6 6 2 7 1 6 6 5 7 7 5 5 6 6 5 1 4 1 3 6 6 5 6 7 5 6 5 5 1 1 6 1 2 3 2 1 4 5 5 4 4 3 5 3 7 3 5 1 2 2 5 1 3 2 1 4 3 3 2 1 1 2 4 7 3 3 7
output:
0
result:
ok single line: '0'
Test #76:
score: 0
Accepted
time: 15ms
memory: 413484kb
input:
45 2 203077 218939 499606 381999 954236 867021 284673 299987 946338 93375 722058 692540 913027 280072 476769 105669 391113 244529 988389 234287 976791 489200 329731 302421 602767 520612 50875 947606 553397 893258 526040 901072 448928 88912 19544 906832 13730 792585 564059 975870 414827 16265 476138 ...
output:
10830800
result:
ok single line: '10830800'
Test #77:
score: 0
Accepted
time: 3ms
memory: 413728kb
input:
100 8 491 689 104 320 105 886 227 330 422 943 114 279 596 768 710 85 502 766 725 762 911 571 414 196 975 18 936 839 737 507 131 626 917 37 691 9 875 618 87 633 423 473 595 533 683 379 482 694 681 793 576 887 236 683 41 249 628 380 243 857 85 882 773 102 618 705 636 95 11 620 920 900 796 859 747 674 ...
output:
6402
result:
ok single line: '6402'
Test #78:
score: 0
Accepted
time: 11ms
memory: 413520kb
input:
100 8 424795 927635 24676 437079 300378 370521 455609 542310 473007 808299 293727 687323 329738 406474 396978 235074 245742 848275 296618 976438 592146 520304 718469 947968 514715 202039 97122 13301 381074 872851 823213 203083 346571 873390 449007 211212 218972 701724 998105 118340 70438 263244 2068...
output:
5898079
result:
ok single line: '5898079'
Test #79:
score: 0
Accepted
time: 16ms
memory: 413552kb
input:
100 7 549 541 589 389 728 568 105 157 834 153 338 492 799 582 120 181 437 885 867 859 220 974 508 822 82 314 439 255 476 181 258 938 91 214 442 493 254 830 652 593 240 395 635 330 709 840 84 661 841 807 847 285 767 685 553 553 558 280 671 615 711 46 532 709 311 901 808 594 765 616 735 498 167 811 13...
output:
6864
result:
ok single line: '6864'
Test #80:
score: 0
Accepted
time: 16ms
memory: 413676kb
input:
100 8 928926 83054 808337 589669 373745 427496 440403 183967 947373 397356 437025 577439 323732 39713 624650 122767 55201 366238 282477 668833 141069 307006 147057 630592 309339 361943 243790 944412 603211 410620 719488 997571 599793 8079 223197 600188 52737 786243 532340 55646 972850 738864 165517 ...
output:
5566373
result:
ok single line: '5566373'
Test #81:
score: 0
Accepted
time: 11ms
memory: 413476kb
input:
100 8 84178 801827 170979 644214 631863 599372 281237 77817 244344 525665 74096 818634 812501 169818 981797 716107 289738 514457 631872 616893 394296 163629 790273 8171 23850 562680 221030 80669 14093 751162 721635 434842 445613 976593 233619 205546 368581 401712 184954 188801 723318 67382 54600 543...
output:
5745556
result:
ok single line: '5745556'
Test #82:
score: 0
Accepted
time: 16ms
memory: 413564kb
input:
22 8 3 2 3 3 2 1 3 2 3 3 4 3 4 5 3 3 3 2 4 7 6 3
output:
1
result:
ok single line: '1'
Test #83:
score: 0
Accepted
time: 20ms
memory: 413524kb
input:
26 8 3 2 2 7 7 2 1 7 4 4 7 2 2 5 7 2 7 6 7 3 2 4 2 7 3 7
output:
4
result:
ok single line: '4'
Test #84:
score: 0
Accepted
time: 19ms
memory: 413676kb
input:
19 7 3 6 3 3 1 3 5 1 3 3 3 2 3 1 3 3 4 5 1
output:
1
result:
ok single line: '1'
Test #85:
score: 0
Accepted
time: 19ms
memory: 413480kb
input:
22 8 5 3 6 4 5 2 5 5 6 5 5 1 1 1 5 7 6 5 5 5 5 4
output:
4
result:
ok single line: '4'
Test #86:
score: 0
Accepted
time: 27ms
memory: 413712kb
input:
22 8 7 7 5 4 5 3 5 2 5 1 5 2 4 5 7 2 5 6 2 4 5 5
output:
5
result:
ok single line: '5'
Test #87:
score: 0
Accepted
time: 11ms
memory: 413552kb
input:
69 8 89193 314193 693155 533637 249975 785684 239959 650765 461111 197634 395388 580566 722455 889639 718803 871418 565003 583291 379962 761115 210902 877517 895768 914950 416547 783376 921408 3121 526863 894623 20664 629963 170633 592533 790866 856013 996308 526781 89114 668197 927092 883002 288143...
output:
5058574
result:
ok single line: '5058574'
Test #88:
score: 0
Accepted
time: 19ms
memory: 413592kb
input:
100 7 107522 125270 883569 313213 286365 347902 651544 741789 767001 871784 484837 926826 508748 671363 592039 572417 229359 723394 419008 30639 119297 938658 141244 936062 920558 446274 309843 163111 350644 304044 142780 884008 451791 601768 171618 431415 214050 616530 787492 64571 524849 105096 15...
output:
6643540
result:
ok single line: '6643540'
Test #89:
score: 0
Accepted
time: 27ms
memory: 413552kb
input:
100 7 104810 879882 531758 152927 53499 350035 876013 606519 626854 777305 201040 876707 956166 567960 872488 152087 390815 171390 763917 189715 799452 181367 223031 390975 333428 995305 418169 967272 902567 679050 743286 531072 173109 686495 783874 807989 731291 369490 691401 345374 533784 40095 12...
output:
7321160
result:
ok single line: '7321160'
Test #90:
score: 0
Accepted
time: 11ms
memory: 413484kb
input:
100 8 904175 220696 648215 883147 624064 915667 43026 764410 608606 382270 220621 531492 539630 653284 232241 286821 818948 363787 472259 569982 14659 703154 577927 165010 556982 523772 214715 810125 307975 113311 926375 113511 53972 966761 721358 363998 667415 797105 657091 919367 859402 7418 89433...
output:
6123952
result:
ok single line: '6123952'
Test #91:
score: 0
Accepted
time: 19ms
memory: 413484kb
input:
92 7 773 801 595 69 741 725 76 823 464 999 30 790 492 156 923 960 609 596 488 152 616 934 90 28 213 224 689 524 804 642 858 913 78 658 880 865 79 163 772 100 109 205 470 693 73 47 200 24 149 195 444 485 319 378 105 369 60 140 705 602 282 356 2 735 196 577 794 510 260 369 326 191 149 863 955 897 507 ...
output:
5848
result:
ok single line: '5848'
Test #92:
score: 0
Accepted
time: 20ms
memory: 413592kb
input:
100 7 250 236 606 215 301 501 865 165 291 309 121 997 335 982 425 936 346 255 783 82 228 612 931 54 702 53 479 487 108 543 169 240 404 153 153 50 271 543 507 500 402 532 769 456 109 584 946 873 281 242 381 997 138 52 295 953 250 955 379 243 755 942 18 455 289 306 380 999 548 150 482 268 527 634 367 ...
output:
6261
result:
ok single line: '6261'
Test #93:
score: 0
Accepted
time: 7ms
memory: 413712kb
input:
100 8 698116 532176 367685 813848 939719 115207 871972 179643 339551 492904 813090 779092 332370 612122 428849 610024 864754 44008 234484 843410 227572 114423 554843 77953 792142 411867 101624 742737 650646 423074 472390 433793 578069 67364 646254 280980 396247 303641 436423 671129 195028 377653 252...
output:
5888697
result:
ok single line: '5888697'
Test #94:
score: 0
Accepted
time: 24ms
memory: 413564kb
input:
100 7 1164 464264 816731 364156 118320 256636 1580 499408 573818 689683 794976 463921 181754 925377 980273 772404 386923 499718 3196 118200 290348 924914 527322 487955 740580 400471 489405 685548 898805 30647 577196 497252 153164 867557 276057 843446 813366 734717 991409 572342 331458 95977 51476 22...
output:
6418603
result:
ok single line: '6418603'
Test #95:
score: 0
Accepted
time: 19ms
memory: 413528kb
input:
51 7 216 147 183 552 289 541 36 578 283 805 115 104 920 619 527 345 149 220 173 599 391 288 794 211 573 772 602 522 457 254 444 863 457 933 142 833 494 858 463 427 93 884 423 408 667 280 6 355 666 739 1
output:
3219
result:
ok single line: '3219'
Test #96:
score: 0
Accepted
time: 7ms
memory: 413596kb
input:
51 7 746 910 158 327 913 265 552 10 533 949 330 119 417 799 471 904 61 790 753 511 532 191 496 711 751 788 127 528 524 837 322 983 972 324 567 571 240 924 44 278 390 385 929 228 475 280 492 585 145 885 4
output:
3690
result:
ok single line: '3690'
Test #97:
score: 0
Accepted
time: 24ms
memory: 413544kb
input:
100 7 882858 126238 5459 692648 502603 316749 177000 412763 810893 278063 192223 744451 599717 893107 616966 640149 12696 105807 206909 491181 279777 2712 476952 228522 198316 65999 737571 9526 330019 870051 285984 11716 817876 400783 335326 99257 122772 875509 838561 190971 229736 535075 352186 416...
output:
6085736
result:
ok single line: '6085736'