QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#58221 | #2901. Hopscotch 500 | Beevo# | AC ✓ | 190ms | 17332kb | C++23 | 1.4kb | 2022-10-25 04:04:00 | 2022-10-25 04:04:01 |
Judging History
answer
#include <bits/stdc++.h>
#define el '\n'
#define ll long long
#define ld long double
#define Beevo ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
using namespace std;
const ll INF = 1e18;
void testCase() {
int n, k;
cin >> n >> k;
vector<pair<int, int>> indices[k + 1];
for (int i = 0; i < n; i++) {
for (int j = 0; j < n; j++) {
int a;
cin >> a;
indices[a].emplace_back(i, j);
}
}
vector<ll> row(n, INF), col(n, INF);
for (auto &i: indices[1])
row[i.first] = col[i.second] = 0;
for (int i = 2; i <= k; i++) {
vector<ll> newRow(n, INF), newCol(n, INF);
for (auto &j: indices[i]) {
ll sol = INF;
for (int l = 0; l < n; l++) {
sol = min(sol, abs(l - j.first) * abs(l - j.first) + row[l]);
sol = min(sol, abs(l - j.second) * abs(l - j.second) + col[l]);
}
newRow[j.first] = min(newRow[j.first], sol);
newCol[j.second] = min(newCol[j.second], sol);
}
row = newRow, col = newCol;
}
ll sol = INF;
for (int i = 0; i < n; i++)
sol = min({sol, row[i], col[i]});
cout << (sol == INF ? -1 : sol);
}
signed main() {
Beevo
int T = 1;
// cin >> T;
while (T--)
testCase();
return 0;
}
詳細信息
Test #1:
score: 100
Accepted
time: 167ms
memory: 17332kb
input:
500 250000 1 5 7 19 21 41 43 71 73 109 111 155 157 209 211 271 273 341 343 419 421 505 507 599 601 701 703 811 813 929 931 1055 1057 1189 1191 1331 1333 1481 1483 1639 1641 1805 1807 1979 1981 2161 2163 2351 2353 2549 2551 2755 2757 2969 2971 3191 3193 3421 3423 3659 3661 3905 3907 4159 4161 4421 44...
output:
18166812001
result:
ok single line: '18166812001'
Test #2:
score: 0
Accepted
time: 2ms
memory: 3552kb
input:
10 20 2 19 13 3 5 15 2 3 7 6 19 15 20 10 6 1 3 13 6 7 10 13 18 6 9 10 19 2 20 17 2 1 20 4 3 10 3 18 5 10 9 17 14 7 16 2 20 1 9 11 18 4 3 5 19 9 11 19 1 5 11 3 2 17 8 16 17 1 9 17 10 19 5 6 7 7 5 15 4 12 8 6 17 7 4 9 8 4 12 11 6 16 14 4 4 14 11 2 16 20
output:
7
result:
ok single line: '7'
Test #3:
score: 0
Accepted
time: 75ms
memory: 6076kb
input:
500 1024 853 117 69 649 129 325 369 721 121 817 885 101 829 145 413 837 349 69 869 281 197 785 341 997 637 953 985 189 885 201 137 1 705 517 893 485 321 237 33 81 445 237 561 937 81 265 801 593 385 957 257 821 849 621 801 357 33 729 833 229 597 173 565 557 337 381 581 861 397 293 845 909 625 65 689 ...
output:
3772
result:
ok single line: '3772'
Test #4:
score: 0
Accepted
time: 73ms
memory: 5572kb
input:
500 128 41 45 1 9 121 57 125 73 25 29 49 65 49 93 109 33 121 89 113 121 81 93 81 89 65 109 49 41 101 9 61 65 57 89 1 105 49 1 65 85 105 105 25 45 41 69 121 93 125 41 41 97 101 97 65 65 13 17 57 21 33 93 93 49 125 49 93 53 113 73 21 109 33 57 45 61 101 81 65 61 89 81 77 45 69 13 17 85 117 81 13 77 57...
output:
64
result:
ok single line: '64'
Test #5:
score: 0
Accepted
time: 131ms
memory: 11168kb
input:
500 131072 96697 41329 126385 4821 108577 15005 46465 90857 785 2229 112913 80297 109405 108957 28897 97977 111409 33689 98501 60725 1137 92021 33969 36993 80989 98725 65849 100605 8685 77497 71717 129265 106481 57641 107925 35061 46257 54689 127781 86525 110281 73541 6513 59105 104309 126849 48569 ...
output:
-1
result:
ok single line: '-1'
Test #6:
score: 0
Accepted
time: 72ms
memory: 5704kb
input:
500 16 5 9 9 9 5 13 13 1 1 9 9 13 13 5 1 1 9 5 1 13 1 1 5 13 1 5 13 1 5 5 5 9 9 1 1 13 13 5 5 5 5 9 13 9 13 9 9 1 1 1 13 5 5 13 9 9 9 9 9 5 5 13 13 9 5 13 13 1 9 5 5 5 1 9 13 5 13 13 1 13 13 1 13 1 5 5 5 5 9 1 5 1 1 5 13 1 13 13 13 13 1 13 5 1 5 1 5 13 1 13 9 13 5 5 9 13 5 5 5 13 5 9 9 13 5 5 13 9 9...
output:
8
result:
ok single line: '8'
Test #7:
score: 0
Accepted
time: 87ms
memory: 7328kb
input:
500 16384 7181 12505 749 6053 13133 12481 581 14557 2829 7245 11489 11517 2961 12237 10589 13945 12393 3145 969 14497 10129 15021 15641 4433 12121 5161 14685 2293 3077 5677 1217 2193 13825 7129 1997 6213 13101 2169 5285 5017 2545 2121 5233 16117 11857 6105 3697 6489 11085 15065 4113 85 8541 3029 145...
output:
10446350
result:
ok single line: '10446350'
Test #8:
score: 0
Accepted
time: 85ms
memory: 6416kb
input:
500 2048 1601 373 729 993 1917 1089 1925 1713 905 1573 1345 1621 149 1629 29 781 1913 745 1229 669 1157 385 369 537 129 369 1221 1049 949 949 1401 417 1353 1305 1785 1709 1025 29 905 121 1185 25 1801 893 81 2005 1053 1265 561 1401 1825 805 1349 1337 425 1329 181 1957 1221 1237 1329 1853 505 457 629 ...
output:
28993
result:
ok single line: '28993'
Test #9:
score: 0
Accepted
time: 190ms
memory: 14192kb
input:
500 230000 193357 75985 78037 228129 211169 137101 106181 61917 27929 43597 112765 13209 95205 101577 33725 185049 55161 215577 121933 185921 217657 126129 194581 97137 83841 47621 16013 97937 171801 19257 169353 85333 90281 146089 127073 229861 127717 61329 182129 116097 42333 172905 206873 87789 1...
output:
-1
result:
ok single line: '-1'
Test #10:
score: 0
Accepted
time: 74ms
memory: 5804kb
input:
500 256 77 73 189 61 245 193 221 45 201 153 241 65 17 25 253 213 185 213 53 61 165 41 85 253 49 17 25 137 205 129 193 153 21 233 53 121 65 197 69 93 189 189 121 165 129 221 13 221 57 97 181 17 153 105 213 225 45 145 17 197 181 37 149 237 169 125 1 189 9 117 101 29 25 105 85 9 73 209 65 217 17 97 49 ...
output:
156
result:
ok single line: '156'
Test #11:
score: 0
Accepted
time: 69ms
memory: 5632kb
input:
500 32 17 13 9 5 21 1 25 1 1 29 1 21 29 1 21 25 25 29 1 9 13 17 5 13 1 25 5 21 21 17 9 1 5 1 1 25 29 9 5 29 29 13 1 29 21 21 1 29 25 9 21 21 17 25 17 5 1 1 5 21 5 5 25 17 25 25 9 13 25 21 9 21 21 9 9 1 13 9 25 29 25 9 21 21 25 5 29 1 29 25 9 17 25 25 9 25 13 25 9 21 17 29 13 29 29 25 17 1 1 1 9 21 2...
output:
16
result:
ok single line: '16'
Test #12:
score: 0
Accepted
time: 112ms
memory: 7792kb
input:
500 32768 9545 1197 26861 23673 24409 22065 17525 25445 30857 29705 5745 24065 9897 23061 3577 2625 9869 12189 17869 16497 12053 24269 8285 8085 12849 1637 12569 30257 7409 21169 9069 18361 22817 12665 20565 29273 29869 30697 21989 20621 19689 17677 16109 11573 32177 453 11845 16357 6445 20269 7169 ...
output:
-1
result:
ok single line: '-1'
Test #13:
score: 0
Accepted
time: 60ms
memory: 5644kb
input:
500 4 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 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
result:
ok single line: '2'
Test #14:
score: 0
Accepted
time: 88ms
memory: 6840kb
input:
500 4096 3557 2189 3205 2801 853 2977 817 2025 1737 3853 1149 1045 1293 61 2093 3513 229 3921 2397 2949 2385 2953 117 3761 2065 2409 581 1505 3109 3469 1769 3453 1317 837 1033 3905 2329 2821 2441 3413 3525 777 1925 1213 2601 3877 305 3825 3537 761 821 2285 357 525 821 309 2989 3745 1221 497 193 3997...
output:
209738
result:
ok single line: '209738'
Test #15:
score: 0
Accepted
time: 74ms
memory: 5952kb
input:
500 512 249 333 157 77 173 109 25 437 273 101 93 301 73 309 13 337 429 381 137 121 213 345 53 265 461 477 489 317 21 257 505 409 77 385 121 465 141 265 137 357 29 329 21 265 465 361 501 341 57 229 29 349 225 173 9 197 377 133 385 449 133 21 441 125 117 353 49 397 205 21 5 137 153 245 337 285 37 405 ...
output:
714
result:
ok single line: '714'
Test #16:
score: 0
Accepted
time: 98ms
memory: 5496kb
input:
500 64 61 49 41 5 61 21 25 45 41 33 53 21 37 57 53 57 33 57 9 25 1 53 45 29 61 49 5 21 61 9 21 13 45 29 21 53 9 25 45 49 41 21 49 29 1 9 29 21 61 9 57 33 21 49 5 41 49 45 1 49 17 57 9 57 1 13 1 61 9 17 53 41 21 1 9 61 17 33 57 37 45 17 57 29 17 37 29 1 29 1 1 45 29 53 21 61 53 33 61 41 29 61 5 21 13...
output:
32
result:
ok single line: '32'
Test #17:
score: 0
Accepted
time: 118ms
memory: 9004kb
input:
500 65536 23361 37933 55817 10061 43973 25665 17525 4621 40645 24085 48017 50157 53701 37909 49041 63393 49653 35537 43117 60469 14997 33845 6521 51081 45565 54893 39665 8449 10273 55373 59773 25665 15061 47757 3589 921 26833 60445 38025 8513 28529 3717 44561 19573 29469 44073 54493 44517 11293 4984...
output:
-1
result:
ok single line: '-1'
Test #18:
score: 0
Accepted
time: 70ms
memory: 5360kb
input:
500 8 5 1 1 5 1 5 5 1 5 5 1 5 5 1 1 1 5 1 1 1 5 5 1 1 5 5 5 5 1 5 1 1 5 1 5 1 1 5 1 1 5 1 5 5 5 1 1 1 5 1 1 5 1 5 1 1 5 5 5 1 1 5 5 5 1 1 1 5 1 1 1 1 5 5 1 5 1 1 1 1 1 5 5 5 5 1 1 1 1 1 1 1 5 1 5 1 1 5 5 5 5 5 5 1 5 1 1 1 1 5 5 1 5 1 1 5 1 1 1 5 5 5 5 1 5 5 1 5 1 1 1 5 1 1 1 1 1 5 1 1 1 5 1 1 5 5 1 ...
output:
4
result:
ok single line: '4'
Test #19:
score: 0
Accepted
time: 76ms
memory: 7044kb
input:
500 8192 7217 4649 7677 5741 5973 3873 621 5957 6481 1081 4333 1337 5717 3645 673 2805 7813 4601 3921 589 5573 3441 7169 401 8101 7949 2249 5741 6705 7137 6141 3133 1485 2081 6325 1265 405 3449 2025 305 353 6109 2373 5017 7129 1809 4837 4669 8025 8017 3417 6101 2157 945 1925 6769 1161 4277 2557 1893...
output:
1506618
result:
ok single line: '1506618'
Test #20:
score: 0
Accepted
time: 81ms
memory: 5816kb
input:
500 2009 978 376 1943 1039 503 1232 1272 483 1860 1927 6 1930 617 1123 518 1899 350 623 247 603 1214 1303 1090 1469 306 1840 884 1254 260 557 197 1675 91 994 409 1798 355 1717 1326 705 823 1164 59 1385 1101 165 1755 1884 1363 1988 709 1691 919 373 795 821 651 1118 187 49 175 353 1330 1735 88 1874 20...
output:
2106
result:
ok single line: '2106'
Test #21:
score: 0
Accepted
time: 70ms
memory: 5576kb
input:
500 1015 91 543 231 1007 805 853 482 374 967 448 772 720 7 259 59 605 696 33 525 101 740 267 813 811 687 613 1002 527 480 412 416 368 227 394 593 878 424 611 555 981 766 145 17 47 257 340 521 456 807 706 458 860 428 125 914 973 894 87 963 949 547 615 864 301 273 793 1014 906 732 167 511 474 635 1 52...
output:
1083
result:
ok single line: '1083'
Test #22:
score: 0
Accepted
time: 80ms
memory: 6940kb
input:
500 1015 817 874 531 109 764 423 845 529 291 309 685 389 960 253 243 809 843 259 768 709 457 237 634 193 487 666 866 983 491 111 648 269 297 185 1011 145 233 624 551 931 587 911 783 391 717 221 670 954 815 413 870 766 827 987 495 333 445 121 281 489 403 11 833 683 599 127 161 974 115 271 463 640 711...
output:
2118
result:
ok single line: '2118'
Test #23:
score: 0
Accepted
time: 87ms
memory: 5772kb
input:
500 3973 2471 3538 2350 2700 3739 2641 586 1031 1668 3063 1918 3177 3097 473 1956 2443 1493 3674 266 720 158 2639 2118 3789 2924 2520 1909 2610 812 1825 2452 2196 2513 3960 747 788 2812 828 925 3313 360 640 2430 3767 3525 761 2394 3203 1966 2145 2669 2565 2323 3088 2392 1498 1770 1356 1804 3948 2051...
output:
10621
result:
ok single line: '10621'
Test #24:
score: 0
Accepted
time: 2ms
memory: 3712kb
input:
10 5 5 1 3 4 2 4 2 1 2 1 4 5 3 4 1 5 3 1 1 4 4 2 4 1 5 4 5 2 4 1 5 2 1 5 5 3 5 2 3 2 5 5 2 3 2 3 1 5 5 5 3 4 2 4 2 2 4 4 2 3 1 5 1 1 2 5 4 1 5 3 2 2 4 1 2 5 1 4 3 5 5 3 2 1 4 3 5 2 3 1 3 4 2 5 2 5 3 4 4 2
output:
0
result:
ok single line: '0'
Test #25:
score: 0
Accepted
time: 2ms
memory: 3716kb
input:
10 30 18 13 30 15 18 16 14 1 5 5 17 18 7 30 14 30 13 14 1 28 28 24 7 23 9 10 5 12 21 6 11 16 6 2 27 14 1 26 7 21 16 2 9 26 6 24 22 12 8 16 17 28 29 19 4 6 21 19 6 22 11 27 11 26 13 23 10 3 18 6 14 19 9 8 17 6 16 22 24 1 12 19 10 21 1 8 20 24 29 21 21 29 1 23 23 24 6 20 25 17
output:
19
result:
ok single line: '19'
Test #26:
score: 0
Accepted
time: 2ms
memory: 3680kb
input:
50 10 1 5 5 4 3 6 9 6 4 4 2 8 2 9 4 4 5 2 8 6 9 4 3 9 9 3 4 9 3 9 2 9 8 8 5 9 9 6 9 7 6 7 9 3 7 8 9 3 8 2 6 7 7 3 8 6 3 7 2 3 5 4 8 2 5 3 3 5 3 9 6 2 7 2 2 8 6 7 9 8 5 2 4 9 8 6 8 8 4 3 8 4 8 5 4 5 4 8 3 4 6 8 4 9 2 6 5 9 7 7 2 3 9 8 5 3 2 4 2 3 9 6 7 4 9 4 2 2 2 4 7 4 2 2 8 6 9 3 9 2 2 9 2 9 4 4 8 ...
output:
0
result:
ok single line: '0'
Test #27:
score: 0
Accepted
time: 2ms
memory: 3704kb
input:
50 4 1 3 2 3 3 3 2 2 3 3 2 3 2 2 3 3 3 2 3 3 2 2 3 2 3 3 3 3 3 2 2 2 3 2 2 3 2 2 2 2 2 2 2 3 3 2 3 2 2 3 3 3 2 2 3 3 2 2 3 2 2 3 3 3 3 2 3 3 2 3 2 2 2 3 2 2 3 3 2 3 3 2 3 3 2 3 3 2 3 3 3 2 2 3 2 3 3 3 2 2 3 2 3 3 2 2 2 2 3 3 3 2 2 2 3 3 3 3 2 2 3 2 3 3 3 3 3 2 3 3 2 3 3 3 2 2 2 3 2 2 2 2 3 2 3 2 3 3...
output:
0
result:
ok single line: '0'
Test #28:
score: 0
Accepted
time: 3ms
memory: 3768kb
input:
50 2500 658 2195 1188 410 197 1347 17 1507 1003 329 217 85 1211 1208 2038 2407 662 800 590 796 40 519 697 750 1344 413 280 2360 2406 1838 1235 557 2455 2199 875 912 1511 1615 605 1272 422 88 1127 393 787 216 693 48 1193 399 1153 416 330 983 632 1692 1232 2355 1371 2409 768 1978 1693 1277 2307 684 20...
output:
410965
result:
ok single line: '410965'
Test #29:
score: 0
Accepted
time: 3ms
memory: 3752kb
input:
50 2500 2068 850 1064 560 149 2440 1103 854 2124 192 1367 770 1373 1559 1154 1779 276 609 570 1911 188 670 18 280 1340 1079 2194 51 284 698 1659 378 1039 1107 2442 1613 1467 1860 382 823 1401 1080 1354 979 1537 2265 1432 1018 1983 1055 1462 2028 1648 2121 432 667 582 450 2029 391 101 1022 817 494 19...
output:
410737
result:
ok single line: '410737'
Test #30:
score: 0
Accepted
time: 2ms
memory: 3688kb
input:
50 2500 1591 1542 1784 570 1773 1755 823 2464 1782 984 671 1155 732 616 627 727 860 918 1491 2430 1457 942 1636 1651 1112 85 983 118 1290 1536 832 946 1454 1221 1499 279 2059 791 1304 1260 2478 223 512 89 1580 1396 923 470 478 2046 1412 1219 2331 1970 654 297 1975 1451 2369 2366 383 1646 162 576 150...
output:
428803
result:
ok single line: '428803'
Test #31:
score: 0
Accepted
time: 3ms
memory: 3780kb
input:
50 2500 1063 1204 2248 1008 343 425 290 2179 931 32 789 1352 1704 1599 1052 922 258 1730 356 1070 454 1416 1979 1603 2015 340 1818 2186 894 216 657 1049 786 445 1890 1759 886 438 196 1662 1213 1641 544 1680 1592 1653 42 1258 2074 656 1957 2206 791 1426 1490 480 885 181 349 144 398 1651 968 1337 1154...
output:
411194
result:
ok single line: '411194'
Test #32:
score: 0
Accepted
time: 2ms
memory: 3640kb
input:
50 2500 178 2289 1286 121 114 554 1982 488 767 1478 2009 213 1828 171 1260 839 791 267 2129 758 1664 1728 1676 2243 815 1571 1427 1494 185 1143 1304 2295 590 283 484 941 1167 175 91 1916 814 2045 1563 1347 2300 1323 1376 1526 408 251 2211 1542 1570 1172 1229 1532 1027 2425 1630 83 1016 1462 746 730 ...
output:
418509
result:
ok single line: '418509'
Test #33:
score: 0
Accepted
time: 2ms
memory: 3776kb
input:
50 50 31 6 11 14 10 17 50 45 22 47 23 32 41 35 36 5 4 31 43 11 11 5 13 21 46 45 31 44 32 20 46 39 12 27 34 41 14 7 18 1 32 41 19 12 30 28 1 15 26 50 29 15 10 48 29 3 7 33 28 23 46 46 21 33 49 18 7 37 3 45 27 19 7 38 23 50 16 34 6 28 17 22 31 5 11 9 45 3 11 29 17 42 45 42 34 27 10 17 42 47 50 36 38 1...
output:
0
result:
ok single line: '0'
Test #34:
score: 0
Accepted
time: 2ms
memory: 3756kb
input:
50 50 12 12 25 39 16 19 19 39 34 7 33 2 24 17 28 3 43 43 48 46 1 3 47 42 8 24 45 23 32 10 24 2 45 44 27 43 26 19 15 41 14 11 23 23 6 1 11 3 3 35 46 22 41 47 24 17 44 44 24 6 40 34 25 37 33 47 13 2 26 17 47 19 6 49 4 14 5 3 3 34 35 6 31 30 36 37 24 31 13 7 11 28 44 35 25 36 13 34 22 24 15 48 39 7 34 ...
output:
0
result:
ok single line: '0'
Test #35:
score: 0
Accepted
time: 3ms
memory: 3608kb
input:
50 50 4 30 7 8 2 23 9 40 2 40 25 1 5 3 40 18 30 27 36 36 44 44 5 44 43 49 31 39 3 38 3 2 9 47 35 45 33 27 30 38 32 45 3 41 11 38 17 25 25 35 45 46 15 36 32 13 18 7 39 48 12 5 8 49 36 47 10 25 3 47 30 7 35 15 28 19 18 28 42 28 32 29 36 43 33 3 43 22 12 42 20 23 15 48 38 39 8 8 14 32 9 19 12 47 10 38 ...
output:
0
result:
ok single line: '0'
Test #36:
score: 0
Accepted
time: 2ms
memory: 3592kb
input:
50 50 18 23 21 50 43 1 50 12 50 39 22 43 39 15 18 8 13 7 44 12 23 48 20 50 6 34 20 27 36 23 5 46 16 41 21 29 42 47 29 39 3 10 35 30 9 14 11 1 32 24 32 5 49 23 36 42 36 35 11 18 23 46 21 43 35 13 18 30 24 29 7 7 1 34 19 29 45 39 34 5 50 33 18 10 15 30 22 27 23 17 28 32 13 28 37 1 16 21 46 6 23 42 9 4...
output:
0
result:
ok single line: '0'
Test #37:
score: 0
Accepted
time: 0ms
memory: 3600kb
input:
50 50 48 46 4 12 5 36 28 37 45 11 45 13 35 16 11 33 46 7 45 12 44 1 23 46 28 44 25 12 42 39 35 47 34 36 5 9 39 24 9 23 48 4 15 9 3 40 8 5 29 17 22 42 36 38 49 21 26 31 20 26 30 24 19 2 21 7 31 29 47 48 50 35 48 34 15 44 2 45 34 7 9 1 9 16 40 47 40 40 21 3 47 8 35 1 13 1 45 27 40 1 35 7 31 4 18 24 33...
output:
0
result:
ok single line: '0'
Test #38:
score: 0
Accepted
time: 0ms
memory: 3632kb
input:
50 1000 52 304 227 956 240 789 132 949 678 887 136 435 439 725 114 631 696 141 588 571 107 387 654 713 494 288 531 581 258 182 548 828 145 600 791 548 181 550 504 354 313 141 994 291 719 13 289 522 238 101 167 136 588 601 642 178 16 963 391 724 389 112 845 28 796 641 168 481 561 369 88 41 407 967 62...
output:
-1
result:
ok single line: '-1'
Test #39:
score: 0
Accepted
time: 2ms
memory: 3712kb
input:
50 1000 574 825 901 39 741 62 744 642 782 960 452 740 687 785 589 175 92 892 969 74 840 328 438 301 195 99 814 547 624 427 433 886 266 488 70 260 898 397 749 310 1000 5 243 786 803 802 42 622 918 16 620 541 210 313 725 815 610 265 787 112 455 810 987 810 856 890 648 62 213 151 890 798 504 69 561 886...
output:
-1
result:
ok single line: '-1'
Test #40:
score: 0
Accepted
time: 2ms
memory: 3612kb
input:
50 1000 22 212 586 10 358 224 858 10 716 657 366 915 417 515 816 411 247 760 509 919 886 641 697 189 221 891 96 465 265 821 782 727 180 990 69 679 405 563 569 279 567 374 857 578 625 706 443 918 611 339 268 572 679 250 916 56 755 158 570 288 714 670 265 481 729 203 318 116 693 323 461 928 102 696 76...
output:
-1
result:
ok single line: '-1'
Test #41:
score: 0
Accepted
time: 0ms
memory: 3628kb
input:
50 1000 888 502 33 785 725 302 791 645 790 853 561 87 799 111 584 258 746 982 825 51 634 702 31 316 307 983 133 618 921 437 566 116 931 852 179 268 851 244 704 562 598 764 452 484 154 435 212 354 945 58 83 229 161 302 887 712 877 737 354 118 731 208 779 19 722 31 602 887 368 80 693 837 350 450 425 8...
output:
-1
result:
ok single line: '-1'
Test #42:
score: 0
Accepted
time: 0ms
memory: 3708kb
input:
50 1000 695 898 4 396 546 342 260 882 34 602 537 409 117 191 517 262 821 401 44 825 983 295 378 782 465 410 548 250 136 398 644 243 259 327 987 73 752 77 482 640 769 927 481 583 819 422 371 323 498 928 268 381 28 189 481 138 81 6 210 937 115 889 630 895 104 193 67 614 553 323 591 420 143 659 481 864...
output:
-1
result:
ok single line: '-1'
Test #43:
score: 0
Accepted
time: 2ms
memory: 3644kb
input:
1 1 1
output:
0
result:
ok single line: '0'
Test #44:
score: 0
Accepted
time: 9ms
memory: 5368kb
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:
0
result:
ok single line: '0'
Test #45:
score: 0
Accepted
time: 38ms
memory: 5388kb
input:
500 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 ...
output:
0
result:
ok single line: '0'
Test #46:
score: 0
Accepted
time: 172ms
memory: 17324kb
input:
500 250000 94088 66489 73307 82543 55682 36310 204902 85295 139769 82318 185046 192957 92837 102910 30384 130886 121960 209436 43855 19501 74770 120273 49174 84973 182890 205751 38885 81721 42809 168941 207663 85303 247991 172520 74509 17076 57865 61658 5054 160101 113066 25220 85462 112232 79583 87...
output:
4164913714
result:
ok single line: '4164913714'