QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#346146 | #8126. Restorani | oscaryang | 50 | 264ms | 516156kb | C++20 | 3.3kb | 2024-03-07 21:16:07 | 2024-03-07 21:16:08 |
Judging History
answer
#include<bits/stdc++.h>
#define vc vector
#define pb push_back
#define pf push_front
#define pii pair<int, int>
#define mkp make_pair
#define rep(i, a, b) for(int i = (a); i <= (b); ++i)
#define lep(i, a, b) for(int i = (a); i >= (b); --i)
using namespace std;
inline int read() {
int x = 0, w = 0; char ch = getchar(); while(!isdigit(ch)) w |= (ch == '-'), ch = getchar();
while(isdigit(ch)) x = x * 10 + (ch ^ 48), ch = getchar(); return w ? -x : x;
}
const int N = 3e5 + 5;
int n, m, TIME, a[N], b[N], nxt[N << 1];
long long ans;
vc<int> G[N];
struct node {
int t; deque<pii> a;
inline void prework(int u, int v) {
a.clear();
if(!u && !v) t = 0;
if(u && !v) t = 1, a.pb(mkp(u, u));
if(!u && v) t = 2, a.pb(mkp(v + m, v + m));
if(u && v) t = 3, nxt[u] = v + m, a.pb(mkp(u, v + m));
}
} f[N];
inline void merge(int x, int y) {
if(f[x].t == 0) return f[x] = f[y], void();
if(f[y].t == 0) return ;
if(f[x].t == 3 && f[y].t == 3) {
auto [l1, r1] = f[x].a.front();
auto [l2, r2] = f[y].a.front();
nxt[r1] = l2;
f[x].a.pop_front(); f[x].a.pf(mkp(l1, r2));
return ;
}
if(f[x].t == 3 || f[y].t == 3) {
if(f[x].t == 3) swap(f[x], f[y]);
if(f[x].t == 1) {
auto [l1, r1] = f[y].a.front();
auto [l2, r2] = f[x].a.front();
nxt[r1] = l2;
f[x].a.pop_front(); f[x].a.pf(mkp(l1, r2));
}
else {
auto [l1, r1] = f[x].a.back();
auto [l2, r2] = f[y].a.front();
nxt[r1] = l2;
f[x].a.pop_back(); f[x].a.pb(mkp(l1, r2));
}
return ;
}
if(f[x].t != f[y].t) {
if(f[x].t == 2) swap(f[x], f[y]);
vc<pii> cur; int len, fl = 0;
if(f[x].a.size() >= f[y].a.size()) {
while(!f[y].a.empty()) {
++TIME;
cur.pb(f[x].a.front()); f[x].a.pop_front();
cur.pb(f[y].a.front()); f[y].a.pop_front();
}
if(!f[x].a.empty()) cur.pb(f[x].a.front()), f[x].a.pop_front(), fl = 1;
len = cur.size();
rep(i, 0, len - 2) nxt[cur[i].second] = cur[i + 1].first;
f[x].t = fl ? 1 : 3; f[x].a.pf(mkp(cur[0].first, cur.back().second));
}
else {
while(!f[x].a.empty()) {
++TIME;
cur.pb(f[y].a.back()); f[y].a.pop_back();
cur.pb(f[x].a.back()); f[x].a.pop_back();
}
cur.pb(f[y].a.back()); f[y].a.pop_back();
reverse(cur.begin(), cur.end());
len = cur.size();
rep(i, 0, len - 2) nxt[cur[i].second] = cur[i + 1].first;
f[x] = f[y]; f[x].a.pb(mkp(cur[0].first, cur.back().second));
}
}
else {
if(f[x].a.size() < f[y].a.size()) swap(f[x], f[y]);
while(!f[y].a.empty()) ++TIME, f[x].a.pb(f[y].a.front()), f[y].a.pop_front();
}
}
inline void dfs1(int x, int fa) {
f[x].prework(a[x], b[x]);
for(auto y : G[x]) if(y != fa)
dfs1(y, x), merge(x, y), f[y].a.shrink_to_fit();
}
inline void dfs2(int x, int fa) {
a[x] = a[x] > 0; b[x] = b[x] > 0;
for(auto y : G[x]) if(y != fa) {
dfs2(y, x); a[x] += a[y]; b[x] += b[y];
if(a[y] || b[y]) ans += 2 * max(1, abs(a[y] - b[y]));
}
}
signed main() {
n = read(); m = read();
rep(i, 1, m) a[read()] = i;
rep(i, 1, m) b[read()] = i;
for(int i = 1, u, v; i < n; i++)
u = read(), v = read(), G[u].pb(v), G[v].pb(u);
dfs1(1, 0);
dfs2(1, 0);
cout << ans << endl;
for(int x = f[1].a.front().first; x; x = nxt[x]) printf("%d ", x <= m ? x : x - m);
putchar(10);
return 0;
}
詳細信息
Subtask #1:
score: 20
Accepted
Test #1:
score: 20
Accepted
time: 29ms
memory: 215000kb
input:
1 1 1 1
output:
0 1 1
result:
ok
Test #2:
score: 20
Accepted
time: 31ms
memory: 215188kb
input:
5 3 3 1 2 4 2 1 1 2 2 3 3 4 4 5
output:
6 2 3 3 2 1 1
result:
ok
Test #3:
score: 20
Accepted
time: 23ms
memory: 214044kb
input:
4999 10 4738 1635 1963 2369 3205 2391 4217 3652 4299 4715 4453 194 1247 3569 2163 1817 1130 2997 1111 3271 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 13 13 14 14 15 15 16 16 17 17 18 18 19 19 20 20 21 21 22 22 23 23 24 24 25 25 26 26 27 27 28 28 29 29 30 30 31 31 32 32 33 33 34 34 35 35 36 ...
output:
22850 9 4 10 1 1 10 7 8 8 5 5 6 6 3 4 7 3 9 2 2
result:
ok
Test #4:
score: 20
Accepted
time: 38ms
memory: 215696kb
input:
5000 10 4081 160 1439 1557 2086 1753 2818 2417 4018 4079 4849 229 2458 4370 2939 2876 2221 3787 1463 3841 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 13 13 14 14 15 15 16 16 17 17 18 18 19 19 20 20 21 21 22 22 23 23 24 24 25 25 26 26 27 27 28 28 29 29 30 30 31 31 32 32 33 33 34 34 35 35 36 3...
output:
13114 2 2 3 9 4 5 6 8 10 4 1 1 9 10 7 6 8 3 5 7
result:
ok
Test #5:
score: 20
Accepted
time: 32ms
memory: 212572kb
input:
5000 10 4590 3895 443 784 1335 1588 2195 823 3582 4229 4075 251 629 447 3074 620 1529 3402 3985 3998 4693 4634 4084 286 1355 992 404 127 4126 2543 2267 1302 668 3003 3351 1077 3014 413 4529 1319 4467 100 860 619 4720 2695 3412 2593 4511 1554 4210 727 3609 2670 478 136 4451 2437 2199 922 4588 1801 13...
output:
2090 10 1 4 9 7 6 2 2 9 5 1 7 5 3 6 4 8 10 3 8
result:
ok
Test #6:
score: 20
Accepted
time: 23ms
memory: 212600kb
input:
4 2 4 1 2 3 1 2 2 3 3 4
output:
6 2 1 1 2
result:
ok
Test #7:
score: 20
Accepted
time: 31ms
memory: 212208kb
input:
16 8 15 6 2 9 16 5 12 3 14 1 10 4 8 11 7 13 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 13 13 14 14 15 15 16
output:
34 8 4 6 7 2 5 4 3 1 1 5 8 7 6 3 2
result:
ok
Test #8:
score: 20
Accepted
time: 32ms
memory: 212052kb
input:
21 10 7 2 1 9 4 5 6 8 10 3 10 2 1 3 5 4 6 7 8 9 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 13 13 14 14 15 15 16 16 17 17 18 18 19 19 20 20 21
output:
18 3 3 2 2 10 4 5 6 6 5 7 7 1 8 8 9 4 10 9 1
result:
ok
Test #9:
score: 20
Accepted
time: 31ms
memory: 215560kb
input:
5000 10 2551 2546 2545 2553 2548 2549 2550 2552 2554 2547 110 102 101 103 105 104 106 107 108 109 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 13 13 14 14 15 15 16 16 17 17 18 18 19 19 20 20 21 21 22 22 23 23 24 24 25 25 26 26 27 27 28 28 29 29 30 30 31 31 32 32 33 33 34 34 35 35 36 36 37 37 ...
output:
49080 4 1 9 10 8 9 1 8 7 7 6 5 5 6 10 4 2 2 3 3
result:
ok
Test #10:
score: 20
Accepted
time: 20ms
memory: 215200kb
input:
2499 10 1118 1 615 88 284 552 268 862 2140 1050 2140 1 88 268 862 552 284 1118 615 1050 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 13 13 14 14 15 15 16 16 17 17 18 18 19 19 20 20 21 21 22 22 23 23 24 24 25 25 26 26 27 27 28 28 29 29 30 30 31 31 32 32 33 33 34 34 35 35 36 36 37 37 38 38 39 3...
output:
4278 2 2 4 3 7 4 5 7 6 6 3 9 8 5 10 10 1 8 9 1
result:
ok
Test #11:
score: 20
Accepted
time: 31ms
memory: 212640kb
input:
10 5 4 8 1 3 2 3 4 2 1 8 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10
output:
14 3 4 5 3 4 1 1 2 2 5
result:
ok
Test #12:
score: 20
Accepted
time: 40ms
memory: 212028kb
input:
10 3 6 9 1 9 1 4 10 9 3 2 5 2 6 2 9 2 9 1 9 7 9 8 9 4
output:
8 3 2 2 1 1 3
result:
ok
Test #13:
score: 20
Accepted
time: 27ms
memory: 213652kb
input:
17 1 5 3 16 4 5 2 16 7 16 10 14 2 16 3 8 7 15 9 17 2 16 1 16 2 16 12 16 15 16 13 16 11 13 6
output:
8 1 1
result:
ok
Test #14:
score: 20
Accepted
time: 36ms
memory: 212044kb
input:
157 2 94 79 27 4 150 114 36 150 122 93 80 126 122 134 81 20 150 28 137 109 65 99 150 48 100 36 61 7 97 51 52 46 153 124 21 140 107 79 24 6 63 96 62 53 82 63 73 19 56 5 154 129 114 74 64 26 81 15 95 63 150 141 73 17 103 40 98 80 76 145 46 26 78 40 11 155 86 138 75 23 121 91 123 91 92 57 56 13 133 57 ...
output:
32 2 1 1 2
result:
ok
Test #15:
score: 20
Accepted
time: 27ms
memory: 212880kb
input:
3872 9 2464 109 2649 3296 3698 1576 2921 2069 2627 3399 1773 2214 2313 2376 2692 2926 2776 3033 3849 209 2804 1184 2027 461 3241 1252 3384 1993 1699 253 2816 2064 2504 1607 3429 3280 476 621 3852 3039 2902 1939 3139 938 776 64 1611 410 3552 2247 3381 3277 1285 1513 2422 1325 2983 2554 3000 2380 1218...
output:
186 9 7 3 9 2 8 7 1 1 4 4 5 5 3 6 6 8 2
result:
ok
Test #16:
score: 20
Accepted
time: 32ms
memory: 213588kb
input:
4981 8 4646 4356 3057 1258 3188 3259 459 3590 4469 3207 3516 2277 1290 2167 3902 2370 4699 126 2246 796 2093 996 3291 4878 3346 1078 473 1354 4890 2675 1334 1122 2926 1119 2502 1697 3803 4568 4111 3095 888 110 2980 1057 8 1675 517 191 3194 2312 3737 806 3894 2470 4022 1535 4663 3091 4210 2785 2367 7...
output:
160 4 2 1 8 2 6 6 4 3 5 5 1 8 3 7 7
result:
ok
Test #17:
score: 20
Accepted
time: 31ms
memory: 213352kb
input:
5000 1 623 1961 4963 2290 1997 3588 3626 2518 2939 4767 4009 2239 4840 957 206 617 94 3838 1518 971 4885 4185 4195 364 2504 256 4556 99 2430 2189 4010 2480 2223 1842 4594 26 356 217 3945 3346 1181 1669 4752 4522 1766 1037 3419 2346 3633 3046 4681 1326 4131 1752 437 274 1734 781 4937 2526 4963 2397 4...
output:
28 1 1
result:
ok
Test #18:
score: 20
Accepted
time: 32ms
memory: 212904kb
input:
5000 2 623 1713 3501 2788 4977 4772 2473 2081 727 535 2201 111 4741 4478 4267 2126 4562 2478 1165 307 428 66 47 388 3235 1692 1156 1127 1869 1675 8 387 3338 3899 3547 4894 3398 2639 304 489 4920 279 1071 436 4099 3041 2450 1401 305 3071 2569 2387 3840 4238 886 448 3777 77 4946 4278 3634 1913 209 202...
output:
50 2 2 1 1
result:
ok
Test #19:
score: 20
Accepted
time: 32ms
memory: 212724kb
input:
5000 10 4458 613 623 797 4825 1713 873 1857 4164 1940 3781 2847 2353 991 4533 1225 3961 2517 597 942 4908 3994 1382 997 4164 616 4916 499 3302 3209 141 62 4542 201 2641 1984 4973 4760 3931 2032 1607 1311 4316 644 4318 1450 187 4 1885 801 4252 3412 4674 4534 1297 490 4304 1866 2967 1763 1845 755 1447...
output:
178 7 3 9 6 4 8 2 7 6 1 1 9 3 10 8 2 5 4 10 5
result:
ok
Test #20:
score: 20
Accepted
time: 24ms
memory: 213576kb
input:
5000 10 4270 3949 193 268 604 801 1699 327 3283 4255 4956 894 2985 1388 3112 2953 3033 3666 4473 4641 4705 2987 4102 658 1426 515 480 27 4138 1088 2346 2083 1381 3040 3361 1459 3048 2170 4540 189 4471 2267 893 47 4730 2712 3407 965 4518 63 4216 428 3616 230 543 405 4456 560 2278 771 4597 114 1423 38...
output:
4046 9 10 6 4 5 9 3 2 1 7 4 6 7 3 10 5 2 8 8 1
result:
ok
Test #21:
score: 20
Accepted
time: 20ms
memory: 212388kb
input:
5000 10 4378 3653 227 499 815 2076 3467 767 3608 3864 4588 195 1801 242 3577 428 2941 3995 4216 4325 4694 3315 4084 551 1449 1288 527 42 4126 1520 2342 1114 2260 3034 3366 3171 3047 1197 4528 2556 4458 3786 880 562 4722 2175 3425 1414 4506 335 4201 2145 3616 1158 576 362 4441 1677 2271 2181 4589 909...
output:
10900 7 9 6 2 1 10 4 4 5 3 3 5 8 6 2 7 9 8 10 1
result:
ok
Test #22:
score: 20
Accepted
time: 23ms
memory: 212880kb
input:
17 2 16 1 13 6 16 4 16 2 16 10 14 2 17 2 13 6 16 11 16 13 15 9 16 3 16 7 16 12 8 7 16 1 16 15 5 2
output:
8 2 1 1 2
result:
ok
Test #23:
score: 20
Accepted
time: 27ms
memory: 213584kb
input:
2817 9 2520 627 676 851 2657 954 1659 1804 1448 2576 2688 569 280 1170 1575 1272 2015 2564 2798 2585 2600 1107 341 205 2760 2617 2655 1669 449 797 1354 1022 1122 913 2500 265 2604 1200 2707 2421 87 1945 753 51 1995 1091 1025 338 2341 360 2668 2353 1386 211 1545 1078 1669 364 2454 271 1497 217 2775 1...
output:
184 5 3 1 9 9 4 7 1 4 2 2 6 6 5 3 8 8 7
result:
ok
Test #24:
score: 20
Accepted
time: 23ms
memory: 212292kb
input:
5000 10 4696 3066 282 1979 3213 2755 1573 721 3015 4018 4778 1065 3485 1605 3591 3937 4930 1838 4399 2133 4875 4865 2597 2095 1997 9 3748 504 749 2204 657 204 1665 1657 4187 3867 4366 411 3170 1113 4443 1615 3968 686 4766 3242 3082 1755 4717 2760 3772 3450 4559 913 343 241 3874 3474 1242 975 4123 57...
output:
186 9 2 2 8 6 1 7 3 4 7 3 4 1 9 5 10 10 5 8 6
result:
ok
Test #25:
score: 20
Accepted
time: 36ms
memory: 213472kb
input:
5000 10 4469 4270 155 381 2901 3283 3397 2882 3866 4386 4103 461 513 462 521 464 519 1028 3103 4029 4698 654 4085 3723 1365 567 400 332 4126 2391 2255 1058 977 2980 3335 1373 2992 1323 4533 386 4472 2543 826 494 4725 397 3391 777 4515 3873 4207 4157 3595 1131 477 183 4454 1218 2195 520 4589 1144 136...
output:
5522 8 5 3 6 7 2 1 7 9 3 10 9 6 1 4 4 5 8 2 10
result:
ok
Test #26:
score: 20
Accepted
time: 27ms
memory: 213656kb
input:
6 6 6 1 2 3 4 5 5 1 4 2 6 3 6 1 3 1 6 2 6 5 6 4
output:
10 2 2 1 5 3 4 6 1 5 3 4 6
result:
ok
Test #27:
score: 20
Accepted
time: 23ms
memory: 212876kb
input:
4999 9 3758 758 3948 4035 1804 2407 2777 2213 1576 3948 2407 1804 1576 758 2213 2777 4035 3758 4977 1086 1501 170 4169 2804 1322 85 2634 4032 3869 3837 4977 4559 1839 549 3822 2185 3876 4059 2467 4331 3681 2582 3599 2808 3026 2896 3589 53 3793 1895 4702 1316 4469 3878 4270 1498 3946 2110 935 508 300...
output:
106 1 9 9 4 5 3 3 1 6 2 2 5 7 7 8 6 4 8
result:
ok
Test #28:
score: 20
Accepted
time: 39ms
memory: 212652kb
input:
16 8 6 1 10 14 13 15 7 8 4 16 2 3 12 5 9 11 15 13 3 2 5 1 12 3 8 6 9 8 7 5 10 1 16 2 6 11 16 10 14 13 11 7 14 12 15 4
output:
34 8 7 1 8 7 6 2 2 3 3 4 5 6 1 5 4
result:
ok
Test #29:
score: 20
Accepted
time: 28ms
memory: 215168kb
input:
2 1 2 1 2 1
output:
2 1 1
result:
ok
Test #30:
score: 20
Accepted
time: 31ms
memory: 212028kb
input:
1928 5 1317 1443 873 936 473 1053 1518 351 507 225 1916 1442 1438 29 1746 1556 1242 1095 1511 1122 1233 337 1089 1026 1132 842 1876 867 1386 1853 1373 285 1918 766 1688 1299 1915 1475 931 253 324 303 1824 800 1559 251 1384 693 773 354 1751 543 1158 992 103 449 1267 621 1877 175 1058 581 1717 596 963...
output:
614 4 5 1 3 5 4 2 2 3 1
result:
ok
Test #31:
score: 20
Accepted
time: 28ms
memory: 213952kb
input:
4921 9 3402 499 3710 4889 2086 3001 4750 2222 1535 3626 810 442 3684 3362 2926 2863 3267 3462 4778 1244 1810 1724 3394 2453 4798 3784 1387 2916 3507 3347 3761 2062 3004 1299 3470 3015 4827 4008 4768 3153 1507 1051 4439 917 1160 540 4365 1779 330 136 3657 2683 390 124 4615 1969 809 126 4197 2083 395 ...
output:
7368 9 4 7 8 5 5 2 2 3 7 1 3 6 6 4 9 8 1
result:
ok
Test #32:
score: 20
Accepted
time: 42ms
memory: 212864kb
input:
5000 10 4458 613 623 797 4825 1713 873 1857 4164 1940 3781 2847 2353 991 4533 1225 3961 2517 597 942 4858 2141 1343 887 4081 3933 4867 1056 3171 476 125 17 4464 2238 2575 2149 4925 2990 3801 633 1593 460 4229 3141 4231 3946 147 59 1850 653 4170 835 4610 1529 1289 893 4214 3386 2857 2600 1821 884 141...
output:
4884 10 9 5 1 3 10 6 7 4 3 9 6 8 4 1 8 7 5 2 2
result:
ok
Test #33:
score: 20
Accepted
time: 36ms
memory: 212192kb
input:
5000 10 4458 613 623 797 4825 1713 873 1857 4164 1940 3781 2847 2353 991 4533 1225 3961 2517 597 942 4857 2124 1288 1000 4098 2018 4865 2522 3146 614 74 67 4483 3738 2543 1622 4926 708 3819 1792 1530 413 4258 1384 4260 3312 90 72 1838 1482 4189 2936 4623 4605 1203 485 4245 3737 2825 1407 1811 1527 1...
output:
1594 7 5 2 2 8 4 10 9 5 1 9 3 4 6 6 7 3 10 1 8
result:
ok
Test #34:
score: 20
Accepted
time: 24ms
memory: 212096kb
input:
5000 10 4458 613 623 797 4825 1713 873 1857 4164 1940 3781 2847 2353 991 4533 1225 3961 2517 597 942 4868 3203 1339 1302 4077 68 4877 3162 3153 399 153 51 4467 3130 2582 538 4937 675 3782 2312 1574 789 4234 2663 4238 217 235 63 1863 1525 4163 1580 4618 3013 1272 40 4216 426 2850 2524 1831 687 1405 1...
output:
862 5 1 8 4 7 10 3 9 9 3 6 6 4 7 10 5 1 8 2 2
result:
ok
Test #35:
score: 20
Accepted
time: 20ms
memory: 212852kb
input:
5000 10 4345 3623 1251 1656 2486 2840 3301 2372 3310 4183 4663 5 598 196 1996 528 1900 2403 2506 3928 4701 3003 4102 369 1428 191 502 491 4145 1808 2320 1721 2931 3037 3384 2812 3047 1197 4536 233 4475 1909 952 839 4726 30 3435 1646 4516 2686 4220 2321 3623 2372 566 285 4460 4452 2256 1162 4595 2592...
output:
18250 6 2 1 6 5 4 9 10 8 5 2 1 3 8 4 7 7 3 10 9
result:
ok
Subtask #2:
score: 0
Time Limit Exceeded
Test #36:
score: 20
Accepted
time: 228ms
memory: 516156kb
input:
300000 100000 109370 205978 224742 196992 72895 175835 177858 199406 235175 124763 18605 240852 170753 234091 260042 224910 164378 18209 253733 55514 99033 39740 131545 58235 237944 168314 28570 283886 209944 126973 228465 187033 94132 153369 248330 47334 58875 113999 224027 260133 131708 288915 269...
output:
116515888 56529 80260 84431 80051 68302 98933 4923 45732 84291 80898 30687 6262 85938 39889 69332 24967 32181 47117 51154 89788 20730 96799 41525 22566 68701 7790 54010 34001 21616 85791 32229 2701 35918 54386 61444 30949 90160 1367 95808 87190 76239 93112 31393 32614 76392 81136 75237 63829 18654 6...
result:
ok
Test #37:
score: 20
Accepted
time: 160ms
memory: 323464kb
input:
300000 100000 78104 59245 233648 165428 2192 22736 35858 194280 105542 298270 295983 171397 287383 48744 94371 247725 17240 284014 145716 241255 277268 20241 163824 66458 174400 258032 60761 219926 78082 47269 221147 214615 112035 56330 121572 130231 293390 87157 279843 70509 120469 276044 168463 11...
output:
60815296 65437 70634 28541 13690 3395 10364 17470 12897 48554 18141 2521 89983 79601 14653 82573 20194 36272 98357 99889 53493 82103 98949 20565 21461 16457 8395 77634 36039 4662 46984 35706 40491 59609 4407 60729 94328 24305 64617 38149 76759 55369 29669 14584 82455 73463 48214 88070 73823 83496 57...
result:
ok
Test #38:
score: 20
Accepted
time: 155ms
memory: 357836kb
input:
300000 100000 292448 199070 173170 54188 171603 295091 38523 173211 224713 165318 30005 60643 127072 258304 250302 283513 35517 217817 290506 216778 1255 205914 186772 139356 148655 187145 80717 103726 211824 88045 50341 13888 88321 227387 296719 25255 216481 90974 128822 17972 15248 175704 69082 29...
output:
79323292 16463 63482 80955 18225 25233 80731 57636 58082 42694 57971 60257 73123 24741 29106 97610 85345 29180 28732 77225 17608 50024 92014 53535 98964 97847 30505 73955 60664 31332 57108 37181 53198 89613 88789 38378 36492 78831 47539 5839 37802 75784 68025 14126 42698 64207 71886 18663 11533 9376...
result:
ok
Test #39:
score: 20
Accepted
time: 159ms
memory: 344384kb
input:
300000 100000 259894 108202 69889 156488 107893 273991 7023 126629 242999 178147 38293 260264 194747 93963 204043 31882 175838 5540 244773 60866 26150 285324 92140 136508 269884 111077 58827 174985 131142 178166 177887 121395 266396 270678 182021 50518 68471 141240 105740 17598 24467 89133 70300 128...
output:
53630140 73081 96416 3455 19992 20751 26422 74688 94178 12356 73827 52675 74601 33867 97568 15140 16629 33455 53331 26539 8891 46050 94842 6750 71180 94522 60834 90255 9339 54890 5706 91356 90140 56697 59079 29068 51053 71326 814 33010 57103 45571 8735 25402 49251 32496 61608 65002 41032 97356 53325...
result:
ok
Test #40:
score: 20
Accepted
time: 205ms
memory: 481120kb
input:
300000 100000 7275 5342 274978 143716 204803 61205 82668 221004 90828 15162 274350 209209 18338 155618 123101 126471 44381 31238 22868 103631 291741 76537 279513 258654 277609 34276 169274 45557 198440 212996 124022 250995 152741 3471 15762 37427 48552 174743 283593 239418 87624 172390 262470 45847 ...
output:
103873560 27855 39416 82550 39438 36791 70067 37218 20167 50735 83513 95832 46687 90354 17384 90804 93505 70136 62903 65936 8552 22161 62021 62462 82328 8401 59230 30794 3975 64675 17739 6225 88773 52246 87656 73932 3254 57421 4295 67619 76884 83839 23141 60499 63608 36211 96296 26297 7493 67993 772...
result:
ok
Test #41:
score: 20
Accepted
time: 203ms
memory: 451036kb
input:
300000 100000 132157 51421 83351 201059 182309 166105 191875 91992 50161 174086 150630 290244 22984 129110 126308 237286 266969 218298 37613 210468 4409 93720 105737 185847 129292 258583 4490 151679 31999 3441 289387 29592 272057 80780 13529 71072 181907 189929 269145 80825 155396 191507 298255 2548...
output:
132658800 41357 42211 16308 98508 37672 74770 24829 48330 82732 27402 93234 72198 97206 30051 11705 52144 31254 94837 80513 8205 14094 13944 69367 51858 71395 69887 52222 36212 63498 83044 67739 65870 89854 10617 79361 66885 97545 4473 30458 40640 35792 34881 83190 23044 73461 68465 98738 93851 9044...
result:
ok
Test #42:
score: 0
Time Limit Exceeded
input:
300000 100000 14703 321 148729 6226 112820 402 106053 7051 52501 58958 91203 28729 31077 107202 47610 18416 115995 3370 42803 70206 110257 145766 17703 66220 76615 36147 70751 116484 41199 34916 95432 149021 59011 144333 136468 119765 72781 79257 30022 1608 125792 74377 132544 128572 74955 65003 104...
output:
result:
Subtask #3:
score: 30
Accepted
Test #46:
score: 30
Accepted
time: 32ms
memory: 213188kb
input:
5000 2000 4078 2691 3285 4560 722 2633 1060 29 771 12 1702 164 4924 4572 906 2334 2800 3353 610 3939 4869 2690 3185 2079 2738 199 1926 2000 4985 39 1504 7 1350 3735 4371 1992 4196 555 393 2320 2194 114 831 28 424 1355 2010 3279 4932 3450 4345 4991 2758 96 2884 4840 1778 92 1691 256 666 792 3757 1986...
output:
157268 1714 38 462 198 1086 1927 1995 1118 1585 1333 1166 20 32 334 555 12 907 266 1823 1139 10 1602 206 300 244 1897 488 519 1482 646 1790 80 44 1294 8 1685 210 879 382 1818 1432 1148 296 138 928 74 479 119 279 1669 158 1226 979 1472 548 543 58 39 74 60 54 597 902 204 722 10 798 150 338 1823 1534 1...
result:
ok
Test #47:
score: 30
Accepted
time: 36ms
memory: 213296kb
input:
5000 2500 4860 5 830 1667 4815 1635 148 3 3327 2724 4663 3000 2905 176 29 4713 3719 2445 1867 665 1179 713 1272 252 857 3049 3823 4941 2384 1777 4832 398 2959 812 3701 159 3093 263 4172 1131 2731 433 2969 53 4414 3341 1932 108 3549 3453 4990 1741 1605 10 3306 2450 4096 3164 2049 1439 4304 520 696 51...
output:
187990 714 2127 2021 1853 8 20 314 258 2 1388 2120 789 755 1773 1751 1616 902 446 54 126 437 1101 970 90 687 314 194 30 90 1054 1952 557 208 31 1313 2154 2323 248 1448 1315 2020 1742 1414 1624 1368 713 2309 129 538 1637 2219 1392 403 1414 967 750 70 1241 2432 274 146 2194 1860 2406 1488 1310 2171 14...
result:
ok
Test #48:
score: 30
Accepted
time: 23ms
memory: 212904kb
input:
768 384 714 341 550 49 696 1 339 335 604 399 488 91 710 499 659 117 688 513 684 265 608 645 346 353 71 167 118 225 620 53 371 293 255 543 429 235 478 25 498 461 709 72 9 250 203 529 656 147 411 6 505 408 15 35 195 224 127 222 54 193 660 18 283 755 56 711 145 599 557 385 208 437 648 107 420 211 484 1...
output:
2390 6 43 132 363 314 112 53 347 322 48 219 314 38 24 335 35 270 341 54 76 151 290 143 301 252 297 4 381 353 95 30 152 59 32 65 150 135 78 285 268 25 92 310 207 384 104 113 66 364 180 279 90 12 56 134 84 282 54 257 4 239 361 74 336 78 311 245 74 16 201 57 370 263 134 112 277 179 320 347 258 67 36 26...
result:
ok
Test #49:
score: 30
Accepted
time: 24ms
memory: 215188kb
input:
1792 896 1785 1442 532 1578 267 1140 1485 880 634 61 613 17 952 957 390 1005 1217 1550 1167 35 425 714 956 88 420 89 744 1732 1316 147 1087 547 1048 272 1574 25 1590 1359 382 800 1149 31 1253 395 628 1173 808 92 1416 1351 1226 139 1669 839 679 257 1533 1619 1194 570 1475 58 438 1608 703 1737 566 107...
output:
5902 146 615 258 299 729 850 680 2 12 130 36 896 42 140 632 883 498 662 877 641 208 735 883 247 72 146 62 784 134 182 216 818 413 779 628 149 26 50 670 727 569 502 713 54 454 204 663 259 433 256 322 859 236 413 607 15 488 264 527 444 52 643 178 436 30 892 230 270 162 523 432 208 84 293 695 122 882 1...
result:
ok
Test #50:
score: 30
Accepted
time: 42ms
memory: 215492kb
input:
4096 2048 3973 1 1666 3109 1877 3625 2118 1979 2968 3775 2607 3003 1564 1427 1368 2369 2190 1335 1591 24 2147 1883 1422 30 3200 736 3394 3007 3054 1441 3202 2603 1687 899 3321 129 2756 1237 1075 3073 1465 723 3061 293 128 2899 3139 3555 2765 2459 333 651 2053 2847 1837 2143 1244 83 1641 2379 1642 39...
output:
14186 2 548 252 149 1065 138 458 24 788 1110 1074 764 737 162 636 1587 1331 811 24 1801 1305 691 207 510 1658 977 1088 547 1798 1285 1635 52 1220 144 537 1263 2041 980 621 1751 114 1140 58 732 758 2 420 627 1042 1538 1234 2046 132 1885 513 615 134 2043 100 1966 1998 678 36 172 422 363 702 387 462 16...
result:
ok
Test #51:
score: 30
Accepted
time: 45ms
memory: 213292kb
input:
5000 2500 4904 789 782 2415 4485 3389 4025 13 3774 3414 4459 1592 4290 1622 4903 1169 4845 3896 2258 467 3850 1180 1488 1200 4824 4428 2579 2543 2238 548 3214 182 4226 2995 3244 930 3142 3120 117 443 3161 456 1496 3217 1983 1218 221 1639 4069 928 1114 3667 1364 4576 3937 2162 2199 3087 4905 4466 314...
output:
536470 2181 69 623 705 2488 1274 2436 848 2327 208 2095 977 1016 713 2409 2334 583 1399 1894 1447 1105 594 1282 411 139 145 2069 1709 1075 37 1852 130 1253 2358 235 2114 2013 1485 2128 296 450 348 2242 1193 840 1957 724 1078 1043 2485 136 1008 1594 865 603 681 505 2427 1846 1279 150 442 1512 2058 22...
result:
ok
Test #52:
score: 30
Accepted
time: 48ms
memory: 216612kb
input:
5000 2300 2122 83 2044 425 278 1469 597 301 1767 454 1133 320 1724 32 2141 575 1094 355 661 747 1888 535 81 895 835 2233 1324 2111 2150 1599 1524 944 405 2061 444 817 2298 56 1271 873 938 2035 1480 1194 1880 679 876 1841 2124 66 149 1151 921 1343 1515 1209 1350 1847 293 923 1363 245 1142 1387 94 79 ...
output:
3739844 1353 220 1593 1017 746 1525 1740 2217 836 2051 668 596 2211 911 1471 1781 612 1273 14 1009 840 61 2148 418 587 1393 1518 1970 1940 1405 228 1411 1111 667 2267 619 1191 2268 2071 1021 1536 1801 1957 2266 1307 1 903 1653 318 1647 192 1821 403 1939 2131 1065 328 1729 1787 1400 110 1791 396 1779...
result:
ok
Test #53:
score: 30
Accepted
time: 19ms
memory: 214220kb
input:
5000 2500 4930 2499 4460 2841 2694 3885 3013 2717 4183 2870 3549 2736 4140 2448 4557 2991 3510 2771 3077 3163 4304 2951 2497 3311 3251 4649 3740 4527 4566 4015 3940 3360 2821 4477 2860 3233 4714 2472 3687 3289 3354 4451 3896 3610 4296 3095 3292 4257 4540 2482 2565 3567 3337 3759 3931 3625 3766 4263 ...
output:
2368930 1353 558 1593 2270 746 69 1740 973 836 1787 668 863 2327 1204 2404 1886 612 132 14 1044 840 1999 2148 1163 587 77 1518 938 1940 902 228 893 1111 646 2267 767 1191 885 2421 2211 1536 389 1957 2455 1307 2208 903 290 318 798 192 1995 403 1573 2131 204 328 1599 2442 1505 110 1148 396 1842 294 15...
result:
ok
Test #54:
score: 30
Accepted
time: 31ms
memory: 213368kb
input:
5000 2983 4252 1613 3574 1955 1808 2999 4454 1831 4480 4459 2663 1850 3254 1562 3671 2105 2624 1885 2191 2277 4395 2065 1611 2425 4210 3763 2854 3641 3680 3129 3054 2474 1935 3591 4476 2347 4421 1586 2801 2403 2468 3565 3010 2724 3410 2209 2406 3371 3654 1596 4418 2681 2451 2873 3045 2739 4260 3377 ...
output:
6670856 1353 2044 1593 1981 746 606 1740 1325 836 1375 2923 1061 2327 140 2404 2372 612 177 14 1466 840 790 2148 556 587 1551 1518 1994 1940 2513 228 666 1111 68 2684 1820 1191 1956 2560 1849 1536 341 1957 1524 2933 2770 903 267 2795 1841 192 329 2582 524 2543 1363 328 1462 2442 1628 110 1832 396 19...
result:
ok
Test #55:
score: 30
Accepted
time: 32ms
memory: 212716kb
input:
5000 1 1069 1069 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 13 13 14 14 15 15 16 16 17 17 18 18 19 19 20 20 21 21 22 22 23 23 24 24 25 25 26 26 27 27 28 28 29 29 30 30 31 31 32 32 33 33 34 34 35 35 36 36 37 37 38 38 39 39 40 40 41 41 42 42 43 43 44 44 45 45 46 46 47 47 48 48 49 49 50 50 51 ...
output:
2136 1 1
result:
ok
Test #56:
score: 30
Accepted
time: 45ms
memory: 212440kb
input:
5000 2 3970 1069 3970 1069 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 13 13 14 14 15 15 16 16 17 17 18 18 19 19 20 20 21 21 22 22 23 23 24 24 25 25 26 26 27 27 28 28 29 29 30 30 31 31 32 32 33 33 34 34 35 35 36 36 37 37 38 38 39 39 40 40 41 41 42 42 43 43 44 44 45 45 46 46 47 47 48 48 49 49...
output:
7938 2 2 1 1
result:
ok
Test #57:
score: 30
Accepted
time: 31ms
memory: 212828kb
input:
5000 7 4326 1069 2799 2836 1938 3733 3970 3733 1069 4326 2799 2836 3970 1938 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 13 13 14 14 15 15 16 16 17 17 18 18 19 19 20 20 21 21 22 22 23 23 24 24 25 25 26 26 27 27 28 28 29 29 30 30 31 31 32 32 33 33 34 34 35 35 36 36 37 37 38 38 39 39 40 40 41 ...
output:
8650 2 2 5 7 3 4 4 5 6 1 7 6 1 3
result:
ok
Test #58:
score: 30
Accepted
time: 43ms
memory: 215932kb
input:
5000 5000 4515 3663 433 838 3578 2695 87 3 1655 1357 4291 1493 1442 105 3550 2355 3554 1228 3846 347 602 375 3718 3013 2952 1510 3751 4679 1204 901 2415 211 2556 4947 3482 4411 4200 149 3211 573 3924 2557 3234 35 3868 3746 4950 4241 4426 1715 2494 2797 806 10 2976 2887 2636 1569 3508 733 3860 275 32...
output:
9998 714 3454 2540 3921 8 2913 314 2503 3663 4553 2120 1715 4312 284 4174 737 902 2048 54 2827 437 2799 4376 1464 687 2031 194 1108 90 2448 3632 1754 4712 4412 208 72 2191 2010 3857 4847 4224 124 84 3445 3018 1190 1284 4297 3550 1446 2537 3035 1334 30 3394 3397 353 3673 1850 1670 851 2598 404 1998 4...
result:
ok
Test #59:
score: 30
Accepted
time: 39ms
memory: 212516kb
input:
5000 1 646 3293 4917 3679 2508 3024 2386 324 4051 248 2700 77 4812 964 3748 2267 2094 781 4378 2672 3461 3318 3563 1555 114 142 4506 3604 4962 4551 4047 1781 750 17 2438 863 1674 2638 4682 3804 4432 2651 4836 1606 4920 7 2065 3032 186 153 4660 522 4425 2053 3162 3141 2696 115 3599 1174 3596 276 3248...
output:
36 1 1
result:
ok
Test #60:
score: 30
Accepted
time: 43ms
memory: 213024kb
input:
5000 2500 4872 2598 2689 2 4901 5 4051 1628 2782 1479 4695 1090 674 4303 180 3977 3382 52 789 533 4897 4667 1659 16 1054 1101 4995 2967 1890 58 2296 669 3187 719 227 449 3621 797 2239 1152 3921 3216 420 2710 2616 1572 132 4762 2946 2701 548 1511 2704 403 4410 504 2952 4770 3962 688 1141 74 400 2386 ...
output:
11974 784 2126 2305 1133 1586 2241 1708 2284 1835 118 1461 876 1790 149 818 1307 1097 507 767 2416 1189 53 474 1656 2034 221 1865 912 1261 95 1262 1211 1367 237 1254 1713 1517 1881 2174 2187 982 337 1039 384 1903 1012 1148 2148 82 1384 2413 673 903 598 2315 2409 588 1413 2457 1351 510 1479 733 296 1...
result:
ok
Test #61:
score: 30
Accepted
time: 32ms
memory: 213040kb
input:
5000 4800 5000 28 4496 2208 1193 4359 2578 2446 1362 2916 1782 1496 4006 318 2592 2141 4049 1080 4765 690 3329 1330 597 3591 3821 394 4578 3057 1154 111 4823 26 4277 559 3545 612 4448 620 2752 3236 4576 23 3949 4036 3547 4295 4168 359 3344 669 555 518 3202 565 4465 4124 4686 3997 3919 1071 3861 302 ...
output:
10410 1753 662 1264 2938 1851 3326 2708 1345 421 834 3440 1058 3954 2341 3245 3148 1388 2764 2077 1840 4694 4232 220 1619 2293 2728 4503 3418 3012 4173 4275 2926 3932 1523 1160 701 1760 248 1081 4333 138 503 4653 3358 4383 1125 3889 2256 3166 3828 1588 3067 1466 1098 1123 3682 3213 4542 2378 4598 63...
result:
ok
Test #62:
score: 30
Accepted
time: 28ms
memory: 215180kb
input:
300 20 143 11 236 152 157 79 208 81 121 126 155 285 100 64 230 168 192 91 206 115 230 35 168 11 294 24 189 26 79 152 81 121 115 155 143 285 206 208 195 64 290 219 28 15 170 98 289 185 111 65 252 114 225 71 277 270 32 284 295 220 252 61 228 167 122 113 229 217 291 112 245 120 140 122 262 246 197 171 ...
output:
100 9 12 14 20 19 17 7 18 6 9 12 16 8 11 15 1 11 14 20 13 4 10 16 3 2 4 5 6 13 5 17 2 18 7 10 8 3 19 1 15
result:
ok
Test #63:
score: 30
Accepted
time: 27ms
memory: 212880kb
input:
5000 200 3632 745 4635 1739 1420 4926 3792 1165 3018 3708 3805 1693 2894 305 238 4625 2190 367 4618 1113 3692 4073 3252 79 1863 4243 4261 2444 2085 2650 3016 620 555 1374 997 810 514 872 2611 3283 4972 533 1595 402 4925 2982 3052 1099 3017 2002 4539 3415 4140 2847 3623 2690 2884 800 2724 765 4080 32...
output:
5330 77 47 12 181 153 200 134 11 135 101 13 111 175 63 65 138 7 17 36 185 81 148 195 87 53 28 34 46 108 167 189 147 23 74 174 54 112 135 188 127 105 57 26 52 17 77 114 132 168 195 73 130 82 81 139 34 88 123 24 90 128 94 25 64 4 76 119 61 30 14 10 45 68 56 155 75 102 15 157 103 167 171 45 26 66 192 2...
result:
ok
Test #64:
score: 30
Accepted
time: 27ms
memory: 212684kb
input:
5000 500 4858 236 1752 4854 3170 1856 3193 409 1118 2052 1396 3905 3924 2904 75 2718 2478 136 1714 3029 4235 1497 1138 53 3223 3456 4203 4634 739 986 1970 219 4897 479 319 2858 185 282 3596 2958 1873 191 3937 4426 1853 2595 1125 3144 3162 712 3126 4936 3366 1060 1274 1016 3572 3102 1024 263 3696 273...
output:
13750 210 300 403 481 185 273 221 253 309 76 492 456 76 141 409 286 295 338 37 262 424 278 82 457 197 344 199 393 378 216 490 168 427 366 138 196 162 68 120 425 42 248 274 244 246 447 114 290 13 113 262 390 397 270 476 451 227 356 105 406 497 334 313 133 439 212 245 492 447 382 415 70 77 296 81 11 1...
result:
ok
Test #65:
score: 30
Accepted
time: 35ms
memory: 212824kb
input:
5000 2500 4737 67 1096 4229 2229 390 4952 4689 2584 3283 3364 2827 2611 582 4981 4087 514 2019 4129 1284 4916 2514 1124 10 4582 735 867 1855 2153 224 3739 56 1250 1033 2125 1148 3820 1161 1262 1624 1540 47 2050 895 4755 2984 255 663 4241 1255 1026 963 4784 1042 4701 3118 2263 4381 1022 2006 2621 556...
output:
37588 285 2061 1881 167 1516 1810 1911 1357 1522 827 77 491 1855 488 1528 31 1206 927 567 494 2031 1268 2226 1398 229 1081 2458 297 729 849 1439 700 2161 2031 1602 344 628 798 1302 1590 270 1211 960 2097 1703 1474 415 509 1712 134 2398 524 37 593 486 2210 1101 837 1598 650 89 988 821 816 1385 1586 1...
result:
ok
Test #66:
score: 30
Accepted
time: 36ms
memory: 213752kb
input:
5000 4000 4967 39 692 2640 1408 244 3082 2924 1601 3505 2120 1767 4821 373 3101 2558 4871 1278 2580 807 4018 1569 703 4315 4595 463 3444 3685 1362 138 2355 36 3718 660 4264 722 2410 731 3297 3906 980 31 4749 4855 4267 4326 157 421 4035 783 656 609 3865 666 2927 4958 1425 4811 4711 1270 4638 354 2187...
output:
17378 84 944 291 803 375 2174 2738 753 318 2933 3956 3827 255 3288 73 373 2914 3295 3896 3630 1821 3598 2124 741 317 3709 1289 3071 3872 3205 1584 3203 1131 1727 449 3260 980 3839 1600 1841 893 1823 3533 1210 2143 1861 1800 3273 2743 1331 2593 1770 3502 3852 2307 3604 3352 1914 1555 3370 2085 1709 3...
result:
ok
Test #67:
score: 30
Accepted
time: 23ms
memory: 213900kb
input:
5000 2500 4873 112 1170 4116 458 2694 3225 4409 4269 4285 3404 4861 4577 1126 3937 3463 2983 4323 973 754 4612 119 4857 649 2730 3540 3303 1316 2827 24 3177 2709 101 1707 4789 414 2059 473 2288 352 4548 18 1433 4683 2912 4445 4113 46 4717 4829 3248 96 4316 140 3016 605 4786 1299 2088 4615 4138 3957 ...
output:
24774 1698 252 1399 727 193 1919 87 1518 2091 1988 1064 1745 1715 135 2013 1660 2486 1135 2427 1401 2117 1469 1940 376 1968 2283 570 574 589 294 773 2208 2043 1575 1871 2071 1607 534 1228 358 1291 750 77 1666 597 907 579 772 2011 856 2263 767 69 754 1100 2172 2346 899 1864 852 641 1607 1516 6 406 19...
result:
ok
Test #68:
score: 30
Accepted
time: 39ms
memory: 212508kb
input:
5000 1 2001 2001 4995 3908 4646 2424 4464 325 4005 1479 1106 275 2756 2376 4165 1181 4206 1148 3407 2915 1633 3415 3041 547 3660 3451 3533 2614 1805 1150 3269 1174 3063 2165 2866 1782 3428 602 1699 1136 1499 1396 4920 2518 4468 627 3658 2737 1395 641 4992 3534 1765 3987 2995 2593 1952 1888 4650 2292...
output:
32 1 1
result:
ok
Test #69:
score: 30
Accepted
time: 31ms
memory: 212084kb
input:
5000 2 3708 2001 3708 2001 4988 4442 3520 1148 2121 539 4986 621 1370 40 4189 843 4969 3600 2804 2660 3546 3634 4961 738 102 993 2855 643 1563 1161 4563 3581 3719 4800 4374 846 1325 892 868 516 2580 2391 2384 736 4738 1153 4842 3491 4891 4020 4419 2887 4421 1664 4178 364 4111 638 4729 1178 4190 1693...
output:
44 2 2 1 1
result:
ok
Test #70:
score: 30
Accepted
time: 35ms
memory: 212848kb
input:
5000 2432 4275 4508 2376 1154 2212 5 4234 2385 4426 2691 4422 86 4587 1975 1625 2322 3312 549 2912 4602 4615 1428 3306 8 2963 853 647 4044 501 1143 2170 3 4832 1163 1069 3563 2253 358 4529 879 4946 1363 3028 18 1424 966 736 3031 2416 92 3662 4730 202 218 3708 691 2539 953 3226 3537 3262 3756 3135 21...
output:
6660 94 47 706 1728 2344 2234 1158 1222 2286 289 807 66 2165 1861 969 476 2110 893 1961 328 600 2312 1518 734 2284 1470 2345 2071 629 605 687 139 178 1154 2046 1173 2402 2054 1152 1885 1283 2246 234 2051 1959 636 500 1806 1738 2128 307 1965 1421 2339 1893 790 79 671 272 1677 350 779 205 1450 124 668...
result:
ok
Test #71:
score: 30
Accepted
time: 28ms
memory: 212992kb
input:
5000 5000 4989 4247 3823 2958 224 1343 3263 3353 2126 2137 1685 2431 2276 559 1964 1716 1489 2152 488 377 4820 3837 2428 331 4974 2923 1634 657 4258 20 1583 1349 58 846 2389 3937 1019 233 1137 179 4060 4651 714 4936 4117 2207 3742 31 2354 2408 2867 55 2149 79 1501 3581 4579 646 3070 2297 3270 1979 3...
output:
9998 4114 1309 4672 4365 4314 4039 154 4314 4030 3290 4356 3470 3202 720 4415 101 4264 3468 3148 2177 890 1738 418 704 4775 3440 3187 2208 4216 4653 1856 4160 4388 1311 1957 4966 3383 3734 111 1699 4828 476 3487 1854 2903 2812 2657 4468 1255 3907 4540 3304 4097 1816 4003 4637 916 3221 1503 4663 4100...
result:
ok
Test #72:
score: 30
Accepted
time: 31ms
memory: 211968kb
input:
128 64 90 119 39 77 84 28 88 70 127 111 37 26 35 49 46 52 19 6 78 123 36 94 8 56 12 100 7 20 63 75 54 108 5 2 67 73 18 21 102 66 51 104 97 120 117 48 110 47 107 95 89 69 93 81 1 98 61 27 91 116 125 85 30 86 10 99 4 68 118 87 34 9 82 62 40 71 79 112 53 55 122 103 105 42 32 58 50 60 101 41 128 31 22 1...
output:
344 5 49 55 10 43 1 1 20 18 45 28 15 54 55 11 25 23 17 27 62 63 57 24 26 39 60 15 58 57 46 59 59 51 54 48 14 9 5 29 47 8 43 35 35 58 6 64 42 49 29 45 36 17 39 30 18 38 56 2 41 42 4 40 24 34 22 47 32 50 30 32 44 13 8 26 63 6 33 10 9 53 28 31 3 37 34 14 12 52 40 61 23 4 50 44 13 41 31 16 16 3 52 21 2 ...
result:
ok
Test #73:
score: 30
Accepted
time: 23ms
memory: 211932kb
input:
1792 896 387 884 1234 29 1049 730 1784 223 783 259 43 711 1066 1194 1408 1787 1777 965 1191 1530 982 546 620 1629 1562 1692 1668 343 1699 1719 1761 169 1245 1396 607 704 440 989 800 328 348 1734 1592 1520 600 1717 37 1263 1207 929 1422 1384 669 953 1095 1414 1624 1023 806 1032 970 663 1744 238 1466 ...
output:
5538 189 493 461 351 805 273 221 116 238 385 67 643 116 235 281 801 316 3 207 367 637 331 587 848 481 879 767 725 736 542 1 625 560 70 505 169 386 271 834 611 484 461 517 514 53 627 379 747 357 661 449 649 95 701 301 847 896 9 750 511 61 721 777 886 511 788 426 238 428 768 743 490 417 475 623 91 766...
result:
ok
Test #74:
score: 30
Accepted
time: 40ms
memory: 213520kb
input:
4096 2048 193 608 1843 3135 3869 894 8 2468 45 1994 2718 1048 1700 1687 2162 554 2385 573 1540 20 950 1643 624 303 3026 816 1939 577 951 3045 464 29 1663 2166 899 772 1997 2986 2273 2968 2546 1498 1794 120 1601 2274 2178 2730 1935 2894 3951 1178 2578 832 3716 2668 1169 393 1867 1258 628 3321 2789 27...
output:
12518 1329 1565 1921 1232 823 1877 71 203 811 979 1749 1099 12 1199 1981 1628 1365 1605 661 1160 486 1755 2015 698 1823 1687 1636 1081 2046 1262 1041 1625 1201 737 1184 1041 1121 1000 1394 114 1653 472 146 1595 721 1017 1564 1803 1930 1005 1450 736 30 825 1773 719 1870 315 1522 1925 1776 498 743 449...
result:
ok
Test #75:
score: 30
Accepted
time: 37ms
memory: 212704kb
input:
4018 1258 3745 1722 1721 3 3737 324 275 530 2987 3944 2774 14 2204 1687 332 1620 468 3383 2453 238 3596 807 375 722 2808 156 3471 252 3178 1753 2773 2138 1119 2111 3422 506 755 1461 2735 696 3750 93 1603 1650 3946 3232 116 2207 2267 1432 2897 3572 3066 1668 2420 315 2616 3931 521 1004 3132 183 860 3...
output:
7764 632 12 454 970 593 270 704 764 266 414 380 1095 793 953 705 242 1116 303 920 466 818 898 1009 1114 501 1254 842 890 1091 146 604 1148 1194 726 802 980 404 147 144 598 1182 900 521 1233 1126 130 1112 752 566 1184 1146 114 434 123 1188 1180 1165 343 393 330 909 692 17 594 659 1125 451 289 292 921...
result:
ok
Test #76:
score: 30
Accepted
time: 35ms
memory: 215184kb
input:
1181 667 1104 605 303 634 327 239 510 8 149 923 863 1143 809 295 170 668 739 61 1075 9 1001 202 842 287 525 331 48 1067 722 53 624 664 640 1085 666 141 588 962 4 1003 1136 1005 1171 1144 511 66 817 1032 667 128 1065 90 622 120 1080 370 520 194 172 815 419 47 152 452 359 356 183 259 1115 619 1048 348...
output:
2794 580 37 394 469 42 631 254 430 363 482 27 438 15 29 406 309 428 62 250 347 117 172 258 201 71 243 138 281 162 507 614 436 522 337 565 427 467 135 442 30 492 499 572 364 475 426 643 192 168 512 79 571 206 233 221 301 315 116 63 55 432 550 316 356 66 388 633 74 207 216 618 4 663 632 279 44 448 257...
result:
ok
Test #77:
score: 30
Accepted
time: 20ms
memory: 213588kb
input:
3001 2298 2996 1 2566 522 583 2502 1796 1175 2547 27 2134 31 628 1504 73 102 2762 209 1552 239 1503 2864 1294 667 1386 2433 579 1025 2771 2724 1836 1717 928 1744 1958 974 1845 20 2857 2085 1253 1274 603 313 1801 2119 2577 158 2814 10 282 1985 2963 433 1018 404 1137 485 2216 1157 1230 2284 125 2294 1...
output:
7116 2 1851 1946 1043 1249 1248 155 2101 647 500 233 533 2059 896 1307 1686 600 980 956 1753 2239 319 1787 37 400 516 352 1804 386 1463 1136 1993 270 168 1384 862 1189 1960 105 1245 691 557 989 826 1762 940 765 2268 1841 2002 733 443 379 507 2135 2227 154 771 1809 981 1423 172 385 1957 133 1906 856 ...
result:
ok
Test #78:
score: 30
Accepted
time: 39ms
memory: 213824kb
input:
2792 1545 2590 1177 1749 435 1163 555 1372 2630 1101 74 574 2065 560 2300 814 1558 1993 533 1716 1236 1378 289 612 242 2644 443 1665 1645 2263 4 1811 370 575 1560 827 1042 1531 538 308 2058 2595 32 1199 496 1005 1422 2145 1330 1891 1622 1318 573 2350 220 2150 2592 702 94 143 2338 2137 86 117 2080 26...
output:
6518 199 1189 614 814 602 1498 561 1063 272 750 666 1220 833 1216 851 1139 328 312 1365 311 922 1380 451 765 1416 327 393 628 1444 1338 975 196 667 1355 1369 1293 1217 542 377 112 999 1030 797 777 191 1244 657 1111 880 1163 1379 686 966 1144 1350 564 640 927 378 951 27 776 150 1168 1059 581 371 929 ...
result:
ok
Test #79:
score: 30
Accepted
time: 27ms
memory: 212104kb
input:
373 51 357 326 3 220 179 293 83 113 277 188 137 40 280 21 336 168 240 117 178 119 48 58 131 100 81 9 210 159 22 154 251 121 327 221 122 123 218 160 196 141 177 230 32 11 16 338 6 155 80 262 308 308 2 173 3 101 297 293 370 248 135 346 81 180 134 367 302 351 97 4 54 113 1 43 22 238 316 153 34 126 190 ...
output:
506 13 44 51 1 50 19 3 4 14 23 34 43 8 21 29 24 36 27 15 15 28 10 39 38 7 11 12 13 26 6 16 2 42 17 37 5 20 25 43 9 33 36 21 8 46 41 47 32 44 28 27 45 38 30 35 26 10 29 2 46 32 40 6 7 9 3 24 39 17 42 40 14 1 33 31 37 19 47 22 20 18 35 23 48 4 31 30 49 45 34 49 18 25 12 41 16 48 50 5 51 11 22
result:
ok
Test #80:
score: 30
Accepted
time: 24ms
memory: 215368kb
input:
1651 348 1460 745 170 147 955 509 569 597 1627 41 958 942 800 1632 811 58 1584 862 939 64 747 903 523 83 1348 28 108 1067 1192 1469 1424 1094 1305 1335 1535 750 1432 1076 232 389 947 196 1393 126 1500 440 116 54 1357 1230 1300 761 803 317 664 208 441 1108 34 618 1450 21 469 937 613 30 643 187 1599 8...
output:
2730 58 19 119 321 344 151 161 229 251 26 247 93 173 186 224 283 29 196 113 24 163 160 189 311 252 193 244 171 259 58 196 18 262 280 287 104 223 167 101 298 27 6 233 140 184 219 304 5 64 269 216 217 272 66 104 320 70 39 188 49 195 90 141 114 95 249 127 323 63 156 327 119 61 75 261 161 166 3 254 208 ...
result:
ok
Test #81:
score: 30
Accepted
time: 39ms
memory: 213280kb
input:
3198 2097 3098 1063 3067 148 1875 5 1669 996 1526 2326 946 581 1325 88 1424 1298 2160 1260 1989 1479 32 18 2134 20 2148 2445 338 2668 1602 579 1256 395 1123 28 412 2501 2460 1017 1317 187 1274 19 340 600 756 876 356 947 2559 813 1761 2121 3072 458 2376 647 742 3181 1280 454 3046 12 268 2194 1678 202...
output:
7756 270 1095 492 366 1366 839 258 1750 877 898 377 1148 715 1691 1398 1671 1234 847 902 2090 1237 910 1885 320 884 142 404 42 993 1244 1129 1007 564 1850 56 1224 1451 437 1771 915 1109 1877 557 866 1911 1854 1883 1106 244 1360 1455 846 526 1135 1539 1817 1282 804 516 860 44 24 1776 894 169 1185 105...
result:
ok
Test #82:
score: 30
Accepted
time: 39ms
memory: 213980kb
input:
4583 2824 4575 173 4502 20 446 1470 2805 2167 1870 1655 4034 3 3757 3247 1393 103 3006 3618 2852 2044 4023 252 4405 21 3341 2653 3336 912 2960 634 3578 87 3265 2118 4451 4388 2226 781 502 2827 2018 292 2563 2502 3646 438 1026 230 4456 3070 47 3520 794 1749 2072 1608 319 2954 1614 22 2916 170 1302 26...
output:
10930 942 882 1898 1287 2672 446 926 1878 909 379 896 1054 493 2569 1658 57 333 1691 1399 2289 2720 511 1316 1358 2260 2179 2181 1558 1783 297 768 167 10 311 2529 2814 2768 1634 2377 2313 2058 1550 879 894 1834 2298 1983 2439 2612 1324 1981 2193 24 941 1311 1579 970 599 813 678 1454 1311 409 792 149...
result:
ok
Test #83:
score: 30
Accepted
time: 30ms
memory: 213928kb
input:
4096 2048 3542 1331 3164 4032 694 440 2121 1061 3102 869 1715 2222 1861 2645 2399 2971 2915 1818 393 3968 1317 3866 2682 1509 1760 1071 406 1860 1951 185 279 1553 2034 2483 1277 1047 3363 3763 2625 2258 221 814 1202 3128 484 315 3826 2491 1505 1998 3949 3994 1930 2517 489 2610 3213 1893 3934 2091 28...
output:
16444 823 1565 811 132 222 1807 1329 498 14 449 1602 36 1788 1460 1512 609 1932 1011 110 2027 942 1773 1034 1940 1454 122 623 1530 111 296 1875 958 1349 1263 26 44 1218 98 1366 767 842 1778 170 59 1386 1213 675 695 1476 1856 174 1559 38 1340 804 1254 1614 18 1692 1110 1924 1101 2045 387 271 1797 174...
result:
ok
Test #84:
score: 30
Accepted
time: 47ms
memory: 213936kb
input:
5000 2500 4873 112 1170 4116 458 2694 3225 4409 4269 4285 3404 4861 4577 1126 3937 3463 2983 4323 973 754 4612 119 4857 649 2730 3540 3303 1316 2827 24 3177 2709 101 1707 4789 414 2059 473 2288 352 4548 18 1433 4683 2912 4445 4113 46 4717 4829 3248 96 4316 140 3016 605 4786 1299 2088 4615 4138 3957 ...
output:
65030 1715 135 1260 323 1790 1204 706 1595 193 1919 1940 1532 2091 1988 1064 1745 1973 150 2117 1469 1105 2059 1854 1801 1344 237 1416 2234 1966 46 323 871 1366 1229 2497 161 1453 7 1493 1716 1657 1786 1255 1442 1679 1856 554 1115 1360 2244 1735 2130 1181 1404 69 754 2334 1452 597 907 2092 294 2263 ...
result:
ok
Test #85:
score: 30
Accepted
time: 39ms
memory: 216620kb
input:
5000 2500 4961 12 3144 529 224 4446 2201 1452 3571 665 241 3608 2616 1533 3489 247 2384 110 1479 1072 2531 1502 1566 1697 1532 1242 1378 3408 4464 1477 3873 49 3987 923 327 1277 4180 4752 2135 988 4101 2283 4448 66 4157 3547 24 2389 2147 947 887 685 2962 4536 2507 456 3132 4033 41 4308 4719 719 4077...
output:
722280 2377 1867 1350 282 485 343 1522 719 2491 1042 1990 1321 1887 136 559 2209 858 410 1418 591 2328 1675 2417 626 564 387 378 954 3 723 2455 1163 458 1114 2204 235 1153 1322 2426 663 2356 1270 922 149 372 2465 1246 2327 2098 1234 859 1033 468 1677 2162 757 1804 1684 1216 1788 1513 1636 2279 1557 ...
result:
ok
Test #86:
score: 30
Accepted
time: 27ms
memory: 213552kb
input:
4096 2048 1351 3562 2484 1169 139 3766 1978 658 3759 326 3946 3727 3985 2239 1008 2656 1629 973 675 78 1600 427 2888 1501 3258 1525 3664 2530 175 3020 976 634 2303 2257 4043 3036 3326 2555 816 3973 2227 2486 2124 2597 3053 2707 3217 400 2171 2699 118 3894 3657 2542 2411 3169 54 3219 2598 3609 366 16...
output:
14754 1329 1486 1921 330 1731 132 1602 1011 1928 1460 1788 498 14 609 1227 36 1567 2027 1504 986 1075 97 1638 209 1181 1165 328 1882 728 1028 942 1426 170 1246 1989 1666 1692 1110 1745 625 111 122 1875 296 39 1684 1448 1797 91 1810 869 1395 1876 44 1218 1996 363 1189 1808 129 1366 1146 565 274 51 15...
result:
ok
Test #87:
score: 30
Accepted
time: 31ms
memory: 213940kb
input:
5000 2500 4873 112 1170 4116 458 2694 3225 4409 4269 4285 3404 4861 4577 1126 3937 3463 2983 4323 973 754 4612 119 4857 649 2730 3540 3303 1316 2827 24 3177 2709 101 1707 4789 414 2059 473 2288 352 4548 18 1433 4683 2912 4445 4113 46 4717 4829 3248 96 4316 140 3016 605 4786 1299 2088 4615 4138 3957 ...
output:
50276 919 263 1698 252 1260 2283 706 1595 193 1919 1475 28 1064 1745 1561 1112 2391 1955 2117 1469 1973 150 1940 1532 570 1204 2091 1988 2336 1518 2302 1560 292 2468 2486 2018 1105 2059 1435 656 518 1725 1854 1801 2380 1679 551 1023 1416 2234 561 1512 1453 7 1493 1716 1679 1856 1878 2142 554 1115 69...
result:
ok
Test #88:
score: 30
Accepted
time: 36ms
memory: 213940kb
input:
5000 2500 4958 13 3215 528 198 4490 2284 1529 3628 683 211 3668 2675 1599 3569 215 2471 104 1556 1135 2606 1574 1641 1780 1598 1307 1467 3464 4505 1553 3911 45 4027 950 312 1337 4209 4766 2208 1011 4127 2373 4495 60 4186 3611 24 2476 2220 982 918 708 3023 4566 2588 449 3200 4072 37 4356 4739 731 411...
output:
668650 1840 2159 1239 464 1075 428 952 367 2247 108 1223 397 2292 1293 1976 1570 1296 835 1039 2036 1603 1216 1955 2410 320 2291 401 2397 1968 1146 185 1970 2222 413 2406 2401 994 216 1003 2363 1632 1116 572 184 1427 2101 105 86 101 949 1063 2237 2089 2206 1368 1843 2184 1265 2322 80 1344 738 1691 1...
result:
ok
Test #89:
score: 30
Accepted
time: 31ms
memory: 212744kb
input:
4096 2048 3305 1273 2262 2873 448 2803 975 2861 4071 3581 1716 3727 3610 2491 2034 2068 325 3410 1139 686 1438 647 2838 532 1097 3058 2895 3616 2548 3364 2291 24 724 3655 3995 4068 2780 1982 3236 553 585 674 467 3937 2234 2472 223 235 1898 2839 2811 99 121 949 2580 3701 2783 1707 3143 2148 976 16 63...
output:
14990 823 1565 811 828 1329 463 12 1486 1788 1460 1912 1807 222 1862 1928 330 1184 1949 1731 132 1227 449 1512 790 1602 609 1163 1011 1932 1882 110 2027 48 1426 1034 1666 1989 1773 1454 1328 1075 584 1069 1483 1475 1395 629 793 1614 625 1692 1110 1924 1101 129 748 2045 1574 2047 695 675 1856 1476 76...
result:
ok
Test #90:
score: 30
Accepted
time: 35ms
memory: 212700kb
input:
5000 2500 4873 112 1170 4116 458 2694 3225 4409 4269 4285 3404 4861 4577 1126 3937 3463 2983 4323 973 754 4612 119 4857 649 2730 3540 3303 1316 2827 24 3177 2709 101 1707 4789 414 2059 473 2288 352 4548 18 1433 4683 2912 4445 4113 46 4717 4829 3248 96 4316 140 3016 605 4786 1299 2088 4615 4138 3957 ...
output:
42188 1289 1587 1260 1990 1399 727 1317 1083 1698 252 2013 323 193 1919 1064 1745 2117 1469 2427 1401 198 295 2391 134 1854 1801 2497 871 554 1115 1360 2244 1735 2130 2334 1452 1181 1404 555 1043 2025 1058 27 2057 807 2465 133 358 1397 1171 1228 806 673 2211 602 487 2066 635 1843 2136 226 2138 402 2...
result:
ok
Test #91:
score: 30
Accepted
time: 42ms
memory: 213432kb
input:
5000 2500 4960 15 3208 550 212 4468 2247 1484 3619 688 227 3658 2653 1569 3555 236 2425 107 1519 1116 2569 1541 1612 1745 1568 1276 1428 3466 4497 1514 3901 53 4005 977 335 1311 4200 4764 2172 1022 4114 2323 4471 69 4180 3603 26 2433 2183 991 928 718 3026 4567 2544 465 3197 4052 49 4335 4738 741 410...
output:
625734 992 1793 1089 465 362 1688 1672 1815 1003 2219 75 1175 1190 1359 1702 1606 279 344 491 587 1753 2327 213 355 2497 2154 1884 278 1010 2443 1975 2124 1634 2149 2016 1027 187 2079 924 1638 981 2350 846 1615 247 2458 413 1572 124 2251 2303 1752 1750 1134 2162 524 2008 1420 839 759 2289 1235 1955 ...
result:
ok
Test #92:
score: 30
Accepted
time: 28ms
memory: 213064kb
input:
4096 2048 1107 2568 1925 1194 2870 1314 2652 2605 1113 1055 1853 1617 1539 1145 1124 771 386 1702 676 524 1693 110 1847 3918 1588 1729 1902 558 2440 2318 800 3970 2383 2128 2686 1257 1109 4035 3561 494 3543 3246 3739 3403 3636 3985 3488 1489 2254 585 1834 2474 1764 2294 652 1723 2972 1285 3010 3322 ...
output:
13784 1329 949 247 681 1515 1634 1660 261 685 1421 1629 1527 1347 1059 1624 1603 1656 280 800 1016 1749 1519 1729 1225 1964 1199 1289 67 1851 1954 1693 2011 1041 1688 2046 1687 2015 1658 1342 1742 226 806 1566 993 1878 1325 832 1173 1636 241 841 1262 1643 1431 1809 1450 1966 2042 1676 1000 1042 1625...
result:
ok
Test #93:
score: 30
Accepted
time: 32ms
memory: 213052kb
input:
5000 2500 4873 112 1170 4116 458 2694 3225 4409 4269 4285 3404 4861 4577 1126 3937 3463 2983 4323 973 754 4612 119 4857 649 2730 3540 3303 1316 2827 24 3177 2709 101 1707 4789 414 2059 473 2288 352 4548 18 1433 4683 2912 4445 4113 46 4717 4829 3248 96 4316 140 3016 605 4786 1299 2088 4615 4138 3957 ...
output:
27604 919 263 193 1919 1561 1112 2336 1955 2391 2018 198 134 1475 28 1870 1759 2459 1944 1735 2130 69 754 1181 1404 2263 767 77 1666 492 358 1397 1171 850 534 1859 2412 1843 2136 2349 256 533 2118 365 610 2322 356 1454 136 2119 1763 1026 2019 113 693 2104 2046 1125 1738 128 1308 1462 131 1906 2141 1...
result:
ok
Test #94:
score: 30
Accepted
time: 48ms
memory: 213548kb
input:
5000 2500 4964 11 3297 582 236 4500 2305 1544 3686 724 248 3732 2726 1634 3619 252 2487 124 1577 1172 2637 1596 1674 1809 1631 1339 1490 3528 4518 1574 3946 59 4052 1011 365 1371 4253 4758 2250 1065 4177 2399 4503 74 4222 3666 30 2494 2260 1029 975 748 3087 4574 2611 510 3286 4113 53 4381 4735 776 4...
output:
270330 417 478 1110 1236 540 1919 350 2175 277 2421 2208 1904 814 393 2007 187 142 1027 1641 2286 781 359 2398 1654 1884 278 1926 2019 306 1974 1699 2215 2368 1968 515 1693 1050 37 23 2209 2266 276 1503 1294 606 441 495 2230 717 1546 1598 1188 1439 865 342 1563 782 2346 53 1803 521 901 2179 1926 100...
result:
ok
Test #95:
score: 30
Accepted
time: 44ms
memory: 213880kb
input:
4096 2048 970 3364 736 1975 1100 1477 4053 1646 3627 2478 3225 1617 4088 3157 3841 1584 349 3233 2477 2854 1696 3130 604 2396 2741 4015 3816 3191 286 620 1110 3497 2098 1958 1181 1006 2720 4065 1257 415 3761 622 1445 80 500 2780 2199 2175 1716 455 1656 2255 3038 1266 1246 1681 51 577 2639 1248 3488 ...
output:
13570 823 1565 1329 1160 1921 905 1184 442 299 828 486 128 2046 1607 14 790 1645 609 1561 649 1155 897 833 666 279 1653 641 548 295 421 119 1137 435 1324 276 1761 403 871 1965 28 1900 2027 667 1964 1207 1273 1567 1667 110 49 1635 1244 132 631 1970 55 1045 637 1492 1001 1236 1418 761 923 1503 841 730...
result:
ok
Subtask #4:
score: 0
Memory Limit Exceeded
Test #96:
score: 40
Accepted
time: 219ms
memory: 448152kb
input:
300000 100000 297688 58574 11154 227659 2832 4187 46902 30386 123954 297021 107275 50042 254278 246399 245777 174442 294196 213936 66372 33303 196079 68308 279926 155894 38996 65379 16366 236135 73779 90307 140452 79063 170940 175005 103283 242495 199312 112374 299718 3222 294033 126886 258651 54878...
output:
129389668 81923 79943 55714 1298 8558 67567 224 7266 26762 39587 87870 49536 79579 78206 3955 87620 54618 21933 3624 26763 23863 83166 83909 70624 12122 92040 62845 92173 88758 9140 66894 73751 12219 98989 11855 85488 81795 13955 8112 48776 19604 87782 92389 28574 13272 4432 70701 99713 7029 49285 5...
result:
ok
Test #97:
score: 40
Accepted
time: 181ms
memory: 288412kb
input:
300000 200000 280782 16325 171906 51662 245114 202173 138437 225533 202918 140834 277080 171662 156708 218384 270721 221100 8753 41 184773 98826 283417 239730 68744 157634 186386 101007 107165 38330 150068 120744 213094 220042 74291 278298 19992 150808 233118 64116 122210 98049 104561 120466 219635 ...
output:
65347662 91169 12911 85986 25716 21296 175822 80562 15512 162637 175113 66667 170427 8582 82340 53160 28807 20820 29462 2144 73717 22324 123858 43637 8378 187178 1670 139364 42639 128418 61054 177948 59030 58658 80447 95603 64110 45174 4074 38337 314 43665 112444 27947 10328 106896 21272 153410 1195...
result:
ok
Test #98:
score: 40
Accepted
time: 31ms
memory: 214452kb
input:
20480 10240 20072 5509 3628 19967 7855 4368 5621 460 5801 13197 4788 18694 6287 15047 19518 19543 1538 8089 7624 4693 9425 17961 15893 9376 8032 25 16738 12876 17999 13243 19559 13503 3162 8893 17132 12513 17842 17663 17791 9511 14790 10456 14782 3287 9718 14425 14241 153 14746 72 3055 3995 12798 63...
output:
77414 7469 83 8474 1419 7556 230 26 9350 1654 4991 3603 8470 6622 1611 5216 2623 5906 3394 5683 4796 1100 6797 9988 3219 1683 2656 938 3299 7092 996 2618 6686 2321 7344 6253 752 4899 6203 7874 1203 7141 9557 170 9318 2478 6730 9215 4086 987 6490 3767 3058 540 140 1097 4427 7614 7442 1818 8914 5477 9...
result:
ok
Test #99:
score: 40
Accepted
time: 59ms
memory: 225320kb
input:
98304 49152 97153 7643 59051 79831 79742 72969 23358 8083 93930 34059 81070 53431 72262 22848 13022 66285 61268 563 96198 78922 8310 94217 51436 52307 89884 5151 12430 20579 59685 27046 68559 1405 58612 91363 53885 68662 59370 4586 2197 91467 76012 667 90577 2383 52923 53712 56229 491 78083 92363 70...
output:
400214 31213 2434 5022 36881 40631 3448 9048 62 30938 5315 25055 35829 43755 2307 14905 41252 6808 6378 46162 44198 1632 1330 269 29549 37338 368 39480 12717 19660 43510 42447 43673 660 20729 42891 25149 3254 21738 60 27678 16242 32138 9403 738 116 40392 40046 374 16950 42456 34944 48280 32863 48906...
result:
ok
Test #100:
score: 40
Accepted
time: 103ms
memory: 238756kb
input:
212992 106496 200187 128433 98173 121038 135533 24443 152445 457 155067 211244 31235 97373 169245 123056 108337 45064 84391 2828 211316 9844 163976 18726 130203 135430 66218 189123 152906 151367 191302 187933 158586 123169 89028 4392 160177 79379 63066 16608 207958 164190 180348 70823 172596 207 136...
output:
896526 21350 14216 30092 27638 1790 45402 67905 4619 71414 73420 4076 99903 82494 36837 59488 36184 72953 28283 29140 40280 4304 1800 46898 12842 2742 13178 73902 71303 77735 28928 70887 95897 67392 60732 33080 24 39434 90822 74142 7779 26403 37158 12886 28506 68034 5814 30875 75257 53710 2614 33358...
result:
ok
Test #101:
score: 40
Accepted
time: 264ms
memory: 291464kb
input:
300000 150000 296298 181089 91330 183401 150320 35819 180655 175626 247475 72756 270994 170346 203848 257336 67026 241158 83007 63367 221731 76517 274119 182379 174810 6 242419 1375 122102 162780 206324 38502 30842 216581 187072 271076 40743 15974 141917 51765 239271 155238 102340 56664 275156 648 1...
output:
130965332 138977 113855 78411 50917 104444 15190 74761 39925 29901 89746 107128 96437 135867 133974 101197 89401 81477 37165 95975 84173 24764 1688 142340 2805 92584 66727 109640 138212 114440 40335 21439 105533 73115 77554 2306 55899 27615 28593 70592 110959 62870 98256 98184 119896 72769 69364 123...
result:
ok
Test #102:
score: 40
Accepted
time: 81ms
memory: 246336kb
input:
300000 15 186898 186885 186886 186889 186895 186888 186896 186890 186894 186892 186887 186891 186899 186893 186897 220382 220372 220371 220377 220374 220375 220373 220380 220383 220381 220376 220384 220385 220379 220378 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 13 13 14 14 15 15 16 16 17 1...
output:
1378348 2 12 3 13 11 9 6 1 4 10 8 8 12 14 10 15 14 4 9 11 5 6 7 5 15 7 1 2 13 3
result:
ok
Test #103:
score: 0
Memory Limit Exceeded
input:
300000 150000 168663 46327 39652 62227 66836 88475 62068 57901 132082 81367 60148 30873 106518 29774 98275 170939 135372 91597 63447 121715 155677 36423 29016 24852 64022 159234 106476 123081 146990 163631 165896 32919 123098 50211 35888 45455 104908 70541 88712 36828 134906 75390 157029 44349 13261...
output:
5074549668 91919 142111 49195 100501 8572 20125 117743 75292 82803 98433 71832 138772 60477 141883 84291 30267 106789 102689 127461 58216 126363 75521 927 72323 22730 122131 51948 32513 68318 99519 95515 102709 101273 49165 24 3010 17934 141679 78187 15861 34487 108467 129431 31864 86119 29045 92734...