QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#809325 | #8191. Kingdom Connectivity | rlc202204 | AC ✓ | 49ms | 6016kb | C++17 | 1.2kb | 2024-12-11 14:15:37 | 2024-12-11 14:15:47 |
Judging History
answer
#include <iostream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <cstring>
#include <algorithm>
using namespace std;
const int N = 1e5 + 5;
typedef long long ll;
int n, m;
struct Edge {
int u, v, w;
Edge (int _u = 0, int _v = 0, int _w = 0) :
u(_u), v(_v), w(_w) {}
} e[N];
int p[N] = {0}, sz[N] = {0};
int fnd(int x) {
return p[x] == x ? x : p[x] = fnd(p[x]);
}
void unn(int x, int y) {
x = fnd(x), y = fnd(y);
if (x == y)
return;
if (sz[x] < sz[y])
swap(x, y);
p[y] = x;
sz[x] += sz[y];
}
int main() {
scanf("%d%d", &n, &m);
for (int i = 1, x, y; i <= n; i++)
scanf("%d%d", &x, &y), p[i] = i, sz[i] = 1;
for (int i = 1; i <= m; i++)
scanf("%d%d%d", &e[i].u, &e[i].v, &e[i].w);
vector<pair<int, int> > ans;
long long mst = 0ll;
sort(e + 1, e + m + 1, [](Edge x, Edge y){return x.w > y.w;});
for (int i = 1; i <= m; i++)
if (fnd(e[i].u) != fnd(e[i].v))
unn(e[i].u, e[i].v);
else
mst += e[i].w, ans.push_back(make_pair(e[i].u, e[i].v));
cout << mst << endl;
cout << (int)ans.size() << endl;
for (auto i: ans)
cout << i.first << " " << i.second << endl;
return 0;
}
/*
4 5
1 0
2 1
1 2
0 1
1 2 1
2 3 2
3 4 3
4 1 4
1 3 5
*/
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 4840kb
input:
3 3 0 0 0 1 1 0 1 2 1 1 3 2 2 3 3
output:
1 1 1 2
result:
ok OK
Test #2:
score: 0
Accepted
time: 1ms
memory: 4768kb
input:
4 5 1 0 2 1 1 2 0 1 1 2 1 2 3 2 3 4 3 4 1 4 1 3 5
output:
4 2 3 4 1 2
result:
ok OK
Test #3:
score: 0
Accepted
time: 1ms
memory: 4896kb
input:
2 1 0 0 1 1 1 2 3
output:
0 0
result:
ok OK
Test #4:
score: 0
Accepted
time: 1ms
memory: 4848kb
input:
20 10 40 78 -41 29 -91 6 6 -59 -88 23 -90 -1 74 -95 40 5 46 68 -65 36 43 95 -29 -5 -71 55 59 -18 100 72 -22 -80 51 94 90 -59 -30 -61 23 84 11 19 22179 8 14 70541 15 17 864638 7 9 709730 11 18 465599 5 10 896921 17 18 856994 13 19 906850 9 14 334413 3 19 164501
output:
0 0
result:
ok OK
Test #5:
score: 0
Accepted
time: 0ms
memory: 5084kb
input:
100 10 43 58 -15 77 -36 69 8 42 -55 97 -82 3 14 -8 -85 -2 -80 -67 -67 83 -99 91 79 -9 -14 22 -10 95 4 55 61 -5 47 -100 -77 -85 35 -86 -69 71 63 60 94 75 24 -4 94 31 -75 -71 -33 -54 9 53 34 67 -6 -54 46 -33 -72 -71 -29 90 -88 55 95 17 4 50 91 -92 -76 -74 -28 -92 28 27 -68 45 -56 98 -61 71 -70 -27 53 ...
output:
0 0
result:
ok OK
Test #6:
score: 0
Accepted
time: 1ms
memory: 4892kb
input:
100 100 -33 94 51 45 -13 66 -23 -65 -68 -93 -97 47 5 -43 58 59 49 -59 73 -91 -48 -35 -21 -50 -95 77 92 -19 60 -8 5 -3 -45 -65 7 42 83 -4 -94 22 89 -74 -7 89 70 -23 -68 60 29 -11 69 52 -5 -78 -20 -27 96 -66 95 -41 -75 15 -50 -51 77 -32 46 27 14 -34 -70 -41 47 -79 -98 98 70 -97 28 4 -72 -46 -98 -68 -1...
output:
4802547 20 28 62 6 51 82 100 41 94 6 31 3 25 36 52 25 83 68 93 40 82 24 62 9 16 39 69 55 83 55 57 79 100 42 99 24 44 21 68 33 54
result:
ok OK
Test #7:
score: 0
Accepted
time: 1ms
memory: 5124kb
input:
500 500 6461 -5605 -8688 1639 1016 -5464 7977 -5495 -9846 -8729 -7872 3185 7947 -5489 7208 -2290 1965 1940 -4033 -1639 7215 7013 8011 397 9227 7589 1691 9224 -6036 -2441 5943 4974 -8250 7617 -9671 -1695 -8306 -4673 4901 -4512 -3240 4973 -3762 -2965 4714 1996 -8754 -939 3145 865 -1310 -2770 2109 9346...
output:
21635503 104 9 407 51 208 357 457 276 395 152 403 86 481 23 276 180 277 90 114 80 194 67 275 398 471 90 154 270 320 42 159 179 440 368 466 470 495 12 134 66 370 12 326 382 481 131 353 240 471 267 373 67 455 229 240 45 114 153 210 205 436 29 256 66 243 91 308 92 406 38 449 240 398 116 259 2 480 197 4...
result:
ok OK
Test #8:
score: 0
Accepted
time: 0ms
memory: 4776kb
input:
500 800 4509 19686 -43881 26133 -10785 -37505 36138 15293 -38226 28343 -47776 -24540 15718 2240 27738 -45824 -35961 -20929 -42168 -14457 -40960 -40512 33525 44947 -12069 21068 -7695 -34744 -49327 4426 -45251 -49553 -46825 -8442 -23555 -44887 29437 -49019 -35077 -22250 24288 -44752 -11204 -3431 -2909...
output:
88362770 329 99 489 334 442 138 323 22 404 227 286 9 406 29 74 40 177 185 397 329 397 308 478 330 481 72 255 95 133 6 251 24 417 83 470 356 462 332 365 24 47 160 304 5 320 3 14 323 341 96 133 130 207 135 329 67 297 304 343 370 420 215 487 332 428 22 393 66 426 419 496 469 496 127 246 228 262 87 153 ...
result:
ok OK
Test #9:
score: 0
Accepted
time: 2ms
memory: 5132kb
input:
1000 1500 27206 66987 -19138 -62032 -97926 50623 -40883 -67683 -89886 96843 67593 -6084 20306 -17427 -69821 64898 -4554 66845 -75286 56609 66317 -33647 81960 2250 -66852 -14519 77723 -78517 -3989 -11276 -16425 -91506 38368 -55696 -69503 8295 97540 48931 -98669 80040 -84756 34181 74350 30950 -69857 -...
output:
151217768 580 640 825 208 500 111 257 167 860 829 874 120 324 544 743 175 285 106 370 125 1000 23 793 320 708 186 661 227 865 177 753 175 246 133 294 28 957 2 77 321 420 471 921 240 818 208 554 442 544 329 847 259 976 703 831 88 898 822 951 720 941 49 286 25 538 136 957 346 847 244 957 330 529 84 41...
result:
ok OK
Test #10:
score: 0
Accepted
time: 3ms
memory: 4856kb
input:
1000 2000 -506817 -323552 -859539 123701 -305467 -627254 -744334 772220 610505 43370 376279 -797951 205444 -565161 160064 -99270 -94678 208755 807789 -22557 453419 -283534 835911 165526 915021 -291782 -925807 -197634 889108 -886360 15927 -915822 -114868 739279 512085 -414379 29150 -192704 632258 -85...
output:
307722155 1027 93 520 282 629 872 944 318 458 576 905 341 428 24 377 335 826 391 482 23 403 429 514 813 881 65 794 6 147 121 544 379 630 180 357 165 894 364 590 940 966 532 642 119 474 749 828 429 878 1 905 276 825 553 702 182 718 206 974 494 763 166 240 44 668 410 604 622 704 807 864 74 546 462 852...
result:
ok OK
Test #11:
score: 0
Accepted
time: 27ms
memory: 6016kb
input:
100000 95464 -994304 -982067 -981394 -969497 -961410 -998038 -963765 -985648 -991473 -996321 -981679 -968783 -993114 -976087 -963476 -972265 -983386 -963144 -983795 -980557 -992397 -988738 -972895 -992292 -993001 -987113 -972323 -960348 -970327 -998054 -970542 -978077 -979914 -970036 -991329 -983611...
output:
7516863746 27038 31857 31873 23912 23918 74716 74753 22166 22191 20208 20212 81864 81882 60411 60414 80263 80281 56105 56108 91555 91556 91589 91599 86717 86733 48572 48589 66680 66682 90020 90031 17834 17851 31540 31569 30592 30606 25725 25735 20193 20203 44721 44744 80118 80120 3305 3325 19446 194...
result:
ok OK
Test #12:
score: 0
Accepted
time: 40ms
memory: 5980kb
input:
100000 84355 -978830 -977530 -993610 -996974 -977797 -978085 -995848 -998135 -989848 -995378 -994012 -979183 -996211 -979321 -998701 -992462 -996698 -974183 -992388 -967983 -976653 -952476 -977741 -958669 -996107 -959921 -993684 -969037 -987693 -950984 -994898 -968085 -984612 -926658 -986364 -929520...
output:
5328880476 19903 77652 77653 69745 69746 11609 11619 59445 59446 41294 41304 95416 95423 24813 24816 24515 24525 14297 14300 49899 49901 34004 34010 98788 98792 4467 4471 39691 39697 75247 75248 24554 24571 38820 38830 35953 35959 9438 9439 67418 67428 64768 64772 32074 32080 96067 96069 43180 43186...
result:
ok OK
Test #13:
score: 0
Accepted
time: 46ms
memory: 5740kb
input:
100000 95145 -998301 -995613 -999595 -779952 -997609 -448596 -999162 -780021 -996111 -869574 -998688 -823757 -996152 -524906 -998192 -739820 -998269 -702062 -997530 -562347 -998420 -787781 -996631 -385177 -997551 -675832 -999396 -548203 -999099 -384741 -996201 -525195 -999495 -603338 -996549 -808405...
output:
7326776246 26482 76654 76665 28111 28150 33753 33754 31440 31447 82204 82225 45040 45043 42408 42462 55091 55102 58386 58388 4140 4146 23420 23437 12500 12528 84309 84311 47768 47782 61608 61619 39322 39340 34551 34563 13185 13208 27627 27640 54242 54270 79824 79841 86703 86718 60872 60901 14096 141...
result:
ok OK
Test #14:
score: 0
Accepted
time: 4ms
memory: 4840kb
input:
9990 9990 -999764 -21746 -999562 -29627 -998536 -54100 -992662 -120927 -990566 -137041 -990019 -140940 -985299 -170844 -983454 -181159 -979191 -202942 -977978 -208710 -968884 -247518 -964016 -265848 -958967 -283521 -950751 -309959 -945906 -324444 -943491 -331400 -939441 -342712 -927627 -373510 -9244...
output:
99868 30 6118 6119 2784 2785 2095 2096 1169 1170 8511 8512 2520 2521 9823 9824 9184 9185 3304 3305 4977 4978 3755 3756 5194 5195 7043 7044 39 40 1778 1779 7552 7553 544 545 5615 5616 1622 1623 6523 6524 6845 6846 796 797 8843 8844 3462 3463 4577 4578 7833 7834 5806 5807 9557 9558 8293 8294 4145 4146
result:
ok OK
Test #15:
score: 0
Accepted
time: 7ms
memory: 5276kb
input:
20000 20000 -1000000 -1154 -999919 -12753 -999729 -23289 -998189 -60164 -994552 -104248 -991628 -129134 -990876 -134778 -990280 -139094 -986779 -162075 -986019 -166635 -984775 -173839 -982990 -183660 -981737 -190249 -981534 -191293 -973890 -227021 -968491 -249050 -965203 -261505 -957728 -287679 -953...
output:
100310 50 3078 3079 11586 11587 1186 1187 2452 2453 12367 12368 4041 4042 6303 6304 11906 11907 6592 6593 116 117 5900 5901 3258 3259 17688 17689 470 471 15512 15513 7105 7106 16207 16208 19004 19005 9109 9110 7914 7915 3624 3625 15749 15750 16402 16403 19326 19327 1373 1374 4556 4557 13786 13787 12...
result:
ok OK
Test #16:
score: 0
Accepted
time: 0ms
memory: 4880kb
input:
5000 5000 -998015 -62988 -997099 -76121 -996440 -84306 -993700 -112077 -989058 -147534 -988543 -150945 -987686 -156454 -984955 -172814 -984882 -173229 -981831 -189759 -981306 -192459 -980609 -195978 -955576 -294748 -944299 -329090 -905821 -423663 -904985 -425444 -893211 -449639 -869309 -494270 -8673...
output:
92999 20 3395 3396 3844 3845 1765 1766 4148 4149 2811 2812 4627 4628 2552 2553 2400 2401 4282 4283 779 780 2086 2087 332 333 3624 3625 1210 1211 4962 4963 731 732 150 151 1636 1637 3115 3116 1445 1446
result:
ok OK
Test #17:
score: 0
Accepted
time: 0ms
memory: 4904kb
input:
4 5 481026 -876706 -952300 -305161 838269 545257 -355722 934591 1 2 881823 1 3 827884 3 4 468427 3 2 851603 4 2 690717
output:
1296311 2 1 3 3 4
result:
ok OK
Test #18:
score: 0
Accepted
time: 1ms
memory: 5128kb
input:
5 7 645225 -763991 -393302 -919408 -993929 110019 129373 991596 895425 445213 4 3 318765 2 1 105557 1 5 352994 3 1 888572 4 1 979578 4 5 233285 3 2 979736
output:
657607 3 4 3 4 5 2 1
result:
ok OK
Test #19:
score: 0
Accepted
time: 1ms
memory: 4824kb
input:
10 17 96541 260723 4676 998906 -15137 -988474 80951 -587100 -97401 -226454 -91866 395026 -72668 -686965 -34217 939635 43576 -900061 60077 799420 10 7 110402 1 10 334019 4 1 769669 9 4 57302 6 7 14998 3 10 199517 10 8 720599 10 6 363803 9 1 54557 10 2 376582 6 5 705835 2 8 215372 5 7 250471 8 6 95873...
output:
1232234 8 10 6 3 1 2 8 3 10 10 7 9 4 9 1 6 7
result:
ok OK
Test #20:
score: 0
Accepted
time: 1ms
memory: 5116kb
input:
15 27 -999690 24877 -52265 -998632 -487971 -872858 -109545 993982 448052 -894006 -952472 -304621 946720 -322057 -788450 -615096 -855418 517937 793370 -608738 644785 764364 -603218 797575 999702 24392 185444 982655 837465 546491 2 14 190266 3 2 163218 7 15 224175 15 14 767165 14 4 784337 12 6 759737 ...
output:
3977444 13 14 4 13 15 2 6 10 7 2 12 2 5 7 15 10 14 2 14 3 2 11 14 9 1 12 1
result:
ok OK
Test #21:
score: 0
Accepted
time: 1ms
memory: 4820kb
input:
20 37 -999928 -11957 966237 -257655 62621 -998036 -729862 -683593 -598543 801090 -195015 -980799 383823 -923406 -885971 463740 991162 132654 456934 889501 164815 986324 -920717 -390227 782537 622604 822897 -568190 631443 -775421 -532069 -846699 -983196 182549 904346 426799 -8838 999961 -418165 90837...
output:
6185267 18 12 16 5 8 18 11 9 18 19 20 7 15 16 6 7 1 11 1 9 1 6 3 15 9 13 10 12 4 20 5 5 17 18 13 2 9
result:
ok OK
Test #22:
score: 0
Accepted
time: 1ms
memory: 5092kb
input:
20 43 2 -2 3 3 1 1 6 0 0 0 6 -2 3 1 5 1 1 -1 4 -2 7 -1 3 -3 2 2 3 -1 5 -1 2 0 4 0 4 -4 5 -3 4 2 16 7 793409 12 18 895628 8 15 513609 10 18 790846 14 12 291776 1 14 873377 15 19 223927 9 16 977633 3 16 691351 15 4 739073 19 6 863477 3 9 521905 7 20 538816 2 7 753129 14 17 643481 3 13 35718 1 12 38060...
output:
8158979 24 16 14 16 1 8 4 9 1 7 20 3 9 8 15 20 17 4 11 7 17 13 16 13 7 10 19 14 12 17 10 14 10 15 19 15 6 12 10 10 15 20 8 5 9 1 12 3 13
result:
ok OK
Test #23:
score: 0
Accepted
time: 1ms
memory: 4824kb
input:
6 10 -993929 110019 0 0 895425 445213 129373 991596 645225 -763991 -393302 -919408 2 6 893853 4 1 591148 2 3 693109 2 1 436339 3 4 435093 6 5 801121 2 4 94119 5 3 78615 2 5 736604 1 6 783022
output:
1780770 5 2 5 2 1 3 4 2 4 5 3
result:
ok OK
Test #24:
score: 0
Accepted
time: 1ms
memory: 4852kb
input:
11 20 -955215 -295909 -107757 -994176 -459806 888019 -938206 346073 682650 730745 834497 -551012 540597 -841281 0 0 -751546 -659679 999336 36443 307317 951607 1 9 447695 3 4 437905 8 6 354926 8 2 39719 8 7 880369 8 5 258551 8 10 821647 9 2 733976 6 10 76474 10 5 475422 2 7 373584 4 1 171815 8 3 5626...
output:
2054985 10 10 5 3 4 8 6 8 5 4 1 11 3 6 10 8 9 8 2 8 1
result:
ok OK
Test #25:
score: 0
Accepted
time: 0ms
memory: 4900kb
input:
20 38 478810 877918 -966188 -257834 -990820 135183 692579 721342 -895164 445735 -56605 -998396 -848216 -529648 948745 -316042 157536 987513 587604 -809147 -254745 -967007 793398 -608703 -414742 909939 941307 337551 0 0 999813 19317 -684680 728843 -229445 973321 -661508 -749936 271819 -962347 10 12 1...
output:
5611794 19 16 14 6 20 15 6 15 2 15 3 17 5 15 18 15 16 15 4 15 9 15 17 7 19 10 12 15 13 4 1 12 8 5 3 19 11 15 10
result:
ok OK
Test #26:
score: 0
Accepted
time: 1ms
memory: 4848kb
input:
50 97 -806860 -590741 759929 -650005 67467 -997720 -755623 655006 585289 -810823 176385 984321 673019 -739624 973666 -227978 -959135 -282944 999997 2507 -885800 464065 -62740 -998029 619276 785174 795653 605752 292656 956218 935101 -354381 994855 -101306 -908562 -417747 -629819 -776740 871471 490447...
output:
13499181 48 14 40 27 23 21 32 2 8 49 27 19 39 19 30 32 19 32 48 8 17 48 7 49 11 5 7 32 47 49 23 6 35 6 36 38 11 17 15 2 15 46 15 24 43 48 33 48 2 23 32 34 40 40 15 4 38 23 9 40 31 33 3 27 37 6 50 32 2 17 10 25 45 41 21 26 34 29 20 28 21 43 7 9 18 2 44 3 22 47 19 2 42 32 15 17 40
result:
ok OK
Test #27:
score: 0
Accepted
time: 1ms
memory: 4844kb
input:
100 197 931642 -363375 -991101 -133102 -561984 827147 869922 493190 992265 -124138 -935537 353225 812062 -583571 -642754 766072 -470740 -882270 204702 -978823 -864513 -502608 -40373 -999184 687174 -726492 -601903 798569 -212183 977230 -854776 518996 316742 -948511 -997773 -66691 677027 735958 -74366...
output:
29184716 98 79 98 21 73 17 68 14 16 16 63 16 6 43 16 17 4 21 16 23 68 14 84 16 93 1 96 88 9 99 19 35 24 17 83 78 74 19 22 37 72 11 53 89 75 8 84 88 51 2 37 19 86 57 30 12 75 21 19 91 75 98 23 96 54 18 9 68 69 95 80 82 3 79 68 53 51 49 93 49 16 88 53 13 39 85 100 34 24 64 4 59 73 40 57 10 62 51 56 21...
result:
ok OK
Test #28:
score: 0
Accepted
time: 0ms
memory: 4848kb
input:
1000 1997 -956536 -291609 169782 -985481 -822499 -568764 447057 894505 494494 -869180 912295 409534 984939 -172900 -767437 641123 603249 -797552 688371 725359 -871246 490845 -978093 -208165 993062 -117595 676641 -736312 270192 962806 14865 -999889 441010 897502 598281 -801285 -634209 773161 -158384 ...
output:
306834931 998 44 384 928 155 286 198 69 832 128 849 928 332 558 960 562 957 40 556 381 655 802 183 618 536 540 849 811 377 437 36 974 849 863 76 343 13 19 119 198 332 556 232 110 19 910 335 663 56 536 901 163 236 741 476 773 616 165 489 271 507 5 469 895 461 543 347 838 906 447 603 928 286 109 392 6...
result:
ok OK
Test #29:
score: 0
Accepted
time: 0ms
memory: 4784kb
input:
1000 1997 50755 -998710 -961105 276179 996924 78368 604018 -796969 841037 -540977 -997905 -64679 91999 995759 -710854 -703337 277245 960799 8565 -999962 158903 -987293 -962055 272851 695214 -718802 753624 657306 -29442 -999565 116490 993192 929466 368909 -411185 911552 -968202 -250166 998906 46773 3...
output:
282092976 998 176 293 894 693 176 694 176 373 26 275 551 567 176 241 807 376 176 245 176 407 701 475 567 539 176 233 176 603 176 414 176 297 892 325 714 438 176 482 988 1000 176 702 877 131 176 724 176 497 176 826 76 499 176 322 176 434 102 310 919 430 176 171 176 267 905 58 599 253 176 666 176 572 ...
result:
ok OK
Test #30:
score: 0
Accepted
time: 0ms
memory: 4880kb
input:
1000 1997 -736773 -676138 919894 392166 -935010 354618 -885984 463714 995417 95634 -574165 818739 -432088 901831 781697 623659 995862 90881 881685 471839 112908 -993604 -888235 459387 -410140 912022 -137451 -990507 78861 996886 -854431 519564 33217 -999447 -761203 -648511 -873495 486831 -859030 5119...
output:
293595609 998 685 119 742 321 769 906 549 906 346 466 913 97 661 213 376 906 668 906 376 969 784 700 824 946 872 845 943 632 442 906 783 906 201 906 370 906 717 906 978 350 172 906 713 906 207 275 869 906 249 906 802 407 648 906 513 652 427 906 819 436 529 906 738 464 140 906 207 906 232 906 377 906...
result:
ok OK
Test #31:
score: 0
Accepted
time: 0ms
memory: 4916kb
input:
1000 1997 961910 273366 -492262 -870445 148619 988895 -111858 -993723 -274497 961588 -611202 -791473 -511884 -859053 559445 -828867 -618945 785434 975505 219979 552400 -833579 -939246 343242 -997707 67664 -955735 294225 -344056 -938948 -603397 797440 -982855 184376 167483 985875 -909944 -414728 -753...
output:
296154049 998 751 974 431 907 92 896 887 178 989 390 402 24 297 968 885 847 613 651 210 659 529 116 289 592 399 49 152 466 92 847 636 158 962 357 304 132 203 863 47 347 659 360 154 269 159 137 250 919 817 370 116 298 575 310 927 209 332 710 896 406 417 887 728 35 262 378 895 724 222 42 556 545 536 5...
result:
ok OK
Test #32:
score: 0
Accepted
time: 0ms
memory: 5132kb
input:
1000 1997 88 -88 18 -18 372 -372 97 -97 395 -393 80 -78 201 -199 297 -295 252 -250 188 -188 113 -113 28 -28 27 -27 2 0 124 -122 71 -69 249 -247 247 -247 195 -195 280 -278 50 -48 165 -165 290 -290 285 -283 321 -321 308 -308 443 -441 167 -165 34 -32 385 -383 132 -130 453 -451 217 -217 465 -465 3 -1 73...
output:
302410609 998 224 959 903 690 221 830 342 32 325 487 810 347 157 977 830 185 813 977 422 420 336 83 656 642 87 889 749 167 706 1 33 320 839 480 884 206 949 43 545 772 944 125 838 903 835 617 425 740 774 880 192 535 364 509 543 646 179 737 657 767 979 662 253 925 831 156 217 838 137 469 50 505 387 94...
result:
ok OK
Test #33:
score: 0
Accepted
time: 0ms
memory: 5104kb
input:
1000 1997 178 178 36 34 136 136 320 318 6 6 483 483 272 272 42 42 105 103 443 441 332 330 54 52 341 341 415 413 295 295 328 326 379 377 300 300 191 189 144 144 133 133 395 393 191 191 103 101 282 282 390 390 335 335 427 425 29 29 5 3 137 137 142 142 151 151 204 204 82 80 416 416 326 326 81 79 186 18...
output:
289583597 998 501 576 169 695 650 510 248 16 467 600 115 191 904 296 397 219 26 207 603 557 656 581 890 389 831 587 182 648 417 733 932 641 369 471 250 244 311 775 505 312 264 487 532 271 515 593 124 357 374 701 831 864 959 332 5 790 821 477 227 465 673 275 257 898 311 679 612 835 333 83 544 914 671...
result:
ok OK
Test #34:
score: 0
Accepted
time: 0ms
memory: 4848kb
input:
998 1993 257 257 201 -200 137 -264 30 -371 85 85 115 115 355 -46 410 9 114 -287 15 15 416 15 440 39 454 53 205 205 284 -117 419 18 130 130 56 56 439 38 245 -156 27 27 83 -318 413 413 338 -63 276 276 55 55 210 210 222 -179 281 -120 384 384 153 153 477 477 362 -39 20 20 343 343 472 71 219 219 441 40 2...
output:
283115824 996 924 805 940 589 145 529 784 902 130 987 30 440 42 936 700 2 463 22 749 174 665 668 180 137 989 769 134 850 128 29 217 927 552 516 928 185 533 31 823 30 914 444 918 818 248 723 506 750 741 719 643 841 752 243 138 540 615 88 613 463 964 634 947 638 571 447 922 718 981 68 492 410 528 520 ...
result:
ok OK
Test #35:
score: 0
Accepted
time: 2ms
memory: 4848kb
input:
1000 1997 -956536 -291609 169782 -985481 -822499 -568764 447057 894505 494494 -869180 912295 409534 984939 -172900 -767437 641123 603249 -797552 688371 725359 -871246 490845 -978093 -208165 993062 -117595 676641 -736312 270192 962806 14865 -999889 441010 897502 598281 -801285 -634209 773161 -158384 ...
output:
299154023 998 176 331 83 53 330 933 214 529 597 312 54 655 260 643 75 701 285 630 981 423 571 957 472 55 411 826 393 126 863 802 953 539 78 898 539 55 400 118 411 265 245 492 958 747 984 694 628 5 529 716 578 616 852 544 970 170 938 773 733 684 259 969 228 960 657 279 106 976 968 267 625 634 647 588...
result:
ok OK
Test #36:
score: 0
Accepted
time: 6ms
memory: 4964kb
input:
5000 9997 195408 980722 -863230 -504808 -925060 -379818 447539 -894264 -912854 408284 47921 -998850 764742 644336 -650840 -759213 -964489 264120 859810 510614 -961133 276083 432381 901691 -459422 -888217 999864 16511 994491 -104821 -839408 -543500 931358 -364103 199865 -979823 -947392 -320072 -61250...
output:
1446426524 4998 2173 2719 2669 4750 2669 221 2669 4234 2669 2261 2669 4085 221 1966 2669 2534 2669 2201 2669 1941 2669 1548 2669 2822 2669 4088 2669 568 2669 3476 2669 3934 2669 1207 4152 3480 2669 1701 938 2839 2669 2960 2669 1786 2669 3257 4145 2003 2669 4654 2669 1833 2669 4537 2669 2506 3778 310...
result:
ok OK
Test #37:
score: 0
Accepted
time: 0ms
memory: 5256kb
input:
5000 9997 574847 -818260 361619 -932325 275949 -961171 758683 -651459 270205 962803 -354746 -934961 -646747 -762702 968037 -250806 -887521 -460764 -994033 109072 -732379 -680895 -878268 478167 -972599 232484 -481638 -876369 982150 -188098 -410686 -911775 -470317 -882496 -999721 23595 938565 345102 -...
output:
1456335310 4998 969 3742 500 3043 4337 4192 2089 861 3492 961 2876 2948 3619 3901 375 4424 1843 4296 3846 4005 849 1326 120 729 430 3530 603 3405 4866 1943 1009 1221 2193 2721 4062 3307 2743 704 4290 1913 1613 3674 2335 816 3493 1960 3955 3969 4188 4640 1685 2816 4906 1847 4617 2743 2538 870 1800 17...
result:
ok OK
Test #38:
score: 0
Accepted
time: 35ms
memory: 5624kb
input:
50000 99997 22375 -22373 20951 -20951 560 -560 14314 -14314 17905 -17903 14763 -14761 3233 -3233 11932 -11930 19661 -19661 2017 -2017 24994 -24994 1605 -1605 7909 -7907 21261 -21259 15413 -15411 13483 -13481 17012 -17010 22562 -22562 4216 -4216 11890 -11890 3251 -3251 12138 -12136 11909 -11909 21412...
output:
14590783298 49998 36255 1942 39524 49260 20303 12157 40570 39998 34080 7716 343 18769 49084 11282 8878 48506 21956 44149 9037 11170 49257 28965 27007 44211 38458 4644 3078 26812 9022 48091 32264 21990 46307 9634 38080 21727 42455 9799 32537 708 38576 40796 30676 31013 42286 28026 9980 16613 29530 15...
result:
ok OK
Test #39:
score: 0
Accepted
time: 0ms
memory: 4864kb
input:
1000 1998 743042 -669244 595139 803623 -874191 -485579 -511148 859492 653139 -757237 994203 107519 999995 3095 4389 999990 -690253 -723567 446729 894669 -549348 835593 959631 281261 -632260 -774755 -950840 309681 -925247 -379362 -990922 134432 274465 -961596 -775389 -631481 748767 662834 669390 7429...
output:
282357251 999 653 252 712 89 712 752 712 660 429 631 498 584 712 237 712 916 712 433 712 473 367 345 712 288 712 770 712 975 712 695 712 467 712 767 712 384 636 926 712 823 712 854 712 286 707 837 712 668 712 308 712 53 712 287 712 794 712 92 712 594 81 167 450 523 712 412 712 694 712 334 712 423 71...
result:
ok OK
Test #40:
score: 0
Accepted
time: 2ms
memory: 4816kb
input:
932 1862 -658956 752181 819403 573217 775409 631460 -99631 -995023 305036 -952340 992175 -124851 -253674 -967288 44816 998995 -742993 -669297 -574765 818318 701484 -712684 -850373 526178 -776712 -629854 827495 561473 913910 -405915 -296957 954891 -96612 995322 512836 -858486 933330 359019 186881 -98...
output:
276607687 931 300 729 117 50 188 829 188 126 188 476 188 666 188 74 759 787 269 33 835 226 768 805 188 618 188 735 213 424 188 624 188 619 699 261 188 292 135 835 188 76 738 333 582 909 382 213 188 501 37 731 578 101 130 502 188 689 248 126 874 709 617 526 18 864 176 683 713 547 459 96 359 403 188 3...
result:
ok OK
Test #41:
score: 0
Accepted
time: 2ms
memory: 4860kb
input:
441 1240 14 6 17 1 15 1 21 -7 17 -17 18 14 27 -13 29 9 26 -4 29 5 35 3 24 10 8 2 7 3 12 -12 30 10 20 -6 29 -11 34 -2 6 6 11 9 32 -8 22 -18 22 18 32 2 22 4 8 -4 15 -9 0 0 17 -3 18 2 12 4 21 9 18 8 15 -1 15 7 20 -8 9 -1 27 -7 26 4 21 1 23 -7 17 -11 16 10 25 -9 34 -4 12 -4 25 -11 24 14 10 0 25 -1 23 11...
output:
270950102 800 100 377 208 33 221 210 360 169 163 240 213 268 25 72 57 366 126 396 118 403 275 255 284 192 59 319 35 365 304 141 40 381 42 289 116 164 169 267 115 281 133 324 347 185 108 182 229 426 33 371 357 105 32 181 332 441 241 281 329 141 75 156 2 314 321 108 366 72 300 27 187 148 253 263 285 4...
result:
ok OK
Test #42:
score: 0
Accepted
time: 0ms
memory: 4816kb
input:
1000 2861 16 -14 26 -2 23 -23 21 -15 22 -8 34 -4 43 -35 57 -27 29 -11 16 6 16 -10 26 6 49 -27 54 -38 46 -10 29 7 18 2 54 -28 37 -23 43 -41 50 -14 54 -42 33 -25 47 -31 38 -14 31 -9 45 -25 6 -4 44 -12 39 -15 13 1 37 -5 22 8 47 -15 31 -3 32 4 28 -22 52 -14 26 0 44 -38 13 3 50 -20 35 1 9 -1 48 -44 27 1 ...
output:
626061904 1862 7 250 230 252 153 42 991 965 270 215 31 708 902 292 126 804 86 674 699 678 754 790 747 212 437 50 207 869 713 146 492 872 530 480 761 376 548 7 266 167 510 2 599 437 797 230 950 739 491 762 210 126 427 295 208 372 289 932 182 711 983 638 268 449 203 156 761 860 268 416 784 667 440 203...
result:
ok OK
Test #43:
score: 0
Accepted
time: 2ms
memory: 4840kb
input:
484 1365 1050 3504 1770 1356 3100 2323 2040 5145 2580 3534 1870 2419 240 4389 730 715 520 1852 2050 4945 1000 1441 790 2578 2280 3408 1670 3356 280 3589 320 2789 610 3115 580 3715 590 452 3000 1260 1620 1293 260 3989 1180 904 2100 3945 -160 3200 600 252 -180 3600 110 863 1030 3904 1750 1756 2820 486...
output:
300176030 882 42 88 59 328 363 465 428 30 207 422 115 52 182 283 244 361 148 388 473 149 238 65 299 291 153 106 286 99 301 251 52 117 45 331 360 369 402 148 265 155 101 273 454 319 346 46 416 116 217 100 104 225 167 172 482 99 2 171 411 157 441 238 421 448 459 67 64 182 10 317 447 401 315 406 265 22...
result:
ok OK
Test #44:
score: 0
Accepted
time: 2ms
memory: 4912kb
input:
462 1301 4969 1941 10679 4227 2114 798 6664 2657 4420 1712 5813 2314 1558 599 10686 4197 9231 3626 7426 2912 6177 2397 4962 1971 7474 2941 5724 2226 9972 3971 11633 4598 7076 2769 10981 4341 8325 3284 5120 1998 4667 1827 5875 2283 5772 2255 8682 3397 10233 4026 7968 3171 5621 2198 10480 4141 3816 14...
output:
277864612 840 46 190 39 175 87 9 147 440 11 38 41 307 45 88 216 132 207 37 97 78 55 41 221 102 47 276 7 386 270 160 88 264 27 333 423 239 179 311 23 333 96 268 44 460 196 176 305 197 101 60 121 81 103 382 85 220 332 278 72 202 434 277 100 103 4 86 357 304 103 175 44 330 415 100 359 147 18 422 193 31...
result:
ok OK
Test #45:
score: 0
Accepted
time: 4ms
memory: 5156kb
input:
1000 2781 42 -741 60 -2856 74 -2870 68 -2864 21 -2817 61 -5653 32 -3527 44 -44 50 -1448 82 -4975 27 -2823 22 -4216 41 -4235 71 -4265 82 -3577 2 -1400 97 -796 22 -5614 49 -2146 70 -70 31 -730 43 -4237 36 -6327 46 -3541 24 -723 14 -1412 85 -5677 92 -2189 58 -4951 82 -4276 31 -31 58 -4252 21 -3516 32 -...
output:
595437187 1782 208 891 666 542 704 843 14 535 74 86 418 995 40 917 406 377 229 582 642 624 691 995 445 554 289 895 638 741 968 131 414 160 389 994 570 88 847 369 196 403 957 42 174 322 476 572 34 506 252 40 619 6 586 208 919 91 937 289 447 590 313 232 793 68 52 344 839 276 215 958 227 673 349 128 77...
result:
ok OK
Test #46:
score: 0
Accepted
time: 32ms
memory: 5404kb
input:
50000 99998 895518 445026 -773285 634057 37326 -999302 982499 -186267 -872810 488058 835301 549792 982268 -187482 571668 820485 951826 306638 -917330 398126 996856 79232 138620 990346 967816 251660 -370292 928915 517841 855477 615906 -787818 -945709 325011 -937870 -346983 -809510 587104 -731758 6815...
output:
14552026705 49999 34112 10926 34112 35488 34112 25517 34112 36460 22752 13127 34112 47391 34112 25653 34112 13318 34112 17331 41984 14636 34112 26445 22933 33095 34112 41885 34112 44356 23159 6601 15873 44717 34112 35734 34112 38050 36807 6057 10326 31497 34112 49584 34112 30632 28324 35843 34112 56...
result:
ok OK
Test #47:
score: 0
Accepted
time: 43ms
memory: 5280kb
input:
43158 86314 -801947 -597393 47219 -998884 937233 -348702 1000000 -859 258974 -965883 -969481 245161 746564 -665313 67442 -997722 -493991 869466 425278 905063 953777 -300515 483670 -875249 -997528 -70253 999971 7617 -855483 -517828 993984 -109526 -155829 -987783 993695 -112113 704422 -709780 683917 7...
output:
12501387972 43157 36067 25907 36067 42663 36067 2744 36067 6156 36067 24026 38979 38342 347 9562 36067 35362 41518 23342 36067 8756 36067 39217 36067 22137 36067 2034 36067 32964 36067 14232 36067 34594 36067 26457 36067 15088 36067 740 36067 37836 36067 35112 1856 506 33097 26639 36067 6847 36067 1...
result:
ok OK
Test #48:
score: 0
Accepted
time: 15ms
memory: 5044kb
input:
10201 30200 41 17 80 42 84 40 40 -2 115 -53 153 -13 75 59 90 50 99 -83 96 -32 76 -4 109 -15 17 11 8 0 164 -36 154 36 156 24 93 71 158 18 136 44 97 -73 104 60 84 -10 110 84 106 -54 109 75 37 -5 114 -40 117 43 135 -17 77 -41 30 14 106 0 88 -52 135 17 105 -75 88 -2 32 30 98 42 128 0 29 27 95 -73 84 -62...
output:
6798830915 20000 4469 3002 9324 8620 1994 2343 8847 3841 3352 2786 8 5795 7197 375 2870 6152 8936 2030 9828 7251 7053 4749 8272 2107 7281 3142 7294 5973 1496 280 4538 2564 5207 2506 7197 2802 2211 5820 3002 2193 4750 4533 7729 3664 5943 5430 1781 9259 7058 9011 4862 992 4009 90 9789 6437 4770 2255 9...
result:
ok OK
Test #49:
score: 0
Accepted
time: 20ms
memory: 5004kb
input:
13000 38541 96 -52 128 -32 133 -7 156 -70 89 49 62 -58 100 -4 161 25 109 -73 130 -54 80 -64 120 -4 134 -70 134 46 75 17 164 -4 167 -45 80 60 194 -44 174 -8 120 -40 102 -84 43 43 180 14 105 53 122 28 94 -10 49 21 115 17 166 -58 112 -68 106 -36 90 34 89 -53 146 -84 70 -30 139 -59 87 43 163 -71 16 -12 ...
output:
8745854394 25542 4001 8989 8109 7630 10023 9467 8530 4464 2903 9605 8625 1622 1893 8281 6077 7371 6219 2537 3242 8400 7370 8775 2687 6456 1478 10640 7388 10429 1082 11733 5851 10741 6990 9329 4077 10063 12279 3560 2177 5714 11987 200 1596 7784 5233 10464 6522 8044 3716 3476 12497 978 8827 6498 6347 ...
result:
ok OK
Test #50:
score: 0
Accepted
time: 40ms
memory: 5136kb
input:
23104 68705 864782 198422 -90917 408491 430138 166418 323606 327006 834353 287977 505252 710932 696467 188555 376933 552421 800159 367991 585615 129863 724982 364982 564876 348140 61413 30629 740103 708855 -13332 49548 20305 607009 515684 272092 719550 573438 399523 609667 230900 342076 773063 44515...
output:
15619069349 45602 9755 2671 2365 14270 7727 12743 7232 12624 3387 20914 11052 13322 16726 17979 20845 4047 17717 10014 18276 8252 18376 21827 4106 3065 100 12766 21082 5488 13714 18277 13101 13577 9677 10369 5696 1420 5989 10592 10791 1357 11185 15425 12984 2765 7929 3969 17945 15375 18417 17593 124...
result:
ok OK
Test #51:
score: 0
Accepted
time: 24ms
memory: 5364kb
input:
15762 46781 473918 101848 783222 564068 177724 58396 155117 24344 699330 556432 478809 515580 596969 638480 591692 39344 442820 362228 666435 455476 782545 597320 562682 442404 449938 53488 307874 205476 364749 354792 536013 607864 876725 671860 630756 164280 320155 11000 643771 178988 552103 594156...
output:
10615410672 31020 2817 2189 88 12073 13361 6309 9248 4478 6648 12608 5070 8066 5576 5210 1361 114 662 3090 1318 8741 9101 7611 9000 10321 4579 10809 9232 468 10574 5926 2496 10726 4937 4928 929 7090 5272 6943 12868 6376 11150 1630 10776 2037 13182 10766 2078 777 14783 14206 15415 7080 11056 7814 152...
result:
ok OK
Test #52:
score: 0
Accepted
time: 49ms
memory: 5464kb
input:
26700 79367 176 -19049 271 -55492 34 -23800 196 -56116 78 -16854 210 -32364 129 -63039 219 -47751 103 -12685 146 -33698 32 -13313 257 -21926 128 -59543 230 -10715 143 -20414 321 -63231 175 -40717 330 -54153 45 -18219 206 -32360 221 -13502 165 -29523 127 -38572 274 -48505 119 -69320 269 -38015 299 -3...
output:
18072458474 52668 14239 14111 15135 5418 19212 23778 14920 23972 712 19526 17186 1273 1881 1670 17674 23862 21693 14336 14655 23679 23947 19212 7195 25285 6444 1908 23821 16299 845 10371 8328 13081 11669 24382 24597 1007 23820 4839 12890 22629 25201 3408 26107 10037 23653 2412 2796 15959 7813 12888 ...
result:
ok OK
Test #53:
score: 0
Accepted
time: 36ms
memory: 5568kb
input:
39003 91002 11436 11436 12763 12763 10046 10046 107006 7005 105857 5856 104058 4057 102957 2956 107027 7026 212219 12217 210006 10004 4447 4447 9459 9459 201951 1949 112330 12329 7056 7056 206340 6338 101937 1936 204772 4770 11771 11771 108598 8597 209445 9443 107149 7148 208448 8446 205726 5724 111...
output:
16156441344 52000 16085 25154 36401 16200 21465 12185 10292 21454 6205 7993 6773 3273 37552 1204 30856 3966 3359 29257 37299 14435 985 30987 7086 9347 5928 11520 35391 18830 28688 27317 9938 15174 31940 37209 26657 37423 4525 17878 16985 28381 19847 31867 17843 3740 31922 24192 24969 5236 19675 1060...
result:
ok OK