QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#327322 | #2118. Poborcy podatkowi [A] | james1BadCreeper | 10 ✓ | 702ms | 40120kb | C++14 | 1.5kb | 2024-02-14 21:30:46 | 2024-02-14 21:30:47 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
typedef long long i64;
const int N = 2e5 + 5, B = 505;
const i64 INF = 1e18;
int n, val[N];
vector<pair<int, int>> G[N];
i64 f[N][4], h[B * 2][2], g[B * 2][2];
mt19937 Rand(time(0));
inline void ckmax(i64 &x, i64 y) { x = max(x, y); }
inline void dfs(int x, int fa) {
vector<int> v;
for (auto [y, w] : G[x]) if (y != fa)
val[y] = w, dfs(y, x), v.push_back(y);
shuffle(v.begin(), v.end(), Rand);
memset(g, -0x3f, sizeof g); g[B][0] = 0; // 1 - 3
for (int y : v) {
for (int j = 0; j <= B * 2; ++j) h[j][0] = h[j][1] = -INF;
for (int j = 1; j < B * 2; ++j) for (int k : {0, 1}) if (g[j][k] > -INF)
ckmax(h[j][k], g[j][k] + f[y][0]),
ckmax(h[j + 1][k], g[j][k] + f[y][1]),
ckmax(h[j][k ^ 1], g[j][k] + f[y][2]),
ckmax(h[j - 1][k], g[j][k] + f[y][3]);
for (int j = 0; j <= B * 2; ++j) g[j][0] = h[j][0], g[j][1] = h[j][1];
}
if (x > 1) f[x][0] = max({0ll, g[B][0], g[B - 1][0] + val[x]});
else f[x][0] = max(0ll, g[B][0]);
f[x][1] = max(0ll, g[B][0]) + val[x];
f[x][2] = g[B + 1][0] + val[x];
f[x][3] = g[B][1] + val[x];
}
int main(void) {
ios::sync_with_stdio(0);
cin >> n;
for (int i = 1; i < n; ++i) {
int u, v, w; cin >> u >> v >> w;
G[u].emplace_back(v, w); G[v].emplace_back(u, w);
}
dfs(1, 0);
cout << f[1][0] << '\n';
return 0;
}
詳細信息
Subtask #1:
score: 1
Accepted
Test #1:
score: 1
Accepted
time: 3ms
memory: 8400kb
input:
19 1 2 1 2 3 2 3 4 -1 4 5 -1 5 6 2 6 7 11 7 8 12 8 9 13 9 10 14 11 12 3 12 13 0 13 14 0 14 15 0 15 16 1 16 4 0 4 17 0 17 18 0 18 19 2
output:
57
result:
ok single line: '57'
Test #2:
score: 0
Accepted
time: 3ms
memory: 8548kb
input:
6 1 2 2 2 3 -1 3 4 -1 4 5 -1 5 6 2
output:
0
result:
ok single line: '0'
Test #3:
score: 0
Accepted
time: 2ms
memory: 8352kb
input:
2 2 1 0
output:
0
result:
ok single line: '0'
Test #4:
score: 0
Accepted
time: 0ms
memory: 8620kb
input:
2 1 2 -1
output:
0
result:
ok single line: '0'
Test #5:
score: 0
Accepted
time: 0ms
memory: 8412kb
input:
2 2 1 1
output:
0
result:
ok single line: '0'
Test #6:
score: 0
Accepted
time: 0ms
memory: 8392kb
input:
4 1 2 5 2 4 0 3 1 0
output:
0
result:
ok single line: '0'
Test #7:
score: 0
Accepted
time: 0ms
memory: 8464kb
input:
5 2 1 1 3 5 0 2 5 0 1 4 0
output:
1
result:
ok single line: '1'
Test #8:
score: 0
Accepted
time: 2ms
memory: 8420kb
input:
5 2 4 -10 1 4 12 5 3 9 5 2 -10
output:
1
result:
ok single line: '1'
Test #9:
score: 0
Accepted
time: 3ms
memory: 8400kb
input:
16 5 12 -2 12 1 10 13 12 0 12 4 2 12 9 -5 12 16 5 6 12 1 10 12 1 14 12 10 12 3 10 12 8 5 12 15 0 12 2 2 11 12 -1 7 12 -5
output:
0
result:
ok single line: '0'
Test #10:
score: 0
Accepted
time: 3ms
memory: 8416kb
input:
13 12 7 -9 12 9 3 3 9 -8 5 10 -10 1 3 -5 13 4 7 6 13 5 7 11 2 2 5 -4 11 8 -7 12 4 -6 10 12 -5
output:
9
result:
ok single line: '9'
Test #11:
score: 0
Accepted
time: 0ms
memory: 8464kb
input:
16 13 1 -6 15 13 -6 1 6 -1 1 2 6 16 8 -10 1 14 -8 3 2 9 12 1 -10 4 1 3 1 11 1 10 1 3 1 5 -10 1 7 8 16 11 2 9 5 2
output:
18
result:
ok single line: '18'
Test #12:
score: 0
Accepted
time: 3ms
memory: 8548kb
input:
13 4 12 -10 4 6 -2 9 3 -10 4 1 -5 4 10 -2 4 5 2 11 4 6 2 4 -4 4 8 -2 7 4 9 4 13 7 7 9 2
output:
8
result:
ok single line: '8'
Test #13:
score: 0
Accepted
time: 0ms
memory: 8392kb
input:
16 11 5 5 1 6 -7 8 14 3 1 13 2 14 2 9 4 5 1 7 1 -3 9 10 1 8 10 -5 3 7 10 10 16 3 11 7 -6 8 3 -2 14 12 -8 15 11 -4
output:
20
result:
ok single line: '20'
Test #14:
score: 0
Accepted
time: 0ms
memory: 8404kb
input:
16 16 4 7 5 7 2 14 13 8 8 13 10 12 3 5 1 9 10 8 5 5 7 12 7 7 1 5 10 13 2 6 8 10 12 2 8 6 4 10 1 11 7 6 15 8
output:
68
result:
ok single line: '68'
Test #15:
score: 0
Accepted
time: 0ms
memory: 8464kb
input:
16 14 1 5 9 13 5 8 13 -1 15 10 -8 13 11 0 16 14 -9 14 5 10 15 7 -8 12 16 -9 3 10 10 6 15 -4 2 14 5 13 14 4 15 14 -8 14 4 -1
output:
4
result:
ok single line: '4'
Test #16:
score: 0
Accepted
time: 0ms
memory: 8400kb
input:
16 5 7 -10 11 10 5 4 3 -4 6 2 7 4 12 10 8 5 1 1 8 -3 9 6 3 7 14 4 3 10 7 1 13 -3 13 16 -9 9 14 -5 15 16 -7 11 2 6
output:
29
result:
ok single line: '29'
Subtask #2:
score: 1
Accepted
Test #17:
score: 1
Accepted
time: 0ms
memory: 8480kb
input:
500 89 476 -93 125 108 -40 210 396 34 320 179 30 83 467 -39 417 197 -94 475 67 -65 158 442 39 48 189 -92 422 345 -32 22 411 -39 402 132 71 413 47 -67 238 212 -77 471 36 -72 273 5 -39 189 23 5 304 338 -70 484 240 75 414 19 -54 29 431 -77 1 473 21 147 377 -91 478 77 -1 436 384 0 165 431 4 30 465 24 13...
output:
9101
result:
ok single line: '9101'
Test #18:
score: 0
Accepted
time: 0ms
memory: 8652kb
input:
500 86 319 -43 182 355 -100 265 42 -24 259 497 -42 179 47 -28 331 234 -3 280 76 -14 258 345 43 474 382 -71 245 382 -87 76 434 -11 5 234 38 285 252 -65 313 403 -62 95 382 -62 382 312 -79 106 351 -93 361 192 35 188 264 17 188 437 -78 354 5 -3 238 103 -1 16 4 17 363 75 -22 352 465 30 420 382 -93 254 36...
output:
1700
result:
ok single line: '1700'
Test #19:
score: 0
Accepted
time: 0ms
memory: 8456kb
input:
500 236 494 -29 281 84 37 112 255 60 366 57 80 391 95 62 151 53 53 12 244 37 308 231 47 336 146 24 188 422 72 137 482 91 38 29 7 281 7 -2 243 253 -24 187 249 72 314 91 -26 496 72 33 422 344 19 16 39 65 236 303 -23 448 269 5 85 138 -27 46 54 -7 164 90 3 442 318 85 360 424 43 243 397 -40 391 247 18 12...
output:
12382
result:
ok single line: '12382'
Test #20:
score: 0
Accepted
time: 4ms
memory: 8500kb
input:
500 403 10 -43 204 493 0 207 23 14 467 195 77 437 121 -83 458 181 61 99 11 -36 351 118 28 422 236 51 144 171 52 119 352 -52 22 500 -50 457 466 -35 444 19 26 174 137 -88 35 405 95 376 439 27 40 223 -36 273 286 80 267 12 12 103 230 -100 423 154 93 399 323 -73 318 244 65 293 387 39 344 6 -8 1 452 -16 3...
output:
8797
result:
ok single line: '8797'
Test #21:
score: 0
Accepted
time: 3ms
memory: 8396kb
input:
500 133 371 -30 268 142 34 118 450 -82 492 125 -61 449 53 84 492 111 -64 181 248 17 375 274 -19 187 385 70 330 398 -25 130 109 -44 62 260 51 61 331 82 388 11 -12 381 305 -46 411 325 -57 492 154 42 431 224 -64 497 218 -91 8 376 -19 485 492 94 288 381 22 492 301 63 417 491 -65 485 124 30 385 291 4 486...
output:
7965
result:
ok single line: '7965'
Test #22:
score: 0
Accepted
time: 0ms
memory: 8396kb
input:
500 493 435 -49 392 458 84 250 165 23 298 275 50 229 433 -23 144 236 55 56 215 95 348 205 -34 281 410 -17 468 112 -41 157 351 -45 272 400 45 310 279 32 230 236 37 74 370 63 138 296 45 236 101 63 317 113 -40 414 495 85 333 268 -46 184 236 48 359 236 76 236 368 35 496 24 -16 364 34 13 226 249 2 117 40...
output:
14775
result:
ok single line: '14775'
Test #23:
score: 0
Accepted
time: 4ms
memory: 8396kb
input:
500 406 279 19 18 300 -84 124 406 52 123 293 -48 239 44 -17 60 88 -67 480 457 -49 406 17 98 104 406 -51 192 406 -51 193 83 55 406 345 24 207 311 42 113 261 -52 66 134 88 397 191 68 257 451 -74 348 406 -45 165 374 13 249 309 -55 178 500 -2 406 372 47 283 406 -48 44 471 20 406 61 59 429 221 29 453 378...
output:
8729
result:
ok single line: '8729'
Test #24:
score: 0
Accepted
time: 4ms
memory: 8660kb
input:
500 98 9 53 308 418 -22 98 50 -16 162 255 25 166 382 -82 132 17 20 98 475 4 72 98 47 265 167 -44 483 98 -81 190 98 -92 494 467 -69 128 29 58 178 410 -17 98 203 25 183 278 70 162 98 41 121 477 -58 311 98 -2 494 275 58 358 169 -30 98 53 -85 98 222 -27 478 199 55 197 33 38 99 98 95 181 235 -29 360 414 ...
output:
10639
result:
ok single line: '10639'
Test #25:
score: 0
Accepted
time: 3ms
memory: 8384kb
input:
484 309 370 24 21 403 -25 335 136 17 113 66 17 127 379 -2 243 23 7 477 234 -10 254 385 1 230 65 -14 272 210 1 118 110 3 421 460 5 68 447 17 274 112 9 462 302 20 10 464 -26 25 304 -4 318 283 -13 469 102 58 324 303 -7 87 106 -9 23 444 14 474 298 -22 56 33 6 247 28 -18 205 278 -23 93 4 10 311 368 -14 2...
output:
2106
result:
ok single line: '2106'
Test #26:
score: 0
Accepted
time: 0ms
memory: 8428kb
input:
516 361 363 6 223 420 4 219 335 26 433 414 -39 276 40 16 472 310 18 378 401 2 248 121 15 347 120 1 58 283 15 297 512 8 186 237 11 257 277 18 32 362 7 505 271 14 264 184 24 334 464 24 76 69 19 395 38 3 444 471 21 176 107 -51 476 260 23 483 31 9 269 345 21 459 323 -33 122 497 21 283 4 24 6 394 15 75 3...
output:
3579
result:
ok single line: '3579'
Test #27:
score: 0
Accepted
time: 0ms
memory: 8448kb
input:
520 312 248 20 88 391 23 215 395 5 469 71 1 86 270 -10 493 361 18 227 89 -1 50 264 22 156 211 21 149 2 -9 174 230 17 314 215 14 180 5 3 268 75 3 440 121 19 516 339 4 418 316 23 90 238 5 313 294 24 519 394 -2 39 334 5 323 310 11 94 253 -7 240 430 -8 415 506 21 326 419 7 35 361 20 216 264 11 84 358 -4...
output:
2916
result:
ok single line: '2916'
Test #28:
score: 0
Accepted
time: 0ms
memory: 8424kb
input:
486 307 62 13 347 191 -1 424 361 4 10 313 6 77 364 -23 10 109 1 164 61 13 301 77 21 310 430 -25 262 166 -18 22 456 -24 196 214 12 406 121 -19 308 155 -24 466 152 -15 140 412 -43 188 315 -11 249 442 -12 63 11 6 154 197 -15 201 315 19 149 178 13 262 271 20 137 143 -21 49 335 15 230 310 -24 422 74 7 30...
output:
2170
result:
ok single line: '2170'
Test #29:
score: 0
Accepted
time: 0ms
memory: 8432kb
input:
499 1 2 -24 1 5 1 1 8 33 1 11 -7 1 14 35 1 17 25 1 20 3 1 23 23 1 26 36 1 29 17 1 32 -10 1 35 34 1 38 13 1 41 47 1 44 24 1 47 -16 1 50 -8 1 53 -13 1 56 19 1 59 9 1 62 41 1 65 32 1 68 42 1 71 0 1 74 -19 1 77 -12 1 80 18 1 83 -9 1 86 69 1 89 74 1 92 71 1 95 71 1 98 61 1 101 72 1 104 75 1 107 74 1 110 ...
output:
10408
result:
ok single line: '10408'
Subtask #3:
score: 1
Accepted
Test #30:
score: 1
Accepted
time: 10ms
memory: 9280kb
input:
4000 2447 3245 -78174799 2635 1683 216094756 901 1440 363565703 3309 2840 902197907 292 2903 -176949469 2037 1242 -580628172 1339 37 -615992810 3697 3704 -761356400 3857 3093 -541903235 2305 4000 480217799 2659 316 311185678 280 81 -628945421 125 3113 -206788719 2117 3171 842984650 3341 2296 4869283...
output:
656500970891
result:
ok single line: '656500970891'
Test #31:
score: 0
Accepted
time: 8ms
memory: 8716kb
input:
4000 154 1800 -941665747 3504 3988 504696303 2838 3647 -180387868 3868 2426 -19478647 2446 2426 235152907 3322 1281 398689507 2884 3988 596735405 3083 2712 -740372326 2185 1580 -891000188 688 3902 -941398104 2426 603 374816595 3081 2585 -13796798 3083 2487 -475953377 325 3988 20989057 3083 980 81086...
output:
557746482942
result:
ok single line: '557746482942'
Test #32:
score: 0
Accepted
time: 7ms
memory: 8680kb
input:
4000 2259 2679 488975017 3564 610 -668223051 851 672 -528652307 2879 3152 805998130 1907 310 -453780914 3583 2019 -399550089 1606 1223 54974998 1270 1583 -98279761 2662 2953 862173676 99 3480 -370858875 1444 2764 -781711572 1371 1511 440135869 1431 3697 216694741 1183 1369 -958527252 1106 2467 -8668...
output:
666244690015
result:
ok single line: '666244690015'
Test #33:
score: 0
Accepted
time: 6ms
memory: 8724kb
input:
4000 283 1002 -528544560 2814 2939 642461863 675 2003 -964622080 3010 3446 642991535 3157 816 531018520 2925 239 413091936 3717 479 -396956604 3825 1383 -766170883 3910 2773 825072997 3358 1330 -301042172 412 1737 353632641 1786 3254 -221493424 827 2294 85424357 3419 1558 283165530 2419 280 -1167518...
output:
636959670404
result:
ok single line: '636959670404'
Test #34:
score: 0
Accepted
time: 6ms
memory: 8748kb
input:
4000 3666 2873 -847946568 1243 2873 -725704136 2873 3137 -56717379 315 2873 -759647975 2873 2452 -400758219 1032 2873 973405610 2873 3487 780276916 1982 2873 -614239345 2873 3090 -252525114 3006 2873 88434762 2873 900 -537654475 2873 836 -783948921 2873 2305 -644968333 1969 2873 838359365 2634 2873 ...
output:
0
result:
ok single line: '0'
Test #35:
score: 0
Accepted
time: 14ms
memory: 8792kb
input:
4000 892 3795 582605658 892 3191 586371219 892 1308 249789963 892 741 128348597 892 130 128348597 892 597 191317312 892 574 654785036 892 3834 25893043 892 2580 894881887 892 901 4762409 892 3077 44214337 892 2493 955452120 892 1215 712831179 892 317 794936152 892 2172 25715009 892 2870 296024040 89...
output:
1995595248714
result:
ok single line: '1995595248714'
Test #36:
score: 0
Accepted
time: 14ms
memory: 8692kb
input:
4000 861 69 494559058 3584 69 129390808 69 1723 162540089 1862 69 803941866 1099 2606 477481292 69 3995 654823147 2817 69 60966051 3945 1232 683630478 69 3179 108769701 75 69 624725645 69 1783 256088405 901 2204 127886448 1275 268 763315573 2008 1838 506998025 247 1953 134863818 69 1119 84007344 120...
output:
2053753977008
result:
ok single line: '2053753977008'
Test #37:
score: 0
Accepted
time: 14ms
memory: 8684kb
input:
4000 86 3934 785094561 3287 3970 847317589 3209 627 857308867 3209 2213 613683353 3935 3209 264381373 3209 791 968668659 1148 178 638287666 1250 3209 772060553 3209 2464 763409940 2023 1757 503756286 984 2119 775749627 959 3209 755666712 3209 1314 560650038 3187 2229 773380787 98 3209 234810085 3905...
output:
2032052995676
result:
ok single line: '2032052995676'
Test #38:
score: 0
Accepted
time: 12ms
memory: 8900kb
input:
4000 126 3826 363607871 3906 2305 -379192413 3677 2305 -533727692 1110 2305 -264786316 2641 1562 -580145016 3944 445 -650151211 2958 1987 -273682375 3437 2305 526733604 698 1772 223568448 2742 3930 90602858 2201 2289 -926633917 3295 124 -482795805 1064 3429 731734120 3417 2305 690228070 2305 837 -55...
output:
665430408386
result:
ok single line: '665430408386'
Test #39:
score: 0
Accepted
time: 7ms
memory: 8892kb
input:
4008 2157 3445 14896399 1066 2977 -119178124 297 1649 -171928750 1128 2051 -19417531 887 2025 137445005 97 1263 -57233099 234 3944 -236163154 2016 1652 -239276241 3717 354 218448594 3659 1092 78921674 3326 1955 244739506 168 1342 -189778647 3983 2565 235101804 2079 1832 117610715 3164 2869 15862444 ...
output:
154718515754
result:
ok single line: '154718515754'
Test #40:
score: 0
Accepted
time: 7ms
memory: 8828kb
input:
3748 2198 437 198764655 2139 2558 -105770138 2955 518 48837921 2134 2537 -135703094 3378 210 -102297854 1154 508 -1078291 103 335 75188692 1125 700 -159682353 70 1602 100813981 1119 1831 -170608152 1434 3056 14971761 218 2893 -29824914 459 3658 -181402490 2464 70 21788820 1010 3161 -162293212 2198 3...
output:
133455038572
result:
ok single line: '133455038572'
Test #41:
score: 0
Accepted
time: 7ms
memory: 8688kb
input:
4072 1682 890 -149318855 1531 1471 280989333 3844 2014 -75989686 715 1278 30812116 882 654 -62893661 3009 2110 41553977 140 368 -42260316 2824 304 197550588 2758 294 46971142 1875 2002 -131181607 697 1080 -74015655 2951 2191 26487972 2222 1063 -293179146 598 3464 37925515 1173 3065 58337650 1735 230...
output:
168532579008
result:
ok single line: '168532579008'
Test #42:
score: 0
Accepted
time: 13ms
memory: 8720kb
input:
4000 1 2 146700581 1 5 351157507 1 8 375873806 1 11 -20347598 1 14 430481215 1 17 224372401 1 20 -150931754 1 23 -114502771 1 26 454586969 1 29 486088137 1 32 326110182 1 35 193962641 1 38 222834469 1 41 185396577 1 44 53800396 1 47 225661667 1 50 -104074470 1 53 80077201 1 56 231794039 1 59 3588628...
output:
836574205825
result:
ok single line: '836574205825'
Subtask #4:
score: 1
Accepted
Test #43:
score: 1
Accepted
time: 89ms
memory: 15236kb
input:
45000 7593 40075 -42 37167 16811 84 35739 20418 -80 11162 8251 -57 18924 11772 10 16794 34370 87 43552 12576 -79 9904 26478 -40 28735 10020 -48 7668 23282 56 38042 15123 23 10297 38954 48 32210 37667 -96 40798 42568 -22 12867 38781 90 15281 42756 29 6452 30113 -26 1500 10541 -13 41984 10239 73 22375...
output:
760714
result:
ok single line: '760714'
Test #44:
score: 0
Accepted
time: 93ms
memory: 11916kb
input:
45000 14344 23382 -50 23105 4226 -3 11549 4713 63 15657 20350 -24 8595 37906 11 5183 44242 -71 43277 25882 7 17787 21262 -83 20812 34774 -13 5849 3675 -74 27397 11339 72 19351 21425 99 27868 44308 -39 9007 40088 97 43201 21722 -57 4108 2879 0 42119 27368 -33 20510 17812 -81 28739 4305 -45 36155 3693...
output:
757078
result:
ok single line: '757078'
Test #45:
score: 0
Accepted
time: 128ms
memory: 11520kb
input:
45000 19247 20070 73 7343 20070 72 7868 20070 41 20070 42660 15 21805 36088 43 26493 43538 98 40008 33605 -39 43673 20070 -24 35126 31340 49 7949 6605 -48 17018 20070 17 31852 34450 -27 43073 41164 -44 41485 1855 -27 34201 20506 -4 1982 20112 77 2568 20070 45 34330 20070 -3 28156 4719 44 12853 20070...
output:
1343438
result:
ok single line: '1343438'
Test #46:
score: 0
Accepted
time: 128ms
memory: 11736kb
input:
45000 25599 37947 10 25599 41392 -91 31299 39905 55 37720 11880 86 3154 27352 51 1863 37115 42 18963 29669 81 21583 9122 -3 27088 21135 -58 17343 28073 76 22941 16290 -91 15939 38180 96 19820 25599 -38 25599 14727 -45 25599 25802 -18 16412 31825 51 5920 25599 -20 22645 11175 -37 29098 19349 -64 3279...
output:
838633
result:
ok single line: '838633'
Test #47:
score: 0
Accepted
time: 90ms
memory: 11496kb
input:
43242 26741 32305 -7 36208 26415 -11 14306 7825 -5 3208 3449 -16 20211 4806 -6 19698 17058 -11 13219 13069 11 11519 4594 -25 36175 21957 25 21544 1478 7 32287 37902 19 30123 36617 -4 6170 3170 -13 4294 1403 -9 28123 37589 12 42219 34951 19 31003 20832 -41 33970 28736 -3 38014 42096 20 15764 32191 -5...
output:
185500
result:
ok single line: '185500'
Test #48:
score: 0
Accepted
time: 104ms
memory: 11656kb
input:
42966 9176 30905 -8 34925 10298 -23 6398 24103 3 15334 14772 -2 27461 22492 -20 38687 6599 -11 19343 14686 19 33646 533 20 10298 32022 -9 31327 10295 8 17975 3225 0 6953 36119 -22 10542 37882 19 11709 5108 7 6088 6136 -17 24129 28115 2 41413 6618 -11 11294 10957 -20 6618 17883 -13 734 37882 -4 29810...
output:
153370
result:
ok single line: '153370'
Test #49:
score: 0
Accepted
time: 91ms
memory: 11444kb
input:
42288 11122 36433 -4 28236 31567 23 23156 35013 -7 4388 37114 -1 39247 18663 18 8552 40204 14 25111 8623 -23 111 747 -10 14697 42260 5 12425 30682 1 24709 38147 -37 18536 667 2 5356 2824 3 16792 34678 8 28014 13370 1 6225 7526 -2 5306 34510 22 26102 6769 -19 12554 38139 14 39190 4892 17 27485 12771 ...
output:
179348
result:
ok single line: '179348'
Test #50:
score: 0
Accepted
time: 119ms
memory: 11536kb
input:
44998 1 2 -10 1 5 37 1 8 -14 1 11 18 1 14 2 1 17 30 1 20 17 1 23 7 1 26 -4 1 29 38 1 32 -20 1 35 17 1 38 34 1 41 32 1 44 39 1 47 4 1 50 10 1 53 48 1 56 -18 1 59 1 1 62 26 1 65 37 1 68 -17 1 71 5 1 74 -2 1 77 7 1 80 41 1 83 37 1 86 36 1 89 10 1 92 1 1 95 41 1 98 25 1 101 -13 1 104 0 1 107 -5 1 110 37...
output:
936733
result:
ok single line: '936733'
Subtask #5:
score: 1
Accepted
Test #51:
score: 1
Accepted
time: 217ms
memory: 15644kb
input:
100000 23809 82622 -544778830 48296 45170 269075828 3887 87494 -632893888 28694 53624 -534602851 12110 24384 177114625 14754 98691 -132800786 85501 35837 727868836 19235 84207 490922509 37727 88669 -324440450 73192 81514 -297267945 5338 89481 773628832 67640 83025 591765308 53447 13104 67568475 8883...
output:
16462984458677
result:
ok single line: '16462984458677'
Test #52:
score: 0
Accepted
time: 316ms
memory: 15840kb
input:
100000 93313 58363 433605315 85025 34938 -811255226 51188 68497 -984431002 63911 1179 -346925608 56885 26358 119776926 20190 22043 -618861043 43345 30910 -134451733 63353 28013 908427706 78014 92367 371921564 86975 50584 680272714 13346 7372 556942589 39554 64816 518914919 95522 89030 -538485381 207...
output:
13248819834560
result:
ok single line: '13248819834560'
Test #53:
score: 0
Accepted
time: 295ms
memory: 15420kb
input:
100000 73994 47976 -565184803 29024 15230 604065663 93617 28640 -538599679 70521 91925 -84664280 15992 93539 -459917426 29024 13338 -58074366 63719 29024 -394712089 34570 7725 -453686444 9746 26643 650280231 62881 30017 -178983996 149 29024 -286981530 29024 65536 -81711145 43674 29024 593689982 3324...
output:
18257059637037
result:
ok single line: '18257059637037'
Test #54:
score: 0
Accepted
time: 275ms
memory: 15244kb
input:
100000 71517 82889 460246718 3071 82889 -332563179 7345 51493 992407511 82889 86928 653938438 18720 68492 245732516 69926 34050 832443256 20753 45848 61535069 25794 27221 216664702 84596 72758 685362335 36418 82889 152151006 35367 13713 -423736716 92831 78845 475484200 29751 4345 -90293104 58224 828...
output:
28545194441958
result:
ok single line: '28545194441958'
Test #55:
score: 0
Accepted
time: 212ms
memory: 15264kb
input:
95964 73260 82911 -235622035 78495 1366 -343751283 60935 76743 -95258078 26674 84070 1227569 26959 73338 85196795 59098 41286 -163901372 15610 36583 -9792777 20218 7000 295981913 66136 84703 -96524123 69252 1915 -114018830 19106 91699 103290668 40203 79357 -433020977 60578 61738 25801276 76206 84040...
output:
3931273405890
result:
ok single line: '3931273405890'
Test #56:
score: 0
Accepted
time: 282ms
memory: 15552kb
input:
95742 63321 14183 -13274859 5411 83030 -207075974 34231 14183 -233308117 66079 51257 -82580817 27026 79266 18628486 22330 72952 94337472 5411 3117 -1200376 84343 84363 -52540254 93565 54243 -30321737 84343 69958 249219858 21920 55367 48930811 92056 73367 -189132986 83879 30452 232084644 16793 85060 ...
output:
3363229273004
result:
ok single line: '3363229273004'
Test #57:
score: 0
Accepted
time: 203ms
memory: 15332kb
input:
93738 4510 42517 16491596 51504 57583 177197338 78760 76541 -87135444 60781 81332 2834799 63974 15934 150346319 12759 68599 110940647 22643 17835 36322558 38784 86628 228361119 2911 33264 120203346 47352 20643 211769862 10891 35121 -13937076 70298 6750 31156553 57287 6988 180630393 12002 56534 -7285...
output:
3696347992126
result:
ok single line: '3696347992126'
Test #58:
score: 0
Accepted
time: 322ms
memory: 15452kb
input:
100000 11652 26464 216509153 23193 25616 188881890 5612 42626 952719607 25616 4440 832166319 25616 50712 300259775 8084 47385 907892378 30129 25616 162928032 25616 40156 787882533 6194 41179 26881366 1634 55460 449713877 6983 25616 760698224 50411 10481 448627370 25616 9659 567825082 97028 24527 865...
output:
49790575328086
result:
ok single line: '49790575328086'
Test #59:
score: 0
Accepted
time: 315ms
memory: 15388kb
input:
100000 13634 55839 31224035 13634 14161 507670617 13634 45550 372309513 13634 66413 796393428 13634 95901 85332897 13634 70362 786156740 13634 25309 496472528 13634 31642 908926835 13634 87372 985959325 13634 57013 145616658 13634 18982 815190075 13634 37222 861653232 13634 97533 390514834 13634 637...
output:
50027646867219
result:
ok single line: '50027646867219'
Test #60:
score: 0
Accepted
time: 322ms
memory: 15516kb
input:
100000 68050 19973 318449614 27846 38439 175646109 19973 76155 822762823 8058 73859 870429174 19973 53190 309217274 39468 17001 123096105 37620 95293 809141398 65015 19973 174714349 19973 1026 256824125 82773 56144 786436278 16648 45718 44068522 19973 77302 878836424 28982 19973 676866293 26908 1997...
output:
50142388692846
result:
ok single line: '50142388692846'
Test #61:
score: 0
Accepted
time: 322ms
memory: 15468kb
input:
100000 69742 14417 804364788 14417 20740 329840873 41009 92575 144602691 37821 88269 722190082 37295 14417 668374464 9792 14417 239545818 14417 83807 468149142 9068 71544 492277704 45491 14417 609969607 68261 14417 554888496 80323 5524 892881765 21639 80363 334957017 30584 90520 485506147 28794 1441...
output:
49834050999140
result:
ok single line: '49834050999140'
Test #62:
score: 0
Accepted
time: 257ms
memory: 15172kb
input:
100000 1 2 147048061 1 5 -240473463 1 8 230624379 1 11 -149950779 1 14 145931393 1 17 -103745209 1 20 140834634 1 23 143979199 1 26 -137223272 1 29 300543591 1 32 -125586957 1 35 -156489192 1 38 269910832 1 41 447066742 1 44 -140130285 1 47 25720447 1 50 -155506728 1 53 490688476 1 56 115906542 1 59...
output:
20849128054786
result:
ok single line: '20849128054786'
Subtask #6:
score: 1
Accepted
Test #63:
score: 1
Accepted
time: 286ms
memory: 17972kb
input:
130000 93933 98298 -928268677 114463 42862 480504385 94693 116413 207371788 83601 27570 -960446376 61749 75893 -2019111 109126 125203 817736688 93029 107382 518968280 69266 61806 812089858 76890 127515 -900001351 17017 3423 562363578 55127 110861 885858515 40945 70491 555055185 2057 88782 915135834 ...
output:
21630089649189
result:
ok single line: '21630089649189'
Test #64:
score: 0
Accepted
time: 297ms
memory: 18516kb
input:
130000 126576 44685 611087323 79628 39088 335195623 47050 56581 -375120777 118437 112139 966465574 103609 118948 -444728783 25842 122838 -725695712 42600 36747 842823612 100505 56990 -839239262 30250 34742 -12578690 84976 67648 -320222768 19116 13046 732559350 37121 62306 -987012185 52834 42848 -787...
output:
22179709842190
result:
ok single line: '22179709842190'
Test #65:
score: 0
Accepted
time: 323ms
memory: 18600kb
input:
130000 102319 65682 445287929 65682 120183 -551650515 109925 65682 -690148122 65682 84105 -665334363 9618 65682 120841968 122873 65682 395974163 96385 65682 -697518514 65682 780 -248348141 65682 26858 717462270 48209 65682 820993219 65682 49838 372239731 65682 121924 744394802 65682 78830 713577503 ...
output:
0
result:
ok single line: '0'
Test #66:
score: 0
Accepted
time: 390ms
memory: 17636kb
input:
130000 41957 79717 633873350 129747 40585 92346556 79717 64580 725645465 93943 79717 63116511 23535 114724 74201295 79717 109053 -416536797 37098 67244 368217182 61659 27745 -54331497 36421 28311 -339060550 28261 78906 218562188 79717 109961 334146075 97991 94971 534506800 79717 123620 478949177 686...
output:
38856904167358
result:
ok single line: '38856904167358'
Test #67:
score: 0
Accepted
time: 382ms
memory: 17468kb
input:
130000 97790 74848 188134932 124715 79412 926614356 123876 110823 738342709 84464 123876 450773342 123876 107943 350205869 61177 27643 -187303905 68104 102436 -104141538 123876 1945 604197410 55008 48597 79740882 55401 123876 187341084 64976 123876 -48800980 14037 10083 -390914404 32978 123876 -1331...
output:
35577217328701
result:
ok single line: '35577217328701'
Test #68:
score: 0
Accepted
time: 265ms
memory: 17324kb
input:
124662 68945 66812 45837506 90490 21021 -75673736 12527 95085 6595104 33748 57556 -183926936 63223 23552 130415564 87487 88750 258509314 70858 6986 246938088 20539 47854 -235798419 97425 52876 -166014929 82342 20435 132412780 124222 97392 103426421 85622 115514 142861271 111872 94141 196805846 31496...
output:
5069210605940
result:
ok single line: '5069210605940'
Test #69:
score: 0
Accepted
time: 345ms
memory: 17556kb
input:
124276 119993 89310 49226730 19172 101582 -230648794 104271 112742 57966974 77683 65840 214483679 45949 21899 -247535240 11171 302 206415370 4230 120620 138530616 33450 86360 3741416 89959 102267 222453110 25388 32710 -247360262 109341 63955 63080088 117689 102735 -216217219 64880 102111 167463848 1...
output:
4420058247872
result:
ok single line: '4420058247872'
Test #70:
score: 0
Accepted
time: 263ms
memory: 17156kb
input:
122454 111458 112546 90899632 6272 77458 221293039 96358 80977 -58081418 109679 110419 154989760 107839 3205 236018453 83797 64052 -53848040 60056 13959 -178948038 67534 42287 198204462 10568 120239 -37810023 88116 58210 -104957802 102279 76909 80455172 122442 12809 81257710 14333 70740 4253728 3842...
output:
4893736172168
result:
ok single line: '4893736172168'
Test #71:
score: 0
Accepted
time: 341ms
memory: 17388kb
input:
130000 1 2 29870674 1 5 -119046260 1 8 25229845 1 11 -179653405 1 14 219379434 1 17 -126005085 1 20 247054628 1 23 296895774 1 26 250585441 1 29 -222710103 1 32 176850939 1 35 429199426 1 38 86254584 1 41 -23816400 1 44 -58086900 1 47 242748117 1 50 -26137494 1 53 28182913 1 56 436968207 1 59 270344...
output:
27074323679098
result:
ok single line: '27074323679098'
Subtask #7:
score: 1
Accepted
Test #72:
score: 1
Accepted
time: 354ms
memory: 35012kb
input:
155000 142718 16385 813446197 92499 36250 -485918958 148672 65477 -294594638 17881 7640 -265272310 30831 66511 -13186771 29450 28401 191738694 32565 147057 -852374548 108397 135007 638468912 30205 27548 -850157239 47267 26230 889108886 135758 32616 217857508 112553 118677 53574238 119998 153226 -355...
output:
25985501670448
result:
ok single line: '25985501670448'
Test #73:
score: 0
Accepted
time: 521ms
memory: 19540kb
input:
155000 73377 61960 -191264530 76998 122962 -869562582 62005 45752 -796704201 55522 50801 -142686816 59956 106099 -855409846 53646 139438 355547823 4439 53715 -882807625 108262 94283 -838663509 112848 52301 39777490 4439 100541 465667698 33113 20630 249802209 41875 81548 -135130984 110887 130860 6620...
output:
20631362387884
result:
ok single line: '20631362387884'
Test #74:
score: 0
Accepted
time: 492ms
memory: 19288kb
input:
155000 123971 65181 533196400 47258 111300 -749102209 134334 70700 -167095496 2253 13619 -456588459 50758 53984 -138894201 111834 134334 695434580 120894 134334 -382665897 134334 73467 -166719407 16508 35797 -792288023 134334 51307 -90708565 80827 134334 295194989 70608 134334 -434398765 134334 9659...
output:
28106937804067
result:
ok single line: '28106937804067'
Test #75:
score: 0
Accepted
time: 425ms
memory: 19000kb
input:
155000 150692 134064 81888222 32161 88125 -946771037 11754 59402 -958990260 88125 96150 -360718504 107362 136975 -975544606 88125 67820 -556360139 88125 144028 -529289884 78005 6376 747430841 59008 136702 757446189 33185 88125 -37932596 109023 88125 -292097685 25751 91275 220514207 93078 88125 62278...
output:
25858820767166
result:
ok single line: '25858820767166'
Test #76:
score: 0
Accepted
time: 316ms
memory: 19076kb
input:
148944 138677 109280 65768548 25307 111369 -74050088 120192 33985 -236651754 96243 120391 143944003 59759 110940 -487522430 121825 98338 -234714210 44333 79468 73501429 37199 39425 -100485883 54896 52422 212605180 60285 79068 120750345 21520 8139 -101284079 103092 127301 -137142873 17057 87806 -9766...
output:
6059092988742
result:
ok single line: '6059092988742'
Test #77:
score: 0
Accepted
time: 445ms
memory: 19272kb
input:
148018 111449 146787 -152387052 17406 22134 -27784331 142311 109376 -57957135 95765 26897 -18766904 8266 128557 90415849 109376 69494 -85968748 129131 130996 44111170 54979 135849 195063873 83188 81134 -106484631 60776 56553 81205348 32471 54979 -126542288 56157 90486 46774881 19075 110470 -11622680...
output:
5329948591930
result:
ok single line: '5329948591930'
Test #78:
score: 0
Accepted
time: 314ms
memory: 18840kb
input:
145914 113664 14489 52126053 142675 140937 -225406548 90842 119819 -36990085 99970 59451 -169472454 145642 56528 101314626 142723 99071 135661160 70795 58768 159699350 20610 109739 -104374936 21997 138649 -18074730 64335 20903 164732615 50855 96678 -38855959 93740 29620 141963766 142308 130740 62648...
output:
5854945421820
result:
ok single line: '5854945421820'
Test #79:
score: 0
Accepted
time: 459ms
memory: 18996kb
input:
155000 78925 68264 660377870 4229 102437 743808808 36682 148498 706815242 4286 92408 209368445 129472 98040 624570439 57150 10709 795680034 99046 77027 628059835 45806 1632 924427015 98758 129472 726630390 75080 62853 813765202 122411 1520 331589909 129472 140290 515459821 129472 5029 381442447 1294...
output:
62451448069805
result:
ok single line: '62451448069805'
Test #80:
score: 0
Accepted
time: 444ms
memory: 19152kb
input:
155000 24721 126437 331107852 24721 101067 978207599 24721 36388 789792695 24721 26027 972999665 24721 102745 216566782 24721 141468 265596927 24721 39932 269456386 24721 138514 941311566 24721 47640 405532257 24721 64300 446268589 24721 74922 756103069 24721 48325 142621978 24721 41342 769115791 24...
output:
62580917263595
result:
ok single line: '62580917263595'
Test #81:
score: 0
Accepted
time: 451ms
memory: 18988kb
input:
155000 62382 107402 394450867 39309 82069 678158277 45765 122527 838636672 127135 99419 865334209 79134 2494 492935848 110774 133455 768297644 13507 122806 473293438 1502 53914 736821101 2494 4554 56941825 154427 102819 527875359 120668 129707 465031282 2494 137929 220457861 41454 20136 306595561 12...
output:
62328828639840
result:
ok single line: '62328828639840'
Test #82:
score: 0
Accepted
time: 453ms
memory: 19072kb
input:
155000 15046 135086 312352463 134066 121802 750442263 98190 92181 188912978 22587 153353 127671198 107682 144233 583530755 36976 49771 668566597 106946 19394 973284516 76570 47843 535230343 125297 134066 873266123 111503 154054 145701930 15474 82747 308543025 75861 138135 737908775 104943 36917 2802...
output:
75368374525940
result:
ok single line: '75368374525940'
Test #83:
score: 0
Accepted
time: 401ms
memory: 19084kb
input:
154999 1 2 93359528 1 5 -42047790 1 8 -204223463 1 11 284625189 1 14 65350460 1 17 283696211 1 20 433675120 1 23 -38799196 1 26 147725639 1 29 305794334 1 32 -10216951 1 35 -133595588 1 38 103008006 1 41 141168285 1 44 -67736010 1 47 477747462 1 50 378180886 1 53 -94431355 1 56 301687654 1 59 233353...
output:
32297370226433
result:
ok single line: '32297370226433'
Subtask #8:
score: 1
Accepted
Test #84:
score: 1
Accepted
time: 387ms
memory: 35464kb
input:
175000 41669 130076 -4 41411 119724 6 132250 137580 -10 98053 31473 -8 58412 37464 4 39782 72263 8 51569 73771 -4 79962 40659 2 172420 105086 7 91722 171719 -9 167901 151734 4 5863 59894 4 152348 56251 -2 42435 131626 6 110145 2805 2 161569 80775 4 34885 105731 1 127347 19401 5 140982 6392 2 121814 ...
output:
308049
result:
ok single line: '308049'
Test #85:
score: 0
Accepted
time: 378ms
memory: 21096kb
input:
175000 54143 24477 -10 97855 122608 1 82425 155407 -8 104987 135488 2 114595 107839 -1 25386 74107 -9 103485 94544 -3 109896 110572 -4 61918 107314 -7 40153 90904 -3 86203 137038 0 132846 91713 -2 20376 30042 4 18481 125289 4 104771 126511 -7 101061 74998 10 95659 48240 7 105685 130745 10 152648 165...
output:
304994
result:
ok single line: '304994'
Test #86:
score: 0
Accepted
time: 541ms
memory: 21076kb
input:
175000 107497 81291 -2 110904 110 4 173517 53931 0 107497 34266 -6 60982 65487 9 107497 97263 -5 107497 95156 -5 70636 107497 3 53059 149802 4 76741 6595 -1 107497 53061 5 107497 108531 3 107497 55521 7 4709 107497 -10 47176 42111 -4 103985 97833 -4 79294 107497 6 103063 97732 8 101897 107497 1 3091...
output:
332687
result:
ok single line: '332687'
Test #87:
score: 0
Accepted
time: 506ms
memory: 20540kb
input:
175000 8419 108216 1 153790 106793 4 99389 137837 -5 150849 157956 -2 24457 141458 5 139230 99389 9 13328 14804 0 111671 82600 -2 10809 149027 7 7894 99389 9 130589 119452 -4 144545 129090 8 102974 154732 3 107636 154683 -1 27829 18280 7 57322 139684 -1 84333 37639 -5 52070 155205 0 148288 76459 -5 ...
output:
491822
result:
ok single line: '491822'
Test #88:
score: 0
Accepted
time: 357ms
memory: 20536kb
input:
168276 92398 107212 -1 56375 88867 -2 50372 63326 -1 101881 147296 0 113385 33953 1 25539 128267 1 121356 84056 2 44630 50118 0 40601 10914 0 7639 116037 -1 66562 159067 -2 27355 46564 2 156559 144468 1 158175 44147 0 157445 143085 -2 107472 45150 1 86274 37580 -1 122893 103836 -1 114307 158326 1 68...
output:
95866
result:
ok single line: '95866'
Test #89:
score: 0
Accepted
time: 514ms
memory: 20628kb
input:
167368 144517 28192 2 362 93313 1 69516 38240 0 362 122788 0 43962 74037 2 21599 6535 -2 140284 23853 2 14 43630 -1 132160 120191 -1 98347 111123 1 139542 181 -1 37347 128666 1 40182 126874 1 108200 143659 1 13321 38240 -2 106676 133919 4 70520 140054 -1 35541 127099 -1 11497 78466 1 114334 144934 1...
output:
66778
result:
ok single line: '66778'
Test #90:
score: 0
Accepted
time: 346ms
memory: 20392kb
input:
164550 81260 83653 0 99030 30557 3 11530 74225 2 149741 46731 -1 67003 9100 -2 86733 47918 -2 59295 12410 -2 96358 115776 -2 149115 118586 2 118238 53479 1 126432 110280 -1 116830 967 -1 30277 43102 4 44033 137274 1 152938 66192 1 126213 77801 1 128807 150758 1 18612 83336 -3 82926 52543 -1 135825 1...
output:
96096
result:
ok single line: '96096'
Test #91:
score: 0
Accepted
time: 443ms
memory: 22724kb
input:
175000 158646 36639 4 36639 174920 -6 12481 36639 -2 36639 127893 -1 36639 4336 10 22498 36639 10 36639 81451 -7 36639 31534 9 36161 36639 3 36639 156562 -1 134342 36639 1 36639 1725 -6 36639 24728 10 36639 68591 -6 36639 27938 -2 36639 138403 6 36639 89545 4 36639 96243 -4 151494 36639 -5 140512 36...
output:
0
result:
ok single line: '0'
Test #92:
score: 0
Accepted
time: 575ms
memory: 21140kb
input:
175000 141302 146122 10 47866 75167 9 129172 161506 2 34139 45213 2 24321 75167 10 150358 81322 2 21142 75167 6 123849 117391 5 163679 131565 5 75167 5086 4 75167 167956 6 66327 151074 10 75167 162714 9 144123 75167 10 75167 74320 5 144773 171617 7 154134 29666 7 7394 47817 8 75167 29254 3 96304 751...
output:
961384
result:
ok single line: '961384'
Test #93:
score: 0
Accepted
time: 521ms
memory: 21152kb
input:
175000 1 174700 3 1 174001 1 1 173874 4 1 172927 1 1 172767 10 1 172502 2 1 172213 7 1 171555 4 1 170739 2 1 170303 5 1 169565 10 1 169386 9 1 169246 6 1 168773 7 1 168312 6 1 165527 1 1 165422 10 1 165293 4 1 164997 8 1 164584 4 1 164392 4 1 163691 8 1 163575 1 1 163531 8 1 162609 8 1 162432 6 1 16...
output:
964200
result:
ok single line: '964200'
Test #94:
score: 0
Accepted
time: 570ms
memory: 21224kb
input:
175000 38640 1 9 1 32152 3 1 7087 5 1 117731 8 129763 6315 9 1 128561 9 81160 79297 1 6271 1 9 117980 1 3 151350 151349 10 174402 174401 2 94501 94500 7 1 21797 3 37796 37797 7 13377 39050 7 85414 83930 1 1 111763 6 94629 94628 8 1 126749 2 87477 87476 9 1 92669 8 42433 42432 4 75130 1 5 79674 28542...
output:
963353
result:
ok single line: '963353'
Test #95:
score: 0
Accepted
time: 563ms
memory: 21096kb
input:
175000 90601 174579 1 105061 150070 2 90601 66650 6 65231 136050 6 73610 90601 5 90601 34836 0 99154 90601 4 6598 39247 3 148353 128870 9 132743 47286 8 90601 41596 0 93656 90601 5 136727 48815 3 90601 18303 5 9908 52546 1 120112 168172 2 102348 8357 1 90601 151087 5 119157 38785 4 110085 90601 8 94...
output:
917730
result:
ok single line: '917730'
Test #96:
score: 0
Accepted
time: 517ms
memory: 20596kb
input:
175000 158273 55095 8 36154 89423 10 88076 9972 6 104088 148526 1 88076 43257 8 132604 68306 6 88076 60148 10 88076 120707 9 88076 124968 10 49688 127440 8 156564 59991 1 88076 33963 10 88076 121547 6 96324 60462 7 138596 51320 1 34207 62618 1 161220 91294 8 25608 88076 1 141500 71483 7 130029 10822...
output:
761428
result:
ok single line: '761428'
Test #97:
score: 0
Accepted
time: 479ms
memory: 20408kb
input:
175000 1 2 9 1 92 6 1 395 1 1 509 9 1 638 5 1 881 8 1 1454 4 1 1475 3 1 1586 2 1 1631 2 1 1997 10 1 3713 9 1 3716 6 1 3746 6 1 3773 6 1 4259 10 1 4268 7 1 4382 8 1 4430 5 1 4559 10 1 4571 2 1 4634 2 1 4646 2 1 5534 3 1 5555 9 1 5558 1 1 5642 2 1 6686 2 1 7187 10 1 7244 7 1 7463 10 1 7580 4 1 7775 1 ...
output:
762159
result:
ok single line: '762159'
Test #98:
score: 0
Accepted
time: 503ms
memory: 20536kb
input:
175000 1 87164 10 152162 1 3 160535 1 10 73281 144662 1 55067 1 7 62240 1 6 100035 100036 3 1 135614 3 62351 12294 7 51570 51571 8 44019 44020 5 138249 138250 1 1 82259 9 148629 127658 6 160332 97445 1 1 145283 2 154761 154762 8 137738 1 10 23196 47837 7 157811 169590 2 118435 118434 5 1 151946 1 10...
output:
763236
result:
ok single line: '763236'
Test #99:
score: 0
Accepted
time: 501ms
memory: 20440kb
input:
175000 78940 43259 4 56892 112138 9 9256 47131 3 25718 56892 8 161713 113240 3 84651 3689 1 42385 60204 10 118577 75321 1 56892 167695 7 14144 151729 2 5482 22860 7 85576 163355 4 118768 56892 6 155181 134449 9 94996 66656 9 10662 107940 8 156592 140433 2 68124 118810 2 56892 14940 5 146646 56892 8 ...
output:
881017
result:
ok single line: '881017'
Test #100:
score: 0
Accepted
time: 444ms
memory: 20456kb
input:
175000 1 2 4 1 5 0 1 8 -1 1 11 4 1 14 2 1 17 3 1 20 -1 1 23 3 1 26 5 1 29 -2 1 32 0 1 35 2 1 38 1 1 41 -1 1 44 2 1 47 0 1 50 3 1 53 4 1 56 -1 1 59 -2 1 62 3 1 65 3 1 68 2 1 71 -1 1 74 3 1 77 -2 1 80 2 1 83 1 1 86 4 1 89 3 1 92 1 1 95 3 1 98 1 1 101 5 1 104 4 1 107 2 1 110 -2 1 113 3 1 116 1 1 119 1 ...
output:
350309
result:
ok single line: '350309'
Subtask #9:
score: 1
Accepted
Test #101:
score: 1
Accepted
time: 425ms
memory: 23232kb
input:
190000 188380 16760 -313975446 130102 130148 609838110 185248 4843 -898506591 14963 120696 498705930 8394 86542 -289883274 121461 90859 -335236781 10608 64725 270913813 72113 22519 -646265258 124656 182523 -418870058 94484 64153 -290245266 180996 159126 393052296 83537 105072 -92953144 80699 30348 -...
output:
32357007416004
result:
ok single line: '32357007416004'
Test #102:
score: 0
Accepted
time: 638ms
memory: 22276kb
input:
190000 80201 74219 -63914613 61189 92217 479232016 88921 171927 -212263520 154417 82353 545500067 144644 82417 911574876 154417 179053 768453773 80201 53800 919282385 19386 152712 -193943079 86271 162785 -559346135 60964 154417 -586016096 134222 123290 -754136650 134402 20768 759945414 61189 54865 2...
output:
25555411323686
result:
ok single line: '25555411323686'
Test #103:
score: 0
Accepted
time: 585ms
memory: 22020kb
input:
190000 61541 86141 364639533 170415 54881 509582668 171022 9171 -160747114 162729 113340 399813800 114827 182550 726131126 153123 162729 -471797012 92508 27095 445381628 65425 162729 795183413 162729 138637 -448152113 161137 33382 145397671 164890 162729 407698527 175885 36499 600164906 51742 162729...
output:
56645786456860
result:
ok single line: '56645786456860'
Test #104:
score: 0
Accepted
time: 520ms
memory: 21284kb
input:
190000 146340 117254 799540996 25375 106322 -788183165 137415 82609 656137106 19692 99797 -921843920 85254 99686 385521871 25375 104010 -17559175 77249 16075 613763472 106733 75594 149808390 25375 78085 176729935 25375 131529 -443371924 176279 25375 -620482460 25375 163367 -494683408 147000 37581 20...
output:
31316108355043
result:
ok single line: '31316108355043'
Test #105:
score: 0
Accepted
time: 396ms
memory: 21520kb
input:
182844 142014 78593 -117543566 24254 114068 148224416 46381 148904 112848953 42513 148626 -87030031 38669 147702 -17978611 59556 137402 -12127944 35819 49022 -40680426 79691 29612 69097397 39682 145296 -82744613 111211 103074 245254626 116723 38581 102223607 29737 28956 -248755480 170344 162235 1320...
output:
7441964574474
result:
ok single line: '7441964574474'
Test #106:
score: 0
Accepted
time: 527ms
memory: 21784kb
input:
181650 7876 106551 6683544 40103 85624 79905872 16173 74041 -210531886 135792 147827 -140939279 175144 127155 -195954298 48365 16173 149940477 85624 104603 -243640563 9417 93595 -34185723 118523 86396 7235250 148301 13928 -184136803 121181 67081 37154085 152357 65513 -163976673 51735 119233 -4764544...
output:
6440956169376
result:
ok single line: '6440956169376'
Test #107:
score: 0
Accepted
time: 402ms
memory: 21292kb
input:
178104 148810 131603 56688468 19939 103293 -108545411 24944 121916 80290345 82381 64757 142174914 40408 135689 -69183320 70879 97566 -537012243 22967 157788 59268671 149250 62544 407791383 51849 169720 -123815921 144769 177721 -111862098 35446 11916 109665031 12096 50720 171689711 176243 50323 -1556...
output:
7073698441400
result:
ok single line: '7073698441400'
Test #108:
score: 0
Accepted
time: 600ms
memory: 22268kb
input:
190000 103847 142020 408039825 142020 26219 967541293 142020 161948 909615201 160215 142020 890236884 186108 142020 111573493 142020 25143 26523438 142020 122312 870060257 142020 33296 616785550 65762 132263 425608092 142020 70509 211373633 145556 135497 303206005 108151 142020 11663131 154056 72043...
output:
95034149565403
result:
ok single line: '95034149565403'
Test #109:
score: 0
Accepted
time: 627ms
memory: 22228kb
input:
190000 53736 5169 156932354 53736 116331 808617576 53736 50086 696454928 53736 64633 118212015 53736 74850 467106647 53736 124617 206788687 53736 94145 878978562 53736 50484 535268384 53736 46561 818295765 53736 156853 665233474 53736 66614 775564252 53736 182368 422957980 53736 177855 473488688 537...
output:
95042641977932
result:
ok single line: '95042641977932'
Test #110:
score: 0
Accepted
time: 617ms
memory: 22400kb
input:
190000 116889 28385 48491443 15700 116889 954049167 165140 116889 786963327 58514 181743 649202324 85692 154652 667435009 116889 55863 557792061 116889 19336 310792209 116381 116889 184921667 151360 116889 282975926 150908 129587 245495418 116889 61515 878684000 76656 16831 184332056 166345 129928 4...
output:
95014299350471
result:
ok single line: '95014299350471'
Test #111:
score: 0
Accepted
time: 615ms
memory: 22280kb
input:
190000 61648 146197 689634483 21335 49161 801026484 184498 154269 399227883 127300 61648 880151589 171430 61648 585701718 90087 175381 154173275 178954 54676 608275853 170821 61648 196014007 61648 53414 468158809 184443 61648 341791495 66080 75652 780186575 56317 160330 679021360 61648 187324 181542...
output:
95173277950051
result:
ok single line: '95173277950051'
Test #112:
score: 0
Accepted
time: 551ms
memory: 21624kb
input:
190000 187025 2567 790580405 3991 188357 352893118 37251 187025 829010457 51475 8142 271633094 40462 9803 466929023 112370 57093 611478317 59521 115715 189773234 187025 7132 512732306 52354 187025 70309458 76030 80810 560815351 85216 97066 400706337 141819 144659 583537040 4028 188853 245947111 2235...
output:
76564395495316
result:
ok single line: '76564395495316'
Test #113:
score: 0
Accepted
time: 550ms
memory: 21528kb
input:
190000 46892 153891 621738005 46892 166224 606581206 46892 47380 902170396 46892 115597 148825569 46892 115967 993392327 46892 2585 580865420 46892 134478 196258898 46892 29186 931823140 46892 171394 730226052 46892 70866 504814518 46892 131493 517394674 46892 147678 963310174 46892 64231 725497336 ...
output:
76347623907184
result:
ok single line: '76347623907184'
Test #114:
score: 0
Accepted
time: 555ms
memory: 21736kb
input:
190000 100057 63055 903981949 84729 100057 736648670 100057 165847 105760417 4815 74900 142479802 106225 128331 297984421 125219 183816 819311089 179377 33498 235538411 101048 184660 769577730 100057 32475 138644596 146867 64228 69296634 100057 155504 65388204 175765 66773 22892346 44670 96587 21155...
output:
76531770111621
result:
ok single line: '76531770111621'
Test #115:
score: 0
Accepted
time: 578ms
memory: 21620kb
input:
190000 62343 183709 778188549 155050 40837 752501812 105372 29825 460214588 28677 98306 446049095 107950 175397 91553612 124858 135726 46264726 112661 38667 68431188 59050 137860 509107842 45961 110155 458512335 746 120875 912284269 88430 77685 52709913 119190 73236 91462307 113984 183561 865454375 ...
output:
92347596739430
result:
ok single line: '92347596739430'
Test #116:
score: 0
Accepted
time: 492ms
memory: 21584kb
input:
190000 1 2 269308301 1 5 -30569903 1 8 -145701874 1 11 345431731 1 14 378752121 1 17 15829582 1 20 120367904 1 23 431908351 1 26 239478151 1 29 302775338 1 32 481337123 1 35 143460565 1 38 38220642 1 41 -152275524 1 44 181158949 1 47 495909081 1 50 -53211578 1 53 74849516 1 56 448587071 1 59 -238943...
output:
39562285319183
result:
ok single line: '39562285319183'
Subtask #10:
score: 1
Accepted
Test #117:
score: 1
Accepted
time: 431ms
memory: 40120kb
input:
200000 192010 100601 -710193242 125005 45742 -583676550 166569 134211 504583873 183146 174511 -926879426 133200 183247 -205463417 61279 147495 49780706 69629 197413 861310099 108423 177660 451845445 198870 31785 -873564541 124830 93005 -924193847 127017 122497 855935697 144560 77801 -836868136 15350...
output:
33396860620835
result:
ok single line: '33396860620835'
Test #118:
score: 0
Accepted
time: 451ms
memory: 23968kb
input:
200000 54480 3739 421289517 194179 81551 711330460 109863 41017 574980044 181744 195448 58747761 64317 107359 -100713458 198178 15137 -766700761 84949 86912 936623971 68387 70370 -242178314 183909 163031 -756154033 31406 148492 309966208 176354 127485 330901663 96253 147322 722020499 48511 133918 -5...
output:
33916603763210
result:
ok single line: '33916603763210'
Test #119:
score: 0
Accepted
time: 702ms
memory: 22952kb
input:
200000 133812 101083 -5886149 164332 154462 -574292539 163952 28450 126713056 24388 20582 254149559 182644 59506 72159356 145485 53553 786646719 43790 69404 -825213440 38178 29059 -202358255 91671 97140 -614047223 106932 53553 -125400183 69404 137839 -300347392 20582 42080 -873527773 166455 95637 -5...
output:
26606564000106
result:
ok single line: '26606564000106'
Test #120:
score: 0
Accepted
time: 508ms
memory: 24652kb
input:
200000 60617 109609 -276374108 60617 172482 -307783346 60617 82156 -646416786 27929 60617 937584329 60617 98552 252330043 14851 60617 -630850818 60617 38539 -679327621 160667 60617 687626 3565 60617 163400102 60617 48647 -45880872 19016 60617 -878812965 60617 179855 -508846722 60617 44236 -163947318...
output:
0
result:
ok single line: '0'
Test #121:
score: 0
Accepted
time: 595ms
memory: 22664kb
input:
200000 122892 28686 -60876810 176777 37351 -533357534 28686 174547 -202467346 173069 109506 181656234 137745 57089 -165305456 28686 105490 -102574701 13145 65283 -596723853 69912 2653 406963891 199846 1633 427667804 34193 28343 -507958220 17554 7899 823334605 39156 28686 -232325616 136123 123936 486...
output:
36785849699028
result:
ok single line: '36785849699028'
Test #122:
score: 0
Accepted
time: 576ms
memory: 22152kb
input:
200000 44625 91793 54900388 85925 44625 -153844275 196604 142307 -210814575 172034 179911 -783085615 16986 90996 -903879599 55320 189528 -629882683 17471 50299 -456808109 152023 112032 536474787 149985 129769 -669646522 85962 44625 632752788 9005 114871 -737539092 196284 8918 -422591897 115046 18879...
output:
33570692199726
result:
ok single line: '33570692199726'
Test #123:
score: 0
Accepted
time: 595ms
memory: 22484kb
input:
200000 47656 99852 722398268 53971 99852 63696174 99852 83329 -157414486 64203 39350 131087533 180678 60135 -81191087 19204 104973 -589771027 69778 167784 845396365 140397 161944 373825922 99852 120089 -605620041 44579 132102 -613873985 121289 95523 725392089 38663 99852 -377000846 34979 10076 24975...
output:
36725894111378
result:
ok single line: '36725894111378'
Test #124:
score: 0
Accepted
time: 443ms
memory: 22724kb
input:
199972 102338 16624 -13912726 53382 38734 -195999276 77768 1032 196605408 90060 110011 -217950786 58957 6751 132230721 144599 130623 -155586433 89842 100596 246463195 73316 179467 327718556 40505 125893 -98706493 22814 152412 94522322 147012 116723 5090300 155173 114643 236019675 9292 128057 -226651...
output:
8093629686362
result:
ok single line: '8093629686362'
Test #125:
score: 0
Accepted
time: 586ms
memory: 23144kb
input:
199388 51642 193911 84424408 90847 33270 -142380726 188659 15199 -177211037 179144 91022 -29687209 29794 163240 246441302 187448 24248 -225656333 36310 123886 -181700607 192260 32708 -137249439 118932 5023 54730557 67141 184538 72263948 198503 124977 73000025 112830 192765 -246816746 109187 67927 43...
output:
7039299676414
result:
ok single line: '7039299676414'
Test #126:
score: 0
Accepted
time: 450ms
memory: 22920kb
input:
199954 140071 175607 106104291 7737 137287 106401117 53782 136993 228023082 153313 129721 89789585 90787 40487 107141269 28295 187185 224413629 7082 24320 167175757 19414 72665 -113823641 141376 196084 -160253897 127281 74252 200831721 174087 191382 -213995084 105694 59686 245103670 100703 164217 -1...
output:
7929523189006
result:
ok single line: '7929523189006'
Test #127:
score: 0
Accepted
time: 670ms
memory: 23000kb
input:
200000 76695 108075 411135331 88629 11484 322521710 191002 142240 205728027 97250 156359 949684801 172130 130418 596116319 19746 11484 253697081 11484 39513 593866389 86312 73415 827795241 44222 120494 263725250 73917 11484 16871487 11484 144202 177907573 89876 11484 621267948 20366 45664 119817988 ...
output:
100059354629616
result:
ok single line: '100059354629616'
Test #128:
score: 0
Accepted
time: 644ms
memory: 23084kb
input:
200000 87743 1 53765771 87743 10 852076600 87743 14 700566298 87743 17 20847867 87743 18 757665356 87743 23 808002677 87743 30 136060648 87743 36 300126278 87743 37 395150340 87743 49 600609298 87743 52 430782283 87743 59 747584590 87743 60 828796462 87743 63 492124250 87743 67 640942880 87743 68 38...
output:
99992078914667
result:
ok single line: '99992078914667'
Test #129:
score: 0
Accepted
time: 655ms
memory: 22932kb
input:
200000 115008 52181 972161281 155035 128793 792593014 140057 115008 736175491 18715 60050 72763470 104186 95201 339362616 37404 83777 68915448 98540 122615 471962627 115008 45612 90774826 161805 82807 175388283 55274 63603 780670251 192208 191048 282416772 123391 20534 362183798 32500 66578 84678876...
output:
99933096309342
result:
ok single line: '99933096309342'
Test #130:
score: 0
Accepted
time: 665ms
memory: 22840kb
input:
200000 96533 121976 843398567 43976 104407 912382364 6461 104407 956349613 125003 141833 549768821 158396 153825 263700469 182629 104407 73292795 168233 89585 993876493 141226 180474 937000876 17355 92921 959500012 8218 34963 248069024 175639 104407 58855660 119088 102375 76424994 104407 11982 22513...
output:
99942338847792
result:
ok single line: '99942338847792'
Test #131:
score: 0
Accepted
time: 595ms
memory: 22516kb
input:
200000 27221 3843 15773570 56118 192551 343697102 74400 122891 88287324 87063 187974 140622897 72571 81658 401892409 141993 41900 820791634 95195 138430 139880627 19731 187974 102721828 122547 19025 782377278 157179 20528 269262950 187974 135929 364445525 76989 80920 113621806 113194 140122 67121426...
output:
80538960871107
result:
ok single line: '80538960871107'
Test #132:
score: 0
Accepted
time: 580ms
memory: 22548kb
input:
200000 149409 57580 456744472 149409 82298 214155617 149409 180107 575085209 149409 168914 392632481 149409 176585 849680861 149409 185323 341962747 149409 176262 689085626 149409 29801 689085626 149409 163723 292651946 149409 60576 882294855 149409 128579 922942529 149409 15020 957769704 149409 130...
output:
80553161044200
result:
ok single line: '80553161044200'
Test #133:
score: 0
Accepted
time: 589ms
memory: 22504kb
input:
200000 139254 185778 576872834 68049 169692 547249201 60046 193472 829814728 166460 57386 375456730 78252 69864 395053228 121620 149368 694981761 156413 126016 620142343 149368 96497 746553635 26404 31787 935985133 86822 149368 292032716 93610 54095 744157131 40464 149368 906717273 149368 52375 2763...
output:
80506232040670
result:
ok single line: '80506232040670'
Test #134:
score: 0
Accepted
time: 589ms
memory: 22436kb
input:
200000 153394 145299 979773579 83810 188765 473665462 2390 82846 659926917 173982 10687 1271975 180612 25774 64838339 12188 66897 683893783 43636 155677 416330511 82971 135864 560156230 127276 82846 564523638 19279 82846 942813234 52925 82846 831556501 49974 71428 262725277 126999 58013 831224463 50...
output:
97209546623251
result:
ok single line: '97209546623251'
Test #135:
score: 0
Accepted
time: 661ms
memory: 22836kb
input:
200000 194739 107268 212883308 126994 66763 737456899 185824 148928 680780138 38936 148928 984260799 148928 23252 900235656 182707 22924 268084014 9547 155302 420462497 148928 172794 893980401 70053 83479 489889066 145108 198834 30260958 101660 190180 26985986 148928 10809 378084666 164348 12710 855...
output:
99924576811456
result:
ok single line: '99924576811456'
Test #136:
score: 0
Accepted
time: 623ms
memory: 23156kb
input:
200000 1 184365 210784087 1 57076 926656567 1 9546 23799123 1 95956 237417104 1 95930 346620785 1 62893 907478993 1 92136 123654365 1 53549 182292364 1 18385 877603315 1 141085 406783879 1 121446 580708288 1 22124 543424458 1 73841 458945292 1 11967 458945292 1 123016 798737352 1 176237 794696919 1 ...
output:
100135633328998
result:
ok single line: '100135633328998'
Test #137:
score: 0
Accepted
time: 659ms
memory: 22888kb
input:
200000 1 35811 177282851 80126 1 689798907 162191 1 880811665 1 61075 785225408 1 99040 45078062 136232 136231 407960797 1 197641 562832913 75383 75384 893362633 18192 18193 674873466 129585 1 997523555 23923 23924 306757777 135910 1 350152318 194543 30893 704278076 134077 1 384954168 28554 28553 59...
output:
99961831585329
result:
ok single line: '99961831585329'
Test #138:
score: 0
Accepted
time: 653ms
memory: 22876kb
input:
200000 99337 93619 814037223 153696 145372 190800527 99337 53067 975277061 178822 59522 464334823 164895 174574 725321321 32016 74292 446413788 62137 43707 853388311 118617 151777 290313493 167077 45534 223416116 31191 56666 872940202 78682 107742 268763374 50489 80260 811412798 99337 86006 49803532...
output:
99967098122197
result:
ok single line: '99967098122197'
Test #139:
score: 0
Accepted
time: 595ms
memory: 22440kb
input:
200000 118204 41792 651287891 170868 162031 406675705 41792 64399 256444815 190805 111507 785852074 17096 31483 982237308 69919 133746 103700344 41792 125422 999275414 28136 188854 825967871 41792 132056 350635096 67419 4805 741613431 179913 38656 910464721 41792 41577 375696975 41947 7253 323526232...
output:
80645791372410
result:
ok single line: '80645791372410'
Test #140:
score: 0
Accepted
time: 551ms
memory: 22544kb
input:
200000 1 191390 991778684 1 121499 991778684 1 78689 991778684 1 131576 561826440 1 141176 803755981 1 191417 939921534 1 173477 573867565 1 91871 869953886 1 19358 869953886 1 19127 353468439 1 84170 391541595 1 159974 683794459 1 39032 474329640 1 168515 671099090 1 199478 918726571 1 61430 173521...
output:
80740460376350
result:
ok single line: '80740460376350'
Test #141:
score: 0
Accepted
time: 563ms
memory: 22420kb
input:
200000 35397 35398 739181027 60039 60040 35566136 156306 81314 990038023 77733 77734 664763263 126051 122246 224725469 1 49721 122744448 3633 139121 709668467 179907 179908 233747818 91971 112091 379246897 33041 121587 748576768 188823 96143 590957428 64301 50061 471775925 1 38333 700593300 191089 1...
output:
80418006226988
result:
ok single line: '80418006226988'
Test #142:
score: 0
Accepted
time: 579ms
memory: 22424kb
input:
200000 185673 77933 729552246 43884 14228 825656402 152288 1 6031552 30065 1 363571394 33056 1 925618518 82145 1 893122932 152191 152190 857786406 23445 23446 396294863 1 30140 19813840 71059 71058 596331567 1 101888 112209796 134038 134037 722681806 456 457 187511522 150897 8957 954239403 157785 11...
output:
80532143170476
result:
ok single line: '80532143170476'