QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#863728 | #3301. Economic One-way Roads | zlt | AC ✓ | 3110ms | 744408kb | C++14 | 1.9kb | 2025-01-19 21:40:49 | 2025-01-19 21:40:50 |
Judging History
answer
#include <bits/stdc++.h>
#define pb emplace_back
#define fst first
#define scd second
#define mkp make_pair
#define uint unsigned
#define mems(a, x) memset((a), (x), sizeof(a))
using namespace std;
typedef long long ll;
typedef double db;
typedef unsigned long long ull;
typedef long double ldb;
typedef pair<ll, ll> pii;
const int maxn = (1 << 18) + 50;
int n, a[19][19], f[maxn], g[maxn][19][19][2];
void solve() {
scanf("%d", &n);
mems(f, 0x3f);
mems(g, 0x3f);
for (int i = 0; i < n; ++i) {
for (int j = 0; j < n; ++j) {
scanf("%d", &a[i][j]);
}
}
int s = 0;
for (int i = 0; i < n; ++i) {
for (int j = i + 1; j < n; ++j) {
if (a[i][j] != -1) {
s += min(a[i][j], a[j][i]);
}
}
}
for (int i = 0; i < n; ++i) {
f[1 << i] = s;
}
for (int S = 1; S < (1 << n); ++S) {
for (int i = 0; i < n; ++i) {
for (int j = 0; j < n; ++j) {
for (int o = 0; o <= 1; ++o) {
int v = g[S][i][j][o];
if (v > 1e9) {
continue;
}
for (int k = 0; k < n; ++k) {
if ((S & (1 << k)) || a[i][k] == -1) {
continue;
}
g[S | (1 << k)][k][j][0] = min(g[S | (1 << k)][k][j][0], v + a[i][k] - min(a[i][k], a[k][i]));
}
}
if (a[i][j] != -1) {
f[S] = min(f[S], g[S][i][j][0] + a[i][j] - min(a[i][j], a[j][i]));
}
}
}
for (int i = 0; i < n; ++i) {
if ((~S) & (1 << i)) {
continue;
}
for (int j = 0; j < n; ++j) {
if ((~S) & (1 << j)) {
continue;
}
for (int k = 0; k < n; ++k) {
if ((S & (1 << k)) || a[i][k] == -1) {
continue;
}
g[S | (1 << k)][k][j][i == j] = min(g[S | (1 << k)][k][j][i == j], f[S] + a[i][k] - min(a[i][k], a[k][i]));
}
}
}
}
printf("%d\n", f[(1 << n) - 1] > 1e9 ? -1 : f[(1 << n) - 1]);
}
int main() {
int T = 1;
// scanf("%d", &T);
while (T--) {
solve();
}
return 0;
}
详细
Test #1:
score: 100
Accepted
time: 27ms
memory: 744288kb
input:
4 -1 3 2 -1 3 -1 7 7 5 9 -1 9 -1 6 7 -1
output:
27
result:
ok single line: '27'
Test #2:
score: 0
Accepted
time: 23ms
memory: 744320kb
input:
6 -1 1 2 -1 -1 -1 3 -1 4 -1 -1 -1 5 6 -1 0 -1 -1 -1 -1 0 -1 6 5 -1 -1 -1 4 -1 3 -1 -1 -1 2 1 -1
output:
-1
result:
ok single line: '-1'
Test #3:
score: 0
Accepted
time: 886ms
memory: 744404kb
input:
17 -1 88 81 18 79 85 89 8 52 64 88 46 74 0 37 45 11 72 -1 82 23 84 2 68 59 54 90 46 70 11 27 74 54 69 30 65 -1 24 73 34 61 79 16 51 18 35 19 96 7 29 34 46 91 47 -1 12 93 10 89 42 8 99 7 73 66 29 46 86 24 37 85 6 -1 32 43 0 16 89 50 49 4 91 30 72 78 62 41 51 40 77 -1 53 30 30 16 12 88 24 22 93 91 97 ...
output:
4033
result:
ok single line: '4033'
Test #4:
score: 0
Accepted
time: 23ms
memory: 744400kb
input:
2 -1 0 0 -1
output:
-1
result:
ok single line: '-1'
Test #5:
score: 0
Accepted
time: 26ms
memory: 744316kb
input:
2 -1 -1 -1 -1
output:
-1
result:
ok single line: '-1'
Test #6:
score: 0
Accepted
time: 25ms
memory: 744344kb
input:
3 -1 65 48 47 -1 67 14 14 -1
output:
109
result:
ok single line: '109'
Test #7:
score: 0
Accepted
time: 29ms
memory: 744348kb
input:
4 -1 -1 -1 5269 -1 -1 7558 9755 -1 3252 -1 2179 6869 2977 6731 -1
output:
-1
result:
ok single line: '-1'
Test #8:
score: 0
Accepted
time: 25ms
memory: 744220kb
input:
5 -1 728193 156512 -1 -1 180239 -1 -1 -1 376412 857864 -1 -1 235195 540428 -1 -1 180287 -1 -1 -1 723303 736985 -1 -1
output:
-1
result:
ok single line: '-1'
Test #9:
score: 0
Accepted
time: 191ms
memory: 744404kb
input:
15 -1 553543 225601 517999 21318 37016 44188 300618 112573 452112 705360 172825 230800 181256 325409 958112 -1 170632 197698 371188 799273 239019 653746 54513 312631 27424 673597 22615 277597 271150 910086 462379 -1 99795 259487 56755 101142 590087 246320 198641 72552 90982 420526 454982 161347 9029...
output:
29120635
result:
ok single line: '29120635'
Test #10:
score: 0
Accepted
time: 187ms
memory: 744352kb
input:
15 -1 68608 317687 9353 490882 79910 397959 102685 667078 407072 333583 406888 99295 525793 649698 589345 -1 390808 485436 686956 46499 247139 928463 316775 397051 436251 347729 346535 20640 524420 652617 468450 -1 208693 424276 487357 288461 455216 730356 322183 26696 125219 273177 430237 214756 20...
output:
37700340
result:
ok single line: '37700340'
Test #11:
score: 0
Accepted
time: 269ms
memory: 744404kb
input:
15 -1 70222 64277 110319 807094 589572 -1 -1 932282 61869 -1 80633 -1 652756 -1 205455 -1 66259 532552 401577 -1 427275 -1 477351 462584 124853 837974 376442 -1 -1 872893 617673 -1 -1 -1 877920 122309 181246 -1 -1 354303 -1 20367 234925 -1 630914 677038 -1 -1 884328 362307 332973 -1 350673 -1 -1 384...
output:
23152188
result:
ok single line: '23152188'
Test #12:
score: 0
Accepted
time: 600ms
memory: 744400kb
input:
16 -1 346869 -1 402643 -1 436063 299753 97344 -1 619077 196162 -1 -1 84868 -1 521321 590405 -1 173315 82044 185447 360587 12418 303078 -1 879464 -1 515068 571217 255532 812837 208082 -1 664339 -1 358182 481114 543750 -1 -1 -1 87522 -1 63668 180768 464472 330460 420967 829606 388745 613128 -1 639423 ...
output:
28555291
result:
ok single line: '28555291'
Test #13:
score: 0
Accepted
time: 585ms
memory: 744308kb
input:
16 -1 -1 507696 773169 189786 -1 219057 -1 -1 40577 205434 46435 292269 -1 147455 -1 -1 -1 -1 481544 -1 -1 205266 23870 -1 607456 -1 503510 -1 -1 66271 534426 547496 -1 -1 -1 -1 427924 503414 -1 108956 -1 -1 -1 -1 -1 22701 -1 808620 765174 -1 -1 195738 -1 133733 -1 146128 117005 -1 -1 -1 204688 -1 -...
output:
21764923
result:
ok single line: '21764923'
Test #14:
score: 0
Accepted
time: 1264ms
memory: 744404kb
input:
18 -1 299674 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 310093 661140 -1 -1 -1 -1 876908 -1 -1 -1 778334 -1 -1 806964 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 36893 762498 27074 -1 -1 -1 -1 -1 -1 167912 -1 325634 -1 -1 344697 -1 -1 675314 -1 -1 340457 -1 -1 359970 -1 531972 -1 443260 -1 -1 -1 -1 -1 -1 111451 49245...
output:
11443627
result:
ok single line: '11443627'
Test #15:
score: 0
Accepted
time: 1993ms
memory: 744348kb
input:
18 -1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 582 -1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 40 701 -1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 90 40 629 -1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 165 91 48 955 -1 0 0 0 0 0 0 0 0 0 0 0 0 0 255 166 99 45 986 -1 0 0 0 0 0 0 0 0 0 0 0 0 364 253 164 91 48 382 -1 0 0 0 0 0 0 0 0 0 0 0 492 3...
output:
398
result:
ok single line: '398'
Test #16:
score: 0
Accepted
time: 1083ms
memory: 744404kb
input:
18 -1 824138 677412 558634 449220 742360 692080 85004 85391 -1 -1 -1 -1 -1 -1 -1 -1 -1 948267 -1 810968 456862 636048 956556 522527 688335 47801 -1 -1 -1 -1 -1 -1 -1 -1 -1 749011 753234 -1 665726 977062 350463 386487 415035 159866 -1 -1 -1 -1 -1 -1 -1 -1 -1 121690 293629 61860 -1 659217 574508 43708...
output:
-1
result:
ok single line: '-1'
Test #17:
score: 0
Accepted
time: 1220ms
memory: 744408kb
input:
18 -1 824138 677412 558634 449220 742360 692080 85004 85391 -1 -1 -1 -1 -1 -1 -1 -1 415035 948267 -1 810968 456862 636048 956556 522527 688335 47801 -1 -1 -1 -1 -1 -1 -1 -1 -1 749011 753234 -1 665726 977062 350463 386487 415035 159866 -1 -1 -1 -1 -1 -1 -1 -1 -1 121690 293629 61860 -1 659217 574508 4...
output:
26137167
result:
ok single line: '26137167'
Test #18:
score: 0
Accepted
time: 20ms
memory: 744388kb
input:
10 -1 0 0 0 0 0 0 0 0 0 0 -1 0 0 0 0 0 0 0 0 0 0 -1 0 0 0 0 0 0 0 0 0 0 -1 0 0 0 0 0 0 0 0 0 0 -1 0 0 0 0 0 0 0 0 0 0 -1 0 0 0 0 0 0 0 0 0 0 -1 0 0 0 0 0 0 0 0 0 0 -1 0 0 0 0 0 0 0 0 0 0 -1 0 0 0 0 0 0 0 0 0 0 -1
output:
0
result:
ok single line: '0'
Test #19:
score: 0
Accepted
time: 27ms
memory: 744368kb
input:
10 -1 0 -1 -1 -1 -1 -1 -1 -1 -1 0 -1 0 -1 -1 -1 -1 -1 -1 -1 -1 0 -1 0 -1 -1 -1 -1 -1 -1 -1 -1 0 -1 0 -1 -1 -1 -1 -1 -1 -1 -1 0 -1 0 -1 -1 -1 -1 -1 -1 -1 -1 0 -1 0 -1 -1 -1 -1 -1 -1 -1 -1 0 -1 0 -1 -1 -1 -1 -1 -1 -1 -1 0 -1 0 -1 -1 -1 -1 -1 -1 -1 -1 0 -1 0 -1 -1 -1 -1 -1 -1 -1 -1 0 -1
output:
-1
result:
ok single line: '-1'
Test #20:
score: 0
Accepted
time: 22ms
memory: 744372kb
input:
10 -1 0 -1 -1 -1 -1 -1 -1 -1 0 0 -1 0 -1 -1 -1 -1 -1 -1 -1 -1 0 -1 0 -1 -1 -1 -1 -1 -1 -1 -1 0 -1 0 -1 -1 -1 -1 -1 -1 -1 -1 0 -1 0 -1 -1 -1 -1 -1 -1 -1 -1 0 -1 0 -1 -1 -1 -1 -1 -1 -1 -1 0 -1 0 -1 -1 -1 -1 -1 -1 -1 -1 0 -1 0 -1 -1 -1 -1 -1 -1 -1 -1 0 -1 0 0 -1 -1 -1 -1 -1 -1 -1 0 -1
output:
0
result:
ok single line: '0'
Test #21:
score: 0
Accepted
time: 1992ms
memory: 744308kb
input:
18 -1 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 -1 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 -1 ...
output:
153000000
result:
ok single line: '153000000'
Test #22:
score: 0
Accepted
time: 1994ms
memory: 744400kb
input:
18 -1 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 0 -1 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 0 0 -1 1000000 1000000 10...
output:
1000000
result:
ok single line: '1000000'
Test #23:
score: 0
Accepted
time: 260ms
memory: 744192kb
input:
15 -1 325715 443251 262382 328751 -1 907437 -1 512803 688436 343544 535477 894402 888747 257050 401021 -1 -1 606839 241361 689676 934761 -1 376163 392156 733524 251556 497672 281436 755139 795766 -1 -1 -1 -1 936896 845819 673780 510062 -1 941811 712258 547232 403429 819437 911110 676527 -1 -1 788188...
output:
28072211
result:
ok single line: '28072211'
Test #24:
score: 0
Accepted
time: 2910ms
memory: 744404kb
input:
18 -1 134214 -1 850547 -1 -1 -1 948200 456024 817576 -1 486666 -1 920418 -1 226353 -1 524110 84686 -1 27343 -1 810149 514889 888957 106615 -1 884854 920793 606797 613589 970993 -1 -1 -1 777088 -1 87987 -1 -1 810704 298427 625494 -1 -1 -1 801552 273661 -1 715859 -1 874352 -1 -1 12679 -1 -1 -1 554832 ...
output:
33621636
result:
ok single line: '33621636'
Test #25:
score: 0
Accepted
time: 3110ms
memory: 744404kb
input:
18 -1 240841 -1 343145 853169 247752 -1 78614 541614 625850 -1 -1 -1 47772 631977 -1 -1 120258 753733 -1 4019 833095 -1 389825 182441 -1 498405 -1 830408 530032 543892 725203 917689 360145 699218 43831 -1 995537 -1 212226 928777 414478 -1 -1 -1 845311 700783 763271 -1 -1 -1 -1 54869 638374 669479 52...
output:
28973445
result:
ok single line: '28973445'
Test #26:
score: 0
Accepted
time: 1093ms
memory: 744404kb
input:
18 -1 1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 99 0 -1 1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 0 -1 1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 0 -1 1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 0 -1 1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 0 -1 1 -1 -1 -1 -1 -1 -1...
output:
17
result:
ok single line: '17'
Test #27:
score: 0
Accepted
time: 1358ms
memory: 744304kb
input:
18 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 1 -1 -1 0 1 -1 -1 -1 -1 -1 1 -1 1 -1 -1 -1 1 -1 -1 -1 -1 -1 -1 -1 1 1 -1 0 -1 0 -1 -1 -1 -1 0 -1 -1 -1 -1 -1 -1 -1 0 -1 -1 -1 1 -1 -1 -1 -1 1 -1 -1 -1 -1 1 -1 -1 -1 1 -1 -1 0 -1 -1 -1 -1 -1 -1 1 -1 -1 -1 0 0 1 1 0 -1 -1 -1 -1 -1 -1 -1 -1 0 -1 -1 -1 -1 -1 -1 1 -1 0 -1...
output:
4
result:
ok single line: '4'
Test #28:
score: 0
Accepted
time: 1984ms
memory: 744152kb
input:
18 -1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 6 -1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 11 6 -1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 33 12 -1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 68 35 20 18 -1 0 0 0 0 0 0 0 0 0 0 0 0 0 67 35 47 28 1 -1 0 0 0 0 0 0 0 0 0 0 0 0 63 110 151 88 38 3 -1 0 0 0 0 0 0 0 0 0 0 0 372 145 147 163 85 1...
output:
41
result:
ok single line: '41'
Test #29:
score: 0
Accepted
time: 1992ms
memory: 744376kb
input:
18 -1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 39 -1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 130 106 -1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 170 71 108 -1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 245 111 42 34 -1 0 0 0 0 0 0 0 0 0 0 0 0 0 296 182 137 122 86 -1 0 0 0 0 0 0 0 0 0 0 0 0 437 343 238 98 75 85 -1 0 0 0 0 0 0 0 0 0 0 0 503 ...
output:
585
result:
ok single line: '585'
Test #30:
score: 0
Accepted
time: 1993ms
memory: 744320kb
input:
18 -1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 12 -1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 45 15 -1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 95 41 13 -1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 167 94 42 18 -1 0 0 0 0 0 0 0 0 0 0 0 0 0 254 165 96 46 16 -1 0 0 0 0 0 0 0 0 0 0 0 0 368 250 167 98 40 10 -1 0 0 0 0 0 0 0 0 0 0 0 499 361 251...
output:
233
result:
ok single line: '233'
Test #31:
score: 0
Accepted
time: 1262ms
memory: 744172kb
input:
18 -1 -1 -1 -1 -1 1 -1 1 -1 0 -1 -1 -1 1 -1 -1 -1 -1 -1 -1 -1 1 -1 1 0 -1 -1 1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 0 -1 1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 0 -1 -1 -1 -1 1 -1 -1 -1 -1 -1 -1 -1 -1 -1 0 -1 -1 -1 1 -1 -1 -1 1 0 -1 1 -1 -1 1 -1 0 -1 -1 -1 0 0 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 ...
output:
2
result:
ok single line: '2'
Test #32:
score: 0
Accepted
time: 1259ms
memory: 744404kb
input:
18 -1 -1 0 -1 -1 -1 1 -1 -1 1 -1 -1 -1 -1 -1 0 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 0 -1 -1 -1 0 1 -1 -1 -1 0 1 -1 -1 -1 -1 1 -1 -1 -1 0 -1 -1 -1 -1 1 1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 0 -1 -1 0 -1 -1 -1 0 -1 -1 -1 -1 -1 -1 -1 -1 -1 0 -1 -1 -1 -1 -1 -1 0 -1 -1 -1 0 -1 -1 -1 -1 -1 -1 0 -1 -1 0 -1 -1 -1 ...
output:
3
result:
ok single line: '3'
Test #33:
score: 0
Accepted
time: 2501ms
memory: 744404kb
input:
18 -1 718201 415232 -1 -1 -1 88404 87497 323144 600444 53047 504577 -1 736973 263556 -1 -1 -1 950018 -1 -1 433446 -1 -1 -1 -1 53760 151 -1 -1 -1 -1 -1 425120 -1 278726 790017 -1 -1 337417 -1 -1 -1 -1 300665 244780 -1 162991 -1 144325 -1 224696 653264 930304 -1 594049 742036 -1 -1 -1 708165 243490 -1...
output:
23019016
result:
ok single line: '23019016'
Test #34:
score: 0
Accepted
time: 2781ms
memory: 744404kb
input:
18 -1 -1 -1 -1 -1 -1 -1 -1 -1 140753 -1 275487 261861 407152 146266 415215 -1 309285 -1 -1 58439 506019 803817 -1 157581 -1 -1 366478 67861 120177 -1 38901 -1 -1 19123 -1 -1 254952 -1 94432 -1 -1 693049 539018 265740 433971 -1 -1 191828 14834 573743 590304 121433 768595 -1 816335 521029 -1 258440 -1...
output:
23387242
result:
ok single line: '23387242'
Test #35:
score: 0
Accepted
time: 1702ms
memory: 744404kb
input:
18 -1 -1 -1 -1 -1 -1 508314 -1 -1 -1 88324 278706 -1 -1 -1 -1 136566 484508 -1 -1 -1 -1 143998 -1 198037 -1 -1 -1 -1 -1 -1 -1 175888 -1 179081 -1 -1 -1 -1 145999 -1 -1 201968 -1 -1 230578 -1 419560 -1 -1 449932 -1 -1 -1 -1 -1 545789 -1 -1 -1 -1 -1 514545 -1 -1 296772 218516 -1 -1 -1 -1 -1 -1 289457 ...
output:
15193454
result:
ok single line: '15193454'
Test #36:
score: 0
Accepted
time: 582ms
memory: 744324kb
input:
16 -1 13 5 27 65 57 -1 25 43 40 0 43 87 17 18 -1 78 -1 -1 1 15 -1 18 -1 21 27 42 1 0 -1 9 32 47 -1 -1 -1 14 38 -1 -1 71 -1 14 25 9 -1 36 -1 33 19 -1 -1 77 21 -1 11 35 2 57 13 2 -1 1 16 80 51 55 96 -1 -1 14 27 61 13 78 -1 17 5 1 -1 88 -1 43 79 -1 -1 57 25 7 16 -1 -1 -1 44 -1 73 -1 38 -1 -1 17 72 -1 -...
output:
2696
result:
ok single line: '2696'
Test #37:
score: 0
Accepted
time: 588ms
memory: 744192kb
input:
16 -1 46 35 -1 23 -1 6 74 50 -1 24 40 20 -1 -1 -1 77 -1 18 45 21 -1 30 10 -1 9 19 41 -1 -1 70 71 88 79 -1 80 2 -1 19 51 52 -1 8 -1 -1 14 10 58 -1 56 82 -1 3 39 61 15 -1 -1 84 9 -1 -1 -1 -1 45 92 94 71 -1 38 46 26 22 -1 7 43 -1 60 86 16 -1 -1 -1 92 68 -1 -1 48 91 -1 23 15 48 -1 -1 17 30 87 41 94 84 -...
output:
2787
result:
ok single line: '2787'
Test #38:
score: 0
Accepted
time: 498ms
memory: 744200kb
input:
16 -1 36 16 81 29 -1 13 42 69 49 30 23 2 25 -1 50 80 -1 32 -1 -1 22 -1 10 -1 49 -1 -1 -1 -1 -1 54 60 53 -1 -1 -1 6 -1 -1 -1 -1 -1 -1 46 61 8 -1 96 -1 -1 -1 45 62 6 -1 5 38 -1 31 5 98 -1 84 94 -1 -1 64 -1 33 -1 -1 -1 -1 -1 42 -1 34 25 11 -1 55 34 64 98 -1 -1 15 74 -1 78 -1 25 13 -1 -1 59 -1 -1 75 -1 ...
output:
1926
result:
ok single line: '1926'
Test #39:
score: 0
Accepted
time: 2650ms
memory: 744376kb
input:
18 -1 34 49 -1 -1 5 68 37 -1 -1 -1 -1 -1 52 39 -1 18 -1 56 -1 11 42 9 -1 26 18 33 76 2 5 -1 76 53 -1 -1 10 68 72 -1 -1 -1 9 -1 -1 69 56 51 -1 25 -1 -1 -1 50 -1 -1 48 -1 -1 48 -1 37 20 -1 74 -1 46 -1 -1 29 5 -1 -1 -1 21 -1 66 -1 -1 14 -1 14 59 35 32 -1 -1 -1 -1 -1 24 7 -1 72 -1 -1 -1 -1 98 46 34 2 10...
output:
2348
result:
ok single line: '2348'
Test #40:
score: 0
Accepted
time: 2161ms
memory: 744404kb
input:
18 -1 -1 9 0 -1 -1 -1 -1 4 -1 -1 -1 -1 -1 40 -1 95 -1 -1 -1 -1 -1 53 44 -1 24 35 -1 -1 58 -1 -1 13 -1 14 61 25 -1 -1 -1 -1 71 30 -1 -1 -1 60 -1 57 -1 -1 11 -1 -1 26 -1 -1 -1 -1 -1 38 -1 -1 -1 -1 -1 -1 -1 -1 40 -1 39 -1 93 -1 -1 -1 18 60 36 -1 32 81 79 -1 3 50 -1 8 24 -1 80 91 -1 9 -1 -1 -1 0 35 -1 -...
output:
2195
result:
ok single line: '2195'
Test #41:
score: 0
Accepted
time: 20ms
memory: 744404kb
input:
10 -1 7 8 -1 -1 -1 3 9 -1 -1 9 -1 6 5 6 -1 -1 -1 -1 -1 8 8 -1 0 6 3 -1 2 8 -1 -1 6 1 -1 -1 3 -1 2 -1 4 -1 9 8 -1 -1 7 -1 -1 -1 5 -1 -1 6 0 9 -1 0 2 2 6 7 -1 -1 -1 -1 3 -1 -1 -1 -1 10 -1 5 7 -1 10 -1 -1 -1 0 -1 -1 9 -1 -1 7 -1 -1 -1 -1 -1 -1 -1 10 7 6 -1 4 -1 -1
output:
95
result:
ok single line: '95'
Test #42:
score: 0
Accepted
time: 24ms
memory: 744408kb
input:
10 -1 -1 -1 1 -1 2 4 8 -1 -1 -1 -1 1 -1 2 -1 -1 -1 0 -1 -1 0 -1 -1 -1 -1 1 -1 3 -1 3 -1 -1 -1 1 -1 0 6 -1 5 -1 3 -1 8 -1 -1 8 1 -1 5 3 -1 -1 -1 -1 -1 -1 -1 -1 -1 10 -1 8 4 3 -1 -1 5 7 -1 10 -1 -1 9 2 -1 6 -1 3 1 -1 6 7 -1 -1 -1 9 8 -1 -1 -1 -1 -1 9 6 -1 -1 3 -1 -1
output:
-1
result:
ok single line: '-1'
Test #43:
score: 0
Accepted
time: 31ms
memory: 744332kb
input:
10 -1 -1 0 1 1 -1 0 0 1 -1 -1 -1 -1 -1 0 -1 1 -1 -1 0 2 -1 -1 1 0 -1 0 2 1 -1 2 -1 2 -1 0 -1 -1 -1 2 0 2 2 1 1 -1 0 2 0 -1 -1 -1 -1 -1 -1 2 -1 0 1 -1 0 1 2 1 -1 2 0 -1 1 -1 2 1 -1 2 -1 2 1 2 -1 -1 -1 2 -1 1 2 -1 -1 -1 -1 -1 1 -1 1 -1 2 -1 1 2 -1 2 -1
output:
19
result:
ok single line: '19'
Test #44:
score: 0
Accepted
time: 19ms
memory: 744408kb
input:
10 -1 -1 -1 0 -1 1 -1 -1 -1 -1 -1 -1 -1 1 0 -1 -1 1 -1 0 -1 -1 -1 -1 -1 -1 2 -1 -1 -1 0 2 -1 -1 -1 1 -1 0 -1 1 -1 0 -1 -1 -1 -1 -1 -1 1 -1 1 -1 -1 2 -1 -1 -1 0 0 -1 -1 -1 2 -1 -1 -1 -1 1 0 -1 -1 2 -1 0 -1 2 2 -1 -1 0 -1 -1 -1 -1 2 2 1 -1 -1 -1 -1 1 -1 2 -1 -1 -1 1 -1 -1
output:
-1
result:
ok single line: '-1'
Test #45:
score: 0
Accepted
time: 2620ms
memory: 744312kb
input:
18 -1 -1 635618 428268 153856 751447 -1 311131 370465 165260 -1 -1 463217 -1 67204 -1 -1 756157 -1 -1 398979 -1 -1 -1 -1 438966 -1 -1 -1 -1 533238 847429 318264 404349 109636 155890 662819 663249 -1 387036 339239 32241 137253 -1 98877 -1 460877 -1 -1 -1 600901 24143 -1 -1 793166 -1 971030 -1 -1 2452...
output:
25076357
result:
ok single line: '25076357'
Test #46:
score: 0
Accepted
time: 1587ms
memory: 744404kb
input:
18 -1 -1 -1 -1 768915 -1 17875 -1 489138 -1 -1 715812 41328 -1 -1 246851 -1 -1 -1 -1 -1 -1 138398 -1 -1 -1 -1 148951 296676 -1 153306 -1 -1 67143 -1 -1 -1 -1 -1 656932 -1 -1 -1 -1 -1 9439 -1 -1 -1 315547 -1 448701 676448 535554 -1 -1 952301 -1 66769 -1 -1 388797 -1 -1 -1 747098 -1 -1 -1 -1 -1 -1 855...
output:
15931231
result:
ok single line: '15931231'
Test #47:
score: 0
Accepted
time: 1111ms
memory: 744408kb
input:
18 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 899619 -1 -1 66104 -1 -1 -1 -1 183749 -1 -1 -1 -1 -1 -1 -1 -1 128360 -1 -1 -1 91666 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 25995 -1 -1 -1 631586 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 71133 63217 832104 327030 -1 -1 -1 -1 ...
output:
-1
result:
ok single line: '-1'
Test #48:
score: 0
Accepted
time: 868ms
memory: 744400kb
input:
18 -1 -1 -1 -1 172608 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 355403 -1 -1 -1 -1 -1 -1 -1 901882 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 ...
output:
-1
result:
ok single line: '-1'
Test #49:
score: 0
Accepted
time: 25ms
memory: 744276kb
input:
10 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -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 single line: '-1'
Test #50:
score: 0
Accepted
time: 28ms
memory: 744356kb
input:
10 -1 -1 -1 -1 -1 -1 -1 158916 455483 -1 -1 -1 -1 432583 -1 492654 -1 -1 -1 -1 -1 -1 -1 496332 546765 362732 -1 -1 -1 -1 -1 583321 779785 -1 469049 308025 7221 475668 161923 97219 -1 -1 910494 781197 -1 -1 -1 -1 291902 286963 -1 781042 461968 785923 -1 -1 -1 364299 532927 349678 -1 -1 -1 765350 -1 -...
output:
7867975
result:
ok single line: '7867975'
Test #51:
score: 0
Accepted
time: 32ms
memory: 744404kb
input:
10 -1 958962 689181 338795 49506 80769 287421 642867 -1 41240 133593 -1 -1 626097 -1 705064 704383 209144 287788 624157 824181 -1 -1 563720 213581 385420 182118 56288 736744 145054 973556 739649 971791 -1 753556 -1 -1 251591 309765 340740 400970 -1 526078 842161 -1 -1 686988 637677 340051 154228 461...
output:
13639736
result:
ok single line: '13639736'
Test #52:
score: 0
Accepted
time: 25ms
memory: 744408kb
input:
10 -1 195304 -1 57640 145805 143270 448784 372910 311831 8420 706982 -1 511586 -1 567699 -1 -1 -1 824956 601247 -1 630303 -1 797017 929625 239545 354280 -1 33187 309302 676811 -1 49987 -1 701232 -1 697086 174309 435187 344898 662668 723453 977447 859340 -1 7694 768430 -1 76574 669286 656456 -1 44310...
output:
11043753
result:
ok single line: '11043753'
Test #53:
score: 0
Accepted
time: 36ms
memory: 744292kb
input:
10 -1 582720 -1 173826 367077 -1 140795 -1 717113 -1 651873 -1 -1 -1 439641 -1 325515 148009 -1 -1 -1 -1 -1 -1 158760 200571 332385 -1 110876 -1 848177 -1 -1 -1 -1 806654 661904 -1 -1 572799 409856 593058 792198 -1 -1 -1 -1 30609 31557 -1 -1 -1 227678 252499 -1 -1 254036 444547 -1 -1 747961 916926 3...
output:
6760543
result:
ok single line: '6760543'
Test #54:
score: 0
Accepted
time: 30ms
memory: 744404kb
input:
10 -1 -1 -1 86963 -1 -1 378220 124180 372908 238452 -1 -1 -1 -1 257795 -1 -1 19504 -1 -1 -1 -1 -1 -1 -1 96793 -1 771824 518682 -1 461373 -1 -1 -1 -1 5740 -1 -1 228636 509946 -1 310927 -1 -1 -1 -1 -1 122561 443585 -1 -1 -1 153347 974343 -1 -1 330780 589936 548124 586581 968851 -1 -1 -1 -1 767500 -1 3...
output:
8236272
result:
ok single line: '8236272'
Test #55:
score: 0
Accepted
time: 25ms
memory: 744360kb
input:
10 -1 -1 -1 -1 -1 -1 -1 -1 87724 -1 -1 -1 -1 87513 -1 -1 45829 -1 -1 769876 -1 -1 -1 221601 802429 10688 -1 -1 -1 398255 -1 70286 306127 -1 709186 392731 334054 988657 69727 276804 -1 -1 960568 726688 -1 -1 -1 5601 529075 -1 -1 -1 979477 735147 -1 -1 514529 -1 -1 788646 -1 842994 -1 739311 -1 700476...
output:
-1
result:
ok single line: '-1'
Test #56:
score: 0
Accepted
time: 28ms
memory: 744392kb
input:
10 -1 -1 -1 76900 -1 674635 788524 -1 -1 285232 -1 -1 816820 -1 453493 -1 632645 167323 -1 -1 -1 379413 -1 -1 743580 146657 498179 530565 -1 498265 459069 -1 -1 -1 489693 183419 362571 -1 -1 940433 -1 933587 801515 281107 -1 55470 278183 -1 4356 -1 490647 -1 539384 913134 521535 -1 -1 979830 -1 -1 1...
output:
8170506
result:
ok single line: '8170506'
Test #57:
score: 0
Accepted
time: 422ms
memory: 744408kb
input:
16 -1 -1 206236 -1 -1 -1 -1 -1 -1 154783 -1 -1 41353 -1 562674 -1 -1 -1 168077 642051 -1 142677 711400 -1 -1 -1 -1 -1 38502 375768 702087 -1 656613 183322 -1 190557 35723 633336 929254 -1 -1 -1 -1 420453 -1 -1 -1 176242 -1 338514 202499 -1 176550 926093 -1 -1 439749 149028 -1 -1 573916 -1 -1 -1 -1 -...
output:
13956204
result:
ok single line: '13956204'