QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#292334#7118. Closing Timehypeskynick100 ✓175ms44588kbC++143.3kb2023-12-28 01:12:042023-12-28 01:12:05

Judging History

你现在查看的是测评时间为 2023-12-28 01:12:05 的历史记录

  • [2024-04-28 08:01:48]
  • 管理员手动重测本题所有提交记录
  • 测评结果:100
  • 用时:187ms
  • 内存:44516kb
  • [2023-12-28 01:12:05]
  • 评测
  • 测评结果:100
  • 用时:175ms
  • 内存:44588kb
  • [2023-12-28 01:12:04]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ff first
#define ss second
#define pb push_back
#define pp push
vector<vector<pair<int,ll>>> graph;
vector<bool> vis;
vector<ll> seg1,seg2;

struct node{
	ll t;
	int x, cnt = 0;
	bool operator<(const node &b) const
    {
        return t < b.t;
    }
    bool operator>(const node &b) const
    {
        return b < (*this);
    }
};

int greedy(int N, int mx, ll k, ll mdist) {
    //cout <<"1\n";
	int ans = 0;
	vector<int> cnt(N, 0);
	priority_queue<node, vector<node>, greater<node>> pqa, pqb;
    //cout <<"1\n";
	for (int i = 0; i < N; i ++) {
		if (mx == 2 && seg1[i] + seg2[i] == mdist) {// case 1 a's
			ans++;
			cnt[i] ++;
			k -= min(seg1[i], seg2[i]);
            pqa.pp({abs(seg1[i] - seg2[i]), i, 1});
		} else  { 
			pqa.pp({min(seg1[i], seg2[i]), i ,0});
			if (mx == 2 ) {// case 2 the b's
				pqb.pp({max(seg1[i], seg2[i]), i , 0});
			}
		}
	}
    //cout <<"1\n";
	 auto get_top = [](priority_queue<node, vector<node>, greater<node>> &pq) -> node
    {
        return pq.empty() ? node{(ll)1e18, (ll)0} : pq.top();
    };

    auto reduce = [&cnt, &mx, &k](priority_queue<node, vector<node>, greater<node>> &pq) -> void
    {
        while (!pq.empty() && (cnt[pq.top().x] != pq.top().cnt || k < pq.top().t))
        {
            pq.pop();
        }
    };
    //cout <<"1\n";
    while (!pqa.empty() || !pqb.empty())
    {
        reduce(pqa);
        reduce(pqb);
        if (pqa.empty() && pqb.empty())
            break;
        node one1 = get_top(pqa), one2;
        if (!pqa.empty())
        {
            pqa.pop();
            cnt[one1.x]++;
            reduce(pqa);
            cnt[one1.x]--;
            one2 = get_top(pqa);
        }
        node two = get_top(pqb);
        if (pqb.empty() || one1.t + one2.t < two.t)
        {
            k -= one1.t;
            ans++;
            cnt[one1.x]++;
            if (mx == 2 && cnt[one1.x] == 1)
            {
                pqa.pp({abs(seg1[one1.x] - seg2[one1.x]), one1.x, 1});
            }
        }
        else
        {   
            ans++;
            pqa.pp(one1);
            k -= min(seg1[two.x], seg2[two.x]);
            cnt[two.x]++;
            pqa.pp({abs(seg1[two.x] - seg2[two.x]), two.x, 1});
            pqb.pop();
        }
    }
    //cout <<"1\n";
    return k < 0 ? 0 : ans;
}
void ddd(vector<ll>& cseg, int nn, ll dist) {
	vis[nn] = true;
	cseg[nn] = dist;
	for (auto [c,w] : graph[nn]) {
		if (!vis[c]) {
			ddd(cseg, c, dist + (ll)w);
		}
	}
}
int max_score(int N, int X, int Y, ll k, vector<int> U, vector<int> V, vector<int> W) {
    graph.clear();
        vis.clear();
        seg1.clear();
        seg2.clear();
    graph.resize(N);
	seg1.resize(N);
	seg2.resize(N);
    //cout <<"1\n";
    for (int i = 0; i < N - 1; i++) {
		graph[U[i]].pb({V[i], W[i]});
		graph[V[i]].pb({U[i], W[i]});
	}
	//travel through "a" values for X
    //cout <<"1\n RTE LMFAO";
    vis.assign(N,false);
	ddd(seg1, X, (ll)0);
	//travel through "a" values for Y
	vis.assign(N,false);
    //cout <<"1\n";
    ddd(seg2, Y, (ll)0);


	//max of b's and a's for X->Y
    //cout <<"1\n";
    return max(greedy(N,2, k, seg1[Y]), greedy(N,1, k, seg1[Y]));
    //return 1;
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 8
Accepted

Test #1:

score: 8
Accepted
time: 161ms
memory: 42472kb

input:

cc61ad56a4797fb3f5c9529f73ce6fcedd85669b
1
200000 31011 61157 8517583098
31011 129396 964383
1655 129396 331139
1655 191487 566483
110385 191487 865248
43212 110385 542661
43212 81682 13766
81682 91774 546589
91774 124706 780638
124706 175650 118706
10421 175650 615314
10421 151953 436270
140430 151...

output:

081ce3c351cbf526b37954b9ad30f2b531a7585c
OK
451

result:

ok 

Test #2:

score: 0
Accepted
time: 156ms
memory: 43844kb

input:

cc61ad56a4797fb3f5c9529f73ce6fcedd85669b
1
200000 97133 170892 35489415917
114511 170892 730058
34783 114511 435023
34783 47301 562314
47301 162600 457629
44856 162600 365133
44856 133801 83016
117539 133801 124222
117539 128719 199821
77871 128719 703141
77871 133155 624331
7211 133155 138691
7211 ...

output:

081ce3c351cbf526b37954b9ad30f2b531a7585c
OK
650

result:

ok 

Test #3:

score: 0
Accepted
time: 75ms
memory: 6416kb

input:

cc61ad56a4797fb3f5c9529f73ce6fcedd85669b
200
1000 611 992 5736784
504 611 954658
504 936 219278
502 936 632439
393 502 177662
267 393 570266
267 291 941365
291 310 168052
310 765 253098
635 765 724932
274 635 842125
274 799 848645
39 799 433118
39 940 705598
553 940 564063
553 960 69665
917 960 6904...

output:

081ce3c351cbf526b37954b9ad30f2b531a7585c
OK
126
38
69
34
52
33
42
32
39
41
38
36
45
84
40
44
50
42
47
34
38
47
38
37
39
37
44
39
32
33
38
54
25
36
46
33
37
35
28
36
45
43
44
49
37
33
43
44
53
42
33
30
50
41
37
40
37
44
207
31
37
45
36
43
35
40
41
39
135
53
40
32
31
37
34
38
51
48
36
40
48
42
43
43
3...

result:

ok 

Subtask #2:

score: 9
Accepted

Test #4:

score: 9
Accepted
time: 0ms
memory: 3740kb

input:

cc61ad56a4797fb3f5c9529f73ce6fcedd85669b
1
50 23 25 382806473
0 1 375710
1 2 898637
2 3 10402
3 4 536577
4 5 385023
5 6 71075
6 7 543368
7 8 301497
8 9 174394
9 10 711312
10 11 923006
11 12 675532
12 13 838667
13 14 565729
14 15 979816
15 16 862618
16 17 576015
17 18 177751
18 19 306989
19 20 881492...

output:

081ce3c351cbf526b37954b9ad30f2b531a7585c
OK
96

result:

ok 

Test #5:

score: 0
Accepted
time: 0ms
memory: 3796kb

input:

cc61ad56a4797fb3f5c9529f73ce6fcedd85669b
1
47 20 22 25669694
0 1 291237
1 2 851987
2 3 421247
3 4 962919
4 5 643085
5 6 224951
6 7 756890
7 8 147295
8 9 625823
9 10 736374
10 11 290526
11 12 335466
12 13 539086
13 14 957449
14 15 423408
15 16 932444
16 17 356032
17 18 307118
18 19 94279
19 20 989546...

output:

081ce3c351cbf526b37954b9ad30f2b531a7585c
OK
26

result:

ok 

Test #6:

score: 0
Accepted
time: 0ms
memory: 3776kb

input:

cc61ad56a4797fb3f5c9529f73ce6fcedd85669b
1
46 6 34 355277954
0 1 574359
1 2 58362
2 3 778155
3 4 538832
4 5 128903
5 6 79774
6 7 715282
7 8 259924
8 9 640303
9 10 361135
10 11 506866
11 12 527045
12 13 946672
13 14 620381
14 15 701743
15 16 766266
16 17 524732
17 18 340089
18 19 630172
19 20 357712
...

output:

081ce3c351cbf526b37954b9ad30f2b531a7585c
OK
74

result:

ok 

Test #7:

score: 0
Accepted
time: 0ms
memory: 4040kb

input:

cc61ad56a4797fb3f5c9529f73ce6fcedd85669b
1
45 14 44 70669
0 1 266130
1 2 372315
2 3 965349
3 4 119493
4 5 190522
5 6 506822
6 7 45330
7 8 423189
8 9 748532
9 10 653554
10 11 102552
11 12 90431
12 13 843259
13 14 422626
14 15 35334
15 16 1
16 17 1
17 18 1
18 19 1
19 20 1
20 21 1
21 22 1
22 23 1
23 24...

output:

081ce3c351cbf526b37954b9ad30f2b531a7585c
OK
4

result:

ok 

Test #8:

score: 0
Accepted
time: 0ms
memory: 3868kb

input:

cc61ad56a4797fb3f5c9529f73ce6fcedd85669b
1
50 0 49 332340134
0 1 987193
1 2 950856
2 3 893737
3 4 870689
4 5 810192
5 6 790242
6 7 744052
7 8 714922
8 9 677074
9 10 630082
10 11 599644
11 12 528415
12 13 491648
13 14 479486
14 15 439182
15 16 371085
16 17 357776
17 18 308161
18 19 254481
19 20 20430...

output:

081ce3c351cbf526b37954b9ad30f2b531a7585c
OK
44

result:

ok 

Test #9:

score: 0
Accepted
time: 0ms
memory: 3740kb

input:

cc61ad56a4797fb3f5c9529f73ce6fcedd85669b
1
50 0 49 329827838
0 1 972981
1 2 953594
2 3 908629
3 4 849675
4 5 808354
5 6 782643
6 7 759387
7 8 698618
8 9 650896
9 10 639153
10 11 591828
11 12 532588
12 13 503214
13 14 447660
14 15 403224
15 16 380834
16 17 327127
17 18 300115
18 19 244025
19 20 23362...

output:

081ce3c351cbf526b37954b9ad30f2b531a7585c
OK
44

result:

ok 

Test #10:

score: 0
Accepted
time: 0ms
memory: 3740kb

input:

cc61ad56a4797fb3f5c9529f73ce6fcedd85669b
1
3 0 1 1
0 1 1
1 2 1

output:

081ce3c351cbf526b37954b9ad30f2b531a7585c
OK
3

result:

ok 

Test #11:

score: 0
Accepted
time: 0ms
memory: 3860kb

input:

cc61ad56a4797fb3f5c9529f73ce6fcedd85669b
1
20 8 9 31897732
0 1 428932
1 2 103619
2 3 805647
3 4 691922
4 5 320369
5 6 755877
6 7 701672
7 8 426711
8 9 507102
9 10 492732
10 11 68466
11 12 317311
12 13 37666
13 14 499673
14 15 502226
15 16 753200
16 17 523387
17 18 904778
18 19 695859

output:

081ce3c351cbf526b37954b9ad30f2b531a7585c
OK
30

result:

ok 

Test #12:

score: 0
Accepted
time: 0ms
memory: 3792kb

input:

cc61ad56a4797fb3f5c9529f73ce6fcedd85669b
1
20 15 16 25160185
0 1 193268
1 2 139314
2 3 193167
3 4 446469
4 5 793626
5 6 502774
6 7 598587
7 8 69975
8 9 499282
9 10 943594
10 11 804459
11 12 536095
12 13 578060
13 14 142523
14 15 364845
15 16 181397
16 17 64327
17 18 224827
18 19 439557

output:

081ce3c351cbf526b37954b9ad30f2b531a7585c
OK
26

result:

ok 

Test #13:

score: 0
Accepted
time: 0ms
memory: 4064kb

input:

cc61ad56a4797fb3f5c9529f73ce6fcedd85669b
1
20 0 19 77846543
0 1 603320
1 2 433257
2 3 572719
3 4 340716
4 5 549198
5 6 383420
6 7 50703
7 8 720210
8 9 304217
9 10 162280
10 11 68594
11 12 401595
12 13 446738
13 14 920882
14 15 494739
15 16 616729
16 17 874820
17 18 269830
18 19 53532

output:

081ce3c351cbf526b37954b9ad30f2b531a7585c
OK
34

result:

ok 

Test #14:

score: 0
Accepted
time: 0ms
memory: 3736kb

input:

cc61ad56a4797fb3f5c9529f73ce6fcedd85669b
1
19 2 17 6692
0 1 748749
1 2 369010
2 3 3351
3 4 1
4 5 1
5 6 1
6 7 1
7 8 1
8 9 1
9 10 1
10 11 1
11 12 1
12 13 1
13 14 1
14 15 1
15 16 1
16 17 3346
17 18 11355

output:

081ce3c351cbf526b37954b9ad30f2b531a7585c
OK
3

result:

ok 

Subtask #3:

score: 12
Accepted

Dependency #2:

100%
Accepted

Test #15:

score: 12
Accepted
time: 1ms
memory: 3744kb

input:

cc61ad56a4797fb3f5c9529f73ce6fcedd85669b
25
20 9 16 34385
0 1 196
1 2 733
2 3 758
3 4 92
4 5 636
5 6 462
6 7 491
7 8 239
8 9 873
9 10 983
10 11 72
11 12 988
12 13 690
13 14 162
14 15 287
15 16 247
16 17 121
17 18 140
18 19 64
20 9 13 37109
0 1 530
1 2 588
2 3 841
3 4 274
4 5 994
5 6 879
6 7 879
7 8 ...

output:

081ce3c351cbf526b37954b9ad30f2b531a7585c
OK
25
25
32
30
30
29
27
29
26
34
29
26
28
27
28
25
29
31
25
35
31
29
32
32
32

result:

ok 

Test #16:

score: 0
Accepted
time: 1ms
memory: 3832kb

input:

cc61ad56a4797fb3f5c9529f73ce6fcedd85669b
1
500 370 372 19501231139
0 1 617029
1 2 797198
2 3 612141
3 4 591522
4 5 350816
5 6 688732
6 7 453281
7 8 832047
8 9 259836
9 10 18218
10 11 771848
11 12 559096
12 13 175229
13 14 52243
14 15 644076
15 16 971271
16 17 808287
17 18 369695
18 19 213453
19 20 4...

output:

081ce3c351cbf526b37954b9ad30f2b531a7585c
OK
771

result:

ok 

Test #17:

score: 0
Accepted
time: 1ms
memory: 3936kb

input:

cc61ad56a4797fb3f5c9529f73ce6fcedd85669b
1
457 25 26 23461573
0 1 966726
1 2 347411
2 3 485905
3 4 803836
4 5 621204
5 6 767483
6 7 853669
7 8 510772
8 9 966639
9 10 221347
10 11 334454
11 12 553189
12 13 435896
13 14 294128
14 15 68783
15 16 492900
16 17 272820
17 18 566713
18 19 958845
19 20 28815...

output:

081ce3c351cbf526b37954b9ad30f2b531a7585c
OK
23

result:

ok 

Test #18:

score: 0
Accepted
time: 1ms
memory: 3836kb

input:

cc61ad56a4797fb3f5c9529f73ce6fcedd85669b
1
479 90 404 53062927890
0 1 698391
1 2 854901
2 3 299918
3 4 209753
4 5 125978
5 6 520489
6 7 823919
7 8 421785
8 9 57291
9 10 69394
10 11 44699
11 12 238062
12 13 272509
13 14 761088
14 15 488160
15 16 342026
16 17 452424
17 18 632018
18 19 387438
19 20 836...

output:

081ce3c351cbf526b37954b9ad30f2b531a7585c
OK
884

result:

ok 

Test #19:

score: 0
Accepted
time: 1ms
memory: 3848kb

input:

cc61ad56a4797fb3f5c9529f73ce6fcedd85669b
1
498 4 221 105089
0 1 463553
1 2 258066
2 3 685674
3 4 722140
4 5 52711
5 6 1
6 7 1
7 8 1
8 9 1
9 10 1
10 11 1
11 12 1
12 13 1
13 14 1
14 15 1
15 16 1
16 17 1
17 18 1
18 19 1
19 20 1
20 21 1
21 22 1
22 23 1
23 24 1
24 25 1
25 26 1
26 27 1
27 28 1
28 29 1
29 ...

output:

081ce3c351cbf526b37954b9ad30f2b531a7585c
OK
4

result:

ok 

Test #20:

score: 0
Accepted
time: 1ms
memory: 3828kb

input:

cc61ad56a4797fb3f5c9529f73ce6fcedd85669b
1
500 0 499 31632470564
0 1 997408
1 2 994454
2 3 991903
3 4 985530
4 5 983290
5 6 976711
6 7 974029
7 8 971703
8 9 966164
9 10 960060
10 11 958778
11 12 955381
12 13 951080
13 14 947500
14 15 942224
15 16 937350
16 17 935562
17 18 931918
18 19 924769
19 20 9...

output:

081ce3c351cbf526b37954b9ad30f2b531a7585c
OK
420

result:

ok 

Test #21:

score: 0
Accepted
time: 1ms
memory: 3936kb

input:

cc61ad56a4797fb3f5c9529f73ce6fcedd85669b
1
500 0 499 30660962655
0 1 998751
1 2 992763
2 3 990711
3 4 984240
4 5 981786
5 6 977311
6 7 972251
7 8 968449
8 9 964070
9 10 961182
10 11 959076
11 12 955656
12 13 950815
13 14 944555
14 15 941311
15 16 939818
16 17 932874
17 18 928498
18 19 927347
19 20 9...

output:

081ce3c351cbf526b37954b9ad30f2b531a7585c
OK
412

result:

ok 

Test #22:

score: 0
Accepted
time: 0ms
memory: 3812kb

input:

cc61ad56a4797fb3f5c9529f73ce6fcedd85669b
1
100 89 91 1462096533
0 1 639564
1 2 263322
2 3 868637
3 4 907132
4 5 701936
5 6 917697
6 7 934119
7 8 807575
8 9 601671
9 10 703969
10 11 258031
11 12 55044
12 13 582886
13 14 983102
14 15 339533
15 16 15472
16 17 166131
17 18 795004
18 19 139911
19 20 2922...

output:

081ce3c351cbf526b37954b9ad30f2b531a7585c
OK
173

result:

ok 

Test #23:

score: 0
Accepted
time: 0ms
memory: 3740kb

input:

cc61ad56a4797fb3f5c9529f73ce6fcedd85669b
1
99 6 8 23890628
0 1 571377
1 2 534743
2 3 176083
3 4 349821
4 5 464742
5 6 833949
6 7 635266
7 8 963766
8 9 824768
9 10 619251
10 11 816054
11 12 582962
12 13 24653
13 14 411247
14 15 83520
15 16 285010
16 17 823410
17 18 432273
18 19 701164
19 20 741379
20...

output:

081ce3c351cbf526b37954b9ad30f2b531a7585c
OK
18

result:

ok 

Test #24:

score: 0
Accepted
time: 0ms
memory: 4076kb

input:

cc61ad56a4797fb3f5c9529f73ce6fcedd85669b
1
91 17 72 1939374049
0 1 35118
1 2 685336
2 3 413418
3 4 979322
4 5 501149
5 6 760662
6 7 759104
7 8 153862
8 9 970666
9 10 51474
10 11 696373
11 12 851934
12 13 667521
13 14 912195
14 15 281874
15 16 525370
16 17 259093
17 18 401204
18 19 408960
19 20 14573...

output:

081ce3c351cbf526b37954b9ad30f2b531a7585c
OK
171

result:

ok 

Test #25:

score: 0
Accepted
time: 0ms
memory: 3804kb

input:

cc61ad56a4797fb3f5c9529f73ce6fcedd85669b
1
92 4 26 119573
0 1 441559
1 2 282137
2 3 328693
3 4 791088
4 5 59788
5 6 1
6 7 1
7 8 1
8 9 1
9 10 1
10 11 1
11 12 1
12 13 1
13 14 1
14 15 1
15 16 1
16 17 1
17 18 1
18 19 1
19 20 1
20 21 1
21 22 1
22 23 1
23 24 1
24 25 1
25 26 59786
26 27 814959
27 28 250969...

output:

081ce3c351cbf526b37954b9ad30f2b531a7585c
OK
4

result:

ok 

Test #26:

score: 0
Accepted
time: 0ms
memory: 3752kb

input:

cc61ad56a4797fb3f5c9529f73ce6fcedd85669b
1
100 0 99 1246775789
0 1 984791
1 2 976898
2 3 941834
3 4 936109
4 5 914832
5 6 897530
6 7 873365
7 8 858001
8 9 836532
9 10 804954
10 11 790654
11 12 770728
12 13 741299
13 14 728310
14 15 705679
15 16 685271
16 17 672680
17 18 657701
18 19 624301
19 20 605...

output:

081ce3c351cbf526b37954b9ad30f2b531a7585c
OK
84

result:

ok 

Test #27:

score: 0
Accepted
time: 0ms
memory: 3792kb

input:

cc61ad56a4797fb3f5c9529f73ce6fcedd85669b
1
100 0 99 1343862634
0 1 983240
1 2 979635
2 3 956181
3 4 922454
4 5 908815
5 6 889339
6 7 860241
7 8 858057
8 9 823141
9 10 814027
10 11 799313
11 12 767645
12 13 757119
13 14 733433
14 15 709785
15 16 683477
16 17 669417
17 18 646073
18 19 633866
19 20 602...

output:

081ce3c351cbf526b37954b9ad30f2b531a7585c
OK
88

result:

ok 

Subtask #4:

score: 14
Accepted

Dependency #3:

100%
Accepted

Test #28:

score: 14
Accepted
time: 1ms
memory: 3844kb

input:

cc61ad56a4797fb3f5c9529f73ce6fcedd85669b
60
50 1 40 432415399
0 1 368374
1 2 617489
2 3 306692
3 4 798376
4 5 793297
5 6 739002
6 7 827272
7 8 36264
8 9 734569
9 10 348508
10 11 330646
11 12 207010
12 13 915258
13 14 860319
14 15 979734
15 16 380786
16 17 247273
17 18 379557
18 19 570364
19 20 88142...

output:

081ce3c351cbf526b37954b9ad30f2b531a7585c
OK
75
75
75
71
72
75
77
77
75
77
76
72
77
76
80
75
74
74
74
72
79
80
74
76
79
78
76
75
70
75
78
70
70
77
77
75
72
79
80
74
74
77
75
76
77
74
73
70
76
79
73
74
72
70
72
75
77
75
79
73

result:

ok 

Test #29:

score: 0
Accepted
time: 2ms
memory: 4380kb

input:

cc61ad56a4797fb3f5c9529f73ce6fcedd85669b
1
3000 2070 2072 1089598154219
0 1 122799
1 2 916338
2 3 195082
3 4 407254
4 5 870644
5 6 481623
6 7 981840
7 8 866223
8 9 620294
9 10 769645
10 11 402571
11 12 139469
12 13 712968
13 14 922546
14 15 258282
15 16 396994
16 17 976517
17 18 236766
18 19 643813
...

output:

081ce3c351cbf526b37954b9ad30f2b531a7585c
OK
5595

result:

ok 

Test #30:

score: 0
Accepted
time: 2ms
memory: 4304kb

input:

cc61ad56a4797fb3f5c9529f73ce6fcedd85669b
1
2788 1953 1954 23715317
0 1 128657
1 2 425890
2 3 493866
3 4 293698
4 5 320364
5 6 454095
6 7 554620
7 8 993194
8 9 916966
9 10 967007
10 11 259469
11 12 232222
12 13 735660
13 14 792789
14 15 243400
15 16 699046
16 17 819444
17 18 831242
18 19 999744
19 20...

output:

081ce3c351cbf526b37954b9ad30f2b531a7585c
OK
26

result:

ok 

Test #31:

score: 0
Accepted
time: 2ms
memory: 4404kb

input:

cc61ad56a4797fb3f5c9529f73ce6fcedd85669b
1
2808 2 2807 2639466957435
0 1 502306
1 2 406185
2 3 189549
3 4 258275
4 5 579629
5 6 609120
6 7 110030
7 8 526094
8 9 798960
9 10 580118
10 11 354523
11 12 266260
12 13 57024
13 14 764532
14 15 2984
15 16 15589
16 17 433020
17 18 369341
18 19 192624
19 20 4...

output:

081ce3c351cbf526b37954b9ad30f2b531a7585c
OK
5424

result:

ok 

Test #32:

score: 0
Accepted
time: 0ms
memory: 4416kb

input:

cc61ad56a4797fb3f5c9529f73ce6fcedd85669b
1
2921 554 2419 2197312943301
0 1 333995
1 2 589881
2 3 875597
3 4 174524
4 5 69440
5 6 326830
6 7 802041
7 8 66604
8 9 18419
9 10 164377
10 11 189871
11 12 722407
12 13 880795
13 14 313302
14 15 920145
15 16 689978
16 17 782838
17 18 415604
18 19 829763
19 2...

output:

081ce3c351cbf526b37954b9ad30f2b531a7585c
OK
5567

result:

ok 

Test #33:

score: 0
Accepted
time: 0ms
memory: 4360kb

input:

cc61ad56a4797fb3f5c9529f73ce6fcedd85669b
1
2775 1628 2116 119358
0 1 815865
1 2 451060
2 3 381411
3 4 962826
4 5 316023
5 6 912590
6 7 146037
7 8 536110
8 9 560340
9 10 585798
10 11 444260
11 12 375512
12 13 335836
13 14 727105
14 15 577616
15 16 311763
16 17 736588
17 18 299176
18 19 125206
19 20 8...

output:

081ce3c351cbf526b37954b9ad30f2b531a7585c
OK
3

result:

ok 

Test #34:

score: 0
Accepted
time: 2ms
memory: 4704kb

input:

cc61ad56a4797fb3f5c9529f73ce6fcedd85669b
1
3000 0 2999 1062928849033
0 1 998984
1 2 998391
2 3 997359
3 4 996971
4 5 996259
5 6 995283
6 7 994397
7 8 994350
8 9 993341
9 10 992541
10 11 992084
11 12 991307
12 13 990600
13 14 990276
14 15 989400
15 16 988934
16 17 988034
17 18 987540
18 19 986977
19 ...

output:

081ce3c351cbf526b37954b9ad30f2b531a7585c
OK
2412

result:

ok 

Test #35:

score: 0
Accepted
time: 0ms
memory: 4392kb

input:

cc61ad56a4797fb3f5c9529f73ce6fcedd85669b
1
3000 0 2999 1101971987741
0 1 998795
1 2 998275
2 3 997641
3 4 996834
4 5 996149
5 6 995533
6 7 994744
7 8 993821
8 9 993107
9 10 992900
10 11 992045
11 12 991158
12 13 990526
13 14 989914
14 15 989575
15 16 988493
16 17 988188
17 18 987611
18 19 986580
19 ...

output:

081ce3c351cbf526b37954b9ad30f2b531a7585c
OK
2466

result:

ok 

Subtask #5:

score: 9
Accepted

Test #36:

score: 9
Accepted
time: 0ms
memory: 3816kb

input:

cc61ad56a4797fb3f5c9529f73ce6fcedd85669b
1
4 0 1 9
0 2 2
1 2 3
2 3 3

output:

081ce3c351cbf526b37954b9ad30f2b531a7585c
OK
6

result:

ok 

Test #37:

score: 0
Accepted
time: 0ms
memory: 3744kb

input:

cc61ad56a4797fb3f5c9529f73ce6fcedd85669b
1
4 0 1 8
0 2 2
1 2 3
2 3 100

output:

081ce3c351cbf526b37954b9ad30f2b531a7585c
OK
5

result:

ok 

Test #38:

score: 0
Accepted
time: 0ms
memory: 3748kb

input:

cc61ad56a4797fb3f5c9529f73ce6fcedd85669b
1
8 0 4 84
0 1 1
1 2 29
2 3 29
3 4 1
4 5 20
2 6 20
3 7 1

output:

081ce3c351cbf526b37954b9ad30f2b531a7585c
OK
9

result:

ok 

Test #39:

score: 0
Accepted
time: 0ms
memory: 4072kb

input:

cc61ad56a4797fb3f5c9529f73ce6fcedd85669b
1
18 14 15 221112
8 10 15984
3 8 2664
6 10 5328
9 10 13320
5 10 23976
1 10 13320
3 4 5328
3 7 26640
3 11 23976
4 15 23976
6 17 18648
12 17 5328
11 13 13320
0 11 7992
15 16 5328
2 16 5328
13 14 2664

output:

081ce3c351cbf526b37954b9ad30f2b531a7585c
OK
14

result:

ok 

Test #40:

score: 0
Accepted
time: 0ms
memory: 3856kb

input:

cc61ad56a4797fb3f5c9529f73ce6fcedd85669b
1
19 3 9 11232111
13 14 174955
0 13 69982
10 14 209946
14 15 209946
12 14 104973
0 11 314919
0 3 314919
0 7 139964
5 10 209946
10 16 69982
4 10 104973
9 11 279928
9 17 349910
1 4 104973
3 18 209946
6 18 174955
7 8 314919
2 7 104973

output:

081ce3c351cbf526b37954b9ad30f2b531a7585c
OK
28

result:

ok 

Test #41:

score: 0
Accepted
time: 0ms
memory: 4068kb

input:

cc61ad56a4797fb3f5c9529f73ce6fcedd85669b
1
15 5 7 155966
1 4 964448
5 11 996819
9 10 330180
5 6 987448
11 12 704605
0 5 155967
8 14 596631
10 11 923917
0 14 560902
4 13 49411
1 7 856694
1 12 755799
2 14 488208
3 13 990480

output:

081ce3c351cbf526b37954b9ad30f2b531a7585c
OK
2

result:

ok 

Test #42:

score: 0
Accepted
time: 0ms
memory: 4076kb

input:

cc61ad56a4797fb3f5c9529f73ce6fcedd85669b
1
20 4 7 40726445
15 18 841797
9 16 909512
0 7 39919
8 19 78725
6 17 661904
7 14 426400
17 18 664669
7 13 917960
4 14 821652
4 11 274656
1 12 937782
10 19 129031
12 13 504353
5 11 502915
3 8 264525
2 19 358409
12 18 578659
16 19 696491
3 17 175157

output:

081ce3c351cbf526b37954b9ad30f2b531a7585c
OK
30

result:

ok 

Test #43:

score: 0
Accepted
time: 0ms
memory: 4072kb

input:

cc61ad56a4797fb3f5c9529f73ce6fcedd85669b
1
19 1 8 758761123780644886
3 18 947982
12 13 415218
3 15 890432
11 17 808801
2 8 726510
7 12 752493
8 17 328133
6 7 465830
8 14 126540
9 18 443041
1 7 605214
4 11 243452
9 10 106626
3 7 498126
1 4 39081
0 2 861168
5 15 69635
3 16 223395

output:

081ce3c351cbf526b37954b9ad30f2b531a7585c
OK
38

result:

ok 

Test #44:

score: 0
Accepted
time: 0ms
memory: 4064kb

input:

cc61ad56a4797fb3f5c9529f73ce6fcedd85669b
1
18 4 10 8410500
14 16 912609
2 8 546082
2 12 129063
1 17 454917
15 17 85372
1 11 862697
4 11 428830
7 9 860609
8 10 119165
6 11 143393
14 17 789886
13 15 216341
4 5 56300
12 13 718046
0 7 354300
9 15 142154
1 3 310843

output:

081ce3c351cbf526b37954b9ad30f2b531a7585c
OK
11

result:

ok 

Test #45:

score: 0
Accepted
time: 0ms
memory: 3800kb

input:

cc61ad56a4797fb3f5c9529f73ce6fcedd85669b
1
18 14 15 23103649
0 6 382587
2 4 23201
2 3 58517
0 10 982598
0 17 283539
13 14 944945
4 6 576463
8 14 941541
7 16 566937
1 11 185982
3 9 360540
1 5 441702
4 16 808047
3 14 154737
3 15 344378
9 11 631318
7 12 552451

output:

081ce3c351cbf526b37954b9ad30f2b531a7585c
OK
36

result:

ok 

Test #46:

score: 0
Accepted
time: 0ms
memory: 3748kb

input:

cc61ad56a4797fb3f5c9529f73ce6fcedd85669b
1
18 7 13 25604
13 17 12802
5 14 39262
6 8 774165
2 11 834406
5 6 1
0 16 432886
3 6 1
2 14 272481
5 12 817066
4 9 40750
15 17 889075
1 7 12804
4 16 406687
5 17 1
3 10 875945
0 1 525803
1 3 1

output:

081ce3c351cbf526b37954b9ad30f2b531a7585c
OK
3

result:

ok 

Test #47:

score: 0
Accepted
time: 0ms
memory: 4060kb

input:

cc61ad56a4797fb3f5c9529f73ce6fcedd85669b
1
19 0 8 951764
0 1 4
1 2 4
2 3 4
3 4 307858
4 5 307858
5 6 4
6 7 4
7 8 4
4 9 121363
7 10 4
8 11 214606
5 12 999998
6 13 1000000
1 14 999995
10 15 999997
1 16 999994
13 17 999996
3 18 999991

output:

081ce3c351cbf526b37954b9ad30f2b531a7585c
OK
13

result:

ok 

Test #48:

score: 0
Accepted
time: 0ms
memory: 3800kb

input:

cc61ad56a4797fb3f5c9529f73ce6fcedd85669b
1
20 0 8 274829
0 1 2
1 2 2
2 3 2
3 4 2
4 5 2
5 6 2
6 7 2
7 8 2
4 9 548538
7 10 2
8 11 274686
6 12 999999
0 13 999995
6 14 999992
9 15 1000000
0 16 999997
9 17 999996
3 18 999998
0 19 999999

output:

081ce3c351cbf526b37954b9ad30f2b531a7585c
OK
21

result:

ok 

Test #49:

score: 0
Accepted
time: 0ms
memory: 3792kb

input:

cc61ad56a4797fb3f5c9529f73ce6fcedd85669b
1
18 6 13 58800010
7 11 555657
5 9 283104
0 16 323027
5 11 296013
9 15 584423
1 12 410839
7 13 314886
3 14 890353
4 12 174300
3 12 791983
2 5 216145
4 17 259612
3 16 732206
10 11 976379
8 16 650154
4 9 76441
6 8 589585

output:

081ce3c351cbf526b37954b9ad30f2b531a7585c
OK
35

result:

ok 

Test #50:

score: 0
Accepted
time: 0ms
memory: 3792kb

input:

cc61ad56a4797fb3f5c9529f73ce6fcedd85669b
1
18 5 10 24497819
9 15 154130
7 11 597308
2 11 617436
0 13 517318
3 16 400080
1 5 908978
1 8 181237
4 7 84199
3 6 758216
6 14 32279
11 17 498893
10 12 629338
2 15 180470
10 17 803430
13 16 226223
8 11 134253
4 13 618500

output:

081ce3c351cbf526b37954b9ad30f2b531a7585c
OK
26

result:

ok 

Test #51:

score: 0
Accepted
time: 0ms
memory: 3788kb

input:

cc61ad56a4797fb3f5c9529f73ce6fcedd85669b
1
20 13 17 8319375
13 14 4930
14 18 19720
6 18 104023
1 15 9367
1 19 37961
10 19 1479
14 17 90219
1 11 41905
8 17 986
2 17 4437
8 12 3451
7 12 1479
12 16 3451
3 11 4930
3 5 3944
3 4 4930
0 4 3944
6 15 473280
9 15 4437

output:

081ce3c351cbf526b37954b9ad30f2b531a7585c
OK
39

result:

ok 

Test #52:

score: 0
Accepted
time: 0ms
memory: 3780kb

input:

cc61ad56a4797fb3f5c9529f73ce6fcedd85669b
1
20 6 9 7859406
6 10 3451
4 10 125222
4 7 42891
5 8 17748
3 5 34510
1 3 4930
9 10 69020
5 12 78880
9 11 986
11 16 1972
2 12 1972
0 2 493
0 19 986
18 19 2958
8 15 77894
14 15 77894
13 14 77894
14 17 2958
7 13 77894

output:

081ce3c351cbf526b37954b9ad30f2b531a7585c
OK
39

result:

ok 

Test #53:

score: 0
Accepted
time: 0ms
memory: 3776kb

input:

cc61ad56a4797fb3f5c9529f73ce6fcedd85669b
1
18 9 14 2009
9 17 245
11 17 549633
10 11 419146
10 13 294
0 13 675465
0 4 743232
4 15 245
14 17 147
3 17 490
2 17 392
5 14 294
6 14 98
3 16 49
0 7 294
1 7 343
7 8 98
7 12 98

output:

081ce3c351cbf526b37954b9ad30f2b531a7585c
OK
10

result:

ok 

Subtask #6:

score: 11
Accepted

Dependency #2:

100%
Accepted

Dependency #5:

100%
Accepted

Test #54:

score: 11
Accepted
time: 0ms
memory: 3792kb

input:

cc61ad56a4797fb3f5c9529f73ce6fcedd85669b
5
18 1 13 527703
9 16 351802
9 14 879505
1 9 175901
8 9 879505
9 13 175901
3 9 703604
6 9 175901
1 10 175901
8 17 527703
8 12 703604
5 8 351802
4 17 351802
4 15 175901
3 11 351802
2 6 175901
7 12 175901
0 12 703604
18 4 6 4472320
7 14 279520
0 14 698800
4 14 ...

output:

081ce3c351cbf526b37954b9ad30f2b531a7585c
OK
6
19
24
22
18

result:

ok 

Test #55:

score: 0
Accepted
time: 0ms
memory: 3776kb

input:

cc61ad56a4797fb3f5c9529f73ce6fcedd85669b
2
44 16 42 39005566
31 34 546807
28 31 182269
24 31 546807
1 31 729076
31 37 546807
10 31 729076
11 34 182269
6 34 546807
8 34 911345
27 34 182269
21 34 182269
28 43 182269
0 28 364538
11 33 182269
11 13 546807
11 32 729076
6 25 364538
6 23 911345
3 6 729076
...

output:

081ce3c351cbf526b37954b9ad30f2b531a7585c
OK
41
41

result:

ok 

Test #56:

score: 0
Accepted
time: 0ms
memory: 3800kb

input:

cc61ad56a4797fb3f5c9529f73ce6fcedd85669b
1
100 32 48 845106325
6 47 185285
2 78 836794
33 48 295664
6 21 253358
35 72 880588
11 44 184179
34 64 928825
2 63 261345
14 86 699387
3 31 31794
36 94 747327
37 78 994837
32 86 948027
3 40 331681
73 94 648883
52 93 958759
1 46 4887
84 90 404000
4 17 709961
6...

output:

081ce3c351cbf526b37954b9ad30f2b531a7585c
OK
194

result:

ok 

Test #57:

score: 0
Accepted
time: 0ms
memory: 3828kb

input:

cc61ad56a4797fb3f5c9529f73ce6fcedd85669b
1
96 84 89 322172170266789279
59 67 633758
35 83 103776
62 69 201021
12 83 457669
23 31 16415
58 75 544975
57 82 25599
5 63 170193
4 69 298611
50 69 17985
40 75 42493
25 58 52116
15 37 664001
13 25 71685
40 77 752336
92 94 251061
19 51 853794
52 89 232557
15 ...

output:

081ce3c351cbf526b37954b9ad30f2b531a7585c
OK
192

result:

ok 

Test #58:

score: 0
Accepted
time: 0ms
memory: 3872kb

input:

cc61ad56a4797fb3f5c9529f73ce6fcedd85669b
1
100 16 37 23376956
60 61 405135
2 6 849031
32 88 456203
21 81 225578
76 87 645409
18 50 63591
18 49 189594
65 74 447036
23 48 286500
54 70 916023
64 68 782659
27 96 477944
13 96 801589
11 66 960926
17 37 589735
3 92 632529
7 80 663437
29 46 186860
26 39 832...

output:

081ce3c351cbf526b37954b9ad30f2b531a7585c
OK
24

result:

ok 

Test #59:

score: 0
Accepted
time: 0ms
memory: 3792kb

input:

cc61ad56a4797fb3f5c9529f73ce6fcedd85669b
1
96 46 87 72555
60 79 835730
8 20 117864
59 68 373812
6 22 371896
24 77 36342
48 85 1
3 40 798192
71 95 164580
15 63 811951
9 76 786454
59 91 654409
13 48 1
33 65 314024
50 60 312727
70 74 1
40 70 76777
7 21 777665
12 30 731652
41 61 993949
30 93 193466
16 2...

output:

081ce3c351cbf526b37954b9ad30f2b531a7585c
OK
4

result:

ok 

Test #60:

score: 0
Accepted
time: 0ms
memory: 3872kb

input:

cc61ad56a4797fb3f5c9529f73ce6fcedd85669b
1
93 0 84 971784
0 1 4
1 2 4
2 3 4
3 4 4
4 5 4
5 6 4
6 7 4
7 8 4
8 9 4
9 10 4
10 11 4
11 12 4
12 13 4
13 14 4
14 15 4
15 16 4
16 17 4
17 18 4
18 19 4
19 20 4
20 21 4
21 22 4
22 23 4
23 24 4
24 25 4
25 26 4
26 27 4
27 28 4
28 29 4
29 30 4
30 31 4
31 32 4
32 33...

output:

081ce3c351cbf526b37954b9ad30f2b531a7585c
OK
90

result:

ok 

Test #61:

score: 0
Accepted
time: 0ms
memory: 3820kb

input:

cc61ad56a4797fb3f5c9529f73ce6fcedd85669b
1
96 0 16 264179
0 1 2
1 2 2
2 3 2
3 4 2
4 5 2
5 6 2
6 7 2
7 8 2
8 9 2
9 10 2
10 11 2
11 12 2
12 13 2
13 14 2
14 15 2
15 16 2
8 17 526780
15 18 2
16 19 263699
16 20 1000000
7 21 999990
10 22 999995
14 23 999997
15 24 999991
3 25 999990
19 26 999994
7 27 99999...

output:

081ce3c351cbf526b37954b9ad30f2b531a7585c
OK
38

result:

ok 

Test #62:

score: 0
Accepted
time: 0ms
memory: 3760kb

input:

cc61ad56a4797fb3f5c9529f73ce6fcedd85669b
1
100 49 75 47947294
0 29 755378
12 69 849156
70 80 359155
2 91 457786
11 75 458243
82 98 508707
71 95 309547
29 91 668852
53 83 145865
5 86 825865
52 88 478712
13 60 824594
4 72 598862
9 92 2859
48 50 892094
15 73 429450
8 61 541918
54 79 163345
34 62 518852...

output:

081ce3c351cbf526b37954b9ad30f2b531a7585c
OK
26

result:

ok 

Test #63:

score: 0
Accepted
time: 0ms
memory: 3808kb

input:

cc61ad56a4797fb3f5c9529f73ce6fcedd85669b
1
98 59 64 225465811
49 82 212274
9 34 635323
6 8 116156
77 91 337118
16 86 870693
43 66 92662
25 95 969926
25 34 73072
54 85 22934
10 68 124707
17 75 700205
79 88 881772
31 52 334004
82 87 744234
54 63 31596
30 72 937619
22 88 424855
76 92 389233
86 96 64454...

output:

081ce3c351cbf526b37954b9ad30f2b531a7585c
OK
93

result:

ok 

Test #64:

score: 0
Accepted
time: 0ms
memory: 3764kb

input:

cc61ad56a4797fb3f5c9529f73ce6fcedd85669b
1
100 17 85 135644282
53 69 515082
4 13 65846
73 97 261373
47 49 111582
43 49 197806
12 59 583967
58 92 470380
18 70 297392
9 36 115677
87 97 507575
31 83 984667
21 85 832117
71 80 294632
62 84 479439
0 83 941584
89 97 18426
16 87 231642
1 52 78337
59 66 2581...

output:

081ce3c351cbf526b37954b9ad30f2b531a7585c
OK
88

result:

ok 

Test #65:

score: 0
Accepted
time: 0ms
memory: 3748kb

input:

cc61ad56a4797fb3f5c9529f73ce6fcedd85669b
1
86 50 75 88037663
23 50 441
23 69 968436
10 69 593880
10 20 343
17 20 513765
17 22 375536
3 22 98
23 75 490
23 82 98
23 80 392
23 26 147
58 75 490
75 79 196
75 76 441
24 58 441
15 58 98
58 78 196
12 58 294
58 62 392
24 53 490
24 66 490
14 24 196
24 33 490
2...

output:

081ce3c351cbf526b37954b9ad30f2b531a7585c
OK
171

result:

ok 

Test #66:

score: 0
Accepted
time: 0ms
memory: 3872kb

input:

cc61ad56a4797fb3f5c9529f73ce6fcedd85669b
2
56 41 49 27048
2 41 490
2 15 950257
15 24 857990
1 24 49
1 37 216237
23 37 933842
23 45 49
2 49 441
2 52 98
2 20 490
2 35 245
22 49 245
8 49 245
51 52 49
38 52 441
17 52 392
47 51 343
38 50 98
19 38 294
12 20 49
25 50 245
6 25 196
7 25 294
25 54 98
4 6 147
...

output:

081ce3c351cbf526b37954b9ad30f2b531a7585c
OK
51
14

result:

ok 

Test #67:

score: 0
Accepted
time: 0ms
memory: 3748kb

input:

cc61ad56a4797fb3f5c9529f73ce6fcedd85669b
5
16 1 15 3528
13 15 343
10 13 516754
10 11 860685
3 11 147
3 14 238189
7 14 399644
7 8 98
1 13 392
9 13 294
1 4 441
5 9 98
5 12 441
2 14 196
2 6 147
0 2 392
25 11 24 10578301
11 15 3451
3 15 144449
3 8 65569
9 19 32538
19 20 28101
12 20 3944
15 24 90712
6 19...

output:

081ce3c351cbf526b37954b9ad30f2b531a7585c
OK
11
49
49
8
29

result:

ok 

Subtask #7:

score: 10
Accepted

Dependency #3:

100%
Accepted

Dependency #6:

100%
Accepted

Test #68:

score: 10
Accepted
time: 1ms
memory: 3792kb

input:

cc61ad56a4797fb3f5c9529f73ce6fcedd85669b
18
27 12 16 5642730
5 26 188091
22 26 564273
5 18 564273
2 5 376182
5 24 752364
2 15 188091
2 17 564273
2 21 376182
2 19 752364
2 20 376182
12 22 752364
15 23 376182
8 15 188091
0 15 940455
6 17 188091
10 12 940455
9 12 188091
1 10 188091
10 16 940455
1 7 564...

output:

081ce3c351cbf526b37954b9ad30f2b531a7585c
OK
12
57
41
48
23
8
13
29
39
42
25
40
6
15
34
18
40
41

result:

ok 

Test #69:

score: 0
Accepted
time: 1ms
memory: 3808kb

input:

cc61ad56a4797fb3f5c9529f73ce6fcedd85669b
6
91 20 51 2887570
33 75 34790
51 75 139160
28 75 34790
59 75 34790
64 75 69580
23 75 104370
24 33 69580
33 41 69580
2 33 104370
33 65 173950
33 49 69580
29 51 139160
51 83 139160
4 28 104370
28 34 69580
27 28 173950
4 79 34790
4 55 173950
22 29 139160
29 50 ...

output:

081ce3c351cbf526b37954b9ad30f2b531a7585c
OK
19
130
130
139
91
46

result:

ok 

Test #70:

score: 0
Accepted
time: 1ms
memory: 3764kb

input:

cc61ad56a4797fb3f5c9529f73ce6fcedd85669b
5
100 15 64 1404484469
0 1 128802
1 2 188278
2 3 342236
3 4 861870
4 5 180842
5 6 582605
6 7 141745
7 8 321094
8 9 609430
9 10 562026
10 11 101124
11 12 786046
12 13 249739
13 14 914663
14 15 631973
15 16 722690
16 17 90453
17 18 795664
18 19 119337
19 20 767...

output:

081ce3c351cbf526b37954b9ad30f2b531a7585c
OK
153
155
145
148
153

result:

ok 

Test #71:

score: 0
Accepted
time: 1ms
memory: 4064kb

input:

cc61ad56a4797fb3f5c9529f73ce6fcedd85669b
3
150 3 12 30376497
12 115 602904
115 124 105
32 124 502
32 57 525
57 99 559
30 99 785
30 125 171
38 125 902
38 50 351
50 105 510
9 105 717
9 18 928
18 103 585
103 116 521
78 116 161
78 114 640
49 114 282
42 49 602
42 45 863
5 45 268
5 131 525
129 131 807
37 ...

output:

081ce3c351cbf526b37954b9ad30f2b531a7585c
OK
73
202
133

result:

ok 

Test #72:

score: 0
Accepted
time: 1ms
memory: 3764kb

input:

cc61ad56a4797fb3f5c9529f73ce6fcedd85669b
3
150 105 109 630789823
105 126 936140
87 126 132454
72 87 684806
19 72 207062
19 143 980263
63 143 36108
21 63 912987
21 97 87574
36 97 312388
36 141 398392
141 148 17037
102 148 280285
86 102 900589
26 86 553319
26 132 655689
76 132 549735
76 82 874294
82 1...

output:

081ce3c351cbf526b37954b9ad30f2b531a7585c
OK
166
172
198

result:

ok 

Test #73:

score: 0
Accepted
time: 1ms
memory: 3824kb

input:

cc61ad56a4797fb3f5c9529f73ce6fcedd85669b
1
500 61 268 3667362589
129 135 49620
70 163 189135
232 398 20267
89 232 814364
32 474 450400
204 478 94331
56 489 237753
93 248 523758
17 481 401699
78 175 399714
32 328 92575
67 343 53349
250 490 128458
77 159 499846
301 458 83015
234 372 426184
71 325 3573...

output:

081ce3c351cbf526b37954b9ad30f2b531a7585c
OK
915

result:

ok 

Test #74:

score: 0
Accepted
time: 1ms
memory: 3820kb

input:

cc61ad56a4797fb3f5c9529f73ce6fcedd85669b
1
466 186 219 3810726362927956
177 459 216260
124 234 154104
228 270 676206
149 448 666759
214 415 203180
179 431 631085
8 429 441821
100 343 363315
73 102 124037
130 279 498180
186 438 592110
17 116 495015
51 155 134328
191 410 999897
89 115 36164
11 412 632...

output:

081ce3c351cbf526b37954b9ad30f2b531a7585c
OK
932

result:

ok 

Test #75:

score: 0
Accepted
time: 1ms
memory: 3844kb

input:

cc61ad56a4797fb3f5c9529f73ce6fcedd85669b
1
453 305 432 857455410
165 433 941284
68 165 359250
43 315 813815
106 260 698478
238 406 653545
172 280 378593
99 292 668443
95 355 704616
13 433 862478
91 116 619562
95 229 823896
40 451 766781
15 271 45761
131 306 358545
52 166 791357
277 342 339197
16 293...

output:

081ce3c351cbf526b37954b9ad30f2b531a7585c
OK
164

result:

ok 

Test #76:

score: 0
Accepted
time: 1ms
memory: 4108kb

input:

cc61ad56a4797fb3f5c9529f73ce6fcedd85669b
1
469 389 418 23489121
221 287 426673
254 360 986279
185 423 68483
57 367 840556
59 256 760209
388 433 80433
228 314 722856
28 79 871729
132 375 564433
66 188 241121
291 455 863787
193 202 401105
139 361 611557
260 282 172859
120 241 49302
128 150 110124
302 ...

output:

081ce3c351cbf526b37954b9ad30f2b531a7585c
OK
31

result:

ok 

Test #77:

score: 0
Accepted
time: 0ms
memory: 3936kb

input:

cc61ad56a4797fb3f5c9529f73ce6fcedd85669b
1
496 188 220 135237
341 371 586387
122 215 87984
63 354 433035
256 484 766624
45 483 812628
232 257 257839
24 432 145099
160 401 793259
43 355 636734
66 213 636522
180 425 723043
2 453 339082
94 266 472353
108 297 266925
17 126 97463
48 200 689855
185 337 36...

output:

081ce3c351cbf526b37954b9ad30f2b531a7585c
OK
4

result:

ok 

Test #78:

score: 0
Accepted
time: 1ms
memory: 3924kb

input:

cc61ad56a4797fb3f5c9529f73ce6fcedd85669b
1
454 0 416 981050
0 1 1
1 2 1
2 3 1
3 4 1
4 5 1
5 6 1
6 7 1
7 8 1
8 9 1
9 10 1
10 11 1
11 12 1
12 13 1
13 14 1
14 15 1
15 16 1
16 17 1
17 18 1
18 19 1
19 20 1
20 21 1
21 22 1
22 23 1
23 24 1
24 25 1
25 26 1
26 27 1
27 28 1
28 29 1
29 30 1
30 31 1
31 32 1
32 ...

output:

081ce3c351cbf526b37954b9ad30f2b531a7585c
OK
422

result:

ok 

Test #79:

score: 0
Accepted
time: 0ms
memory: 4156kb

input:

cc61ad56a4797fb3f5c9529f73ce6fcedd85669b
1
496 0 388 529180
0 1 2
1 2 2
2 3 2
3 4 2
4 5 2
5 6 2
6 7 2
7 8 2
8 9 2
9 10 2
10 11 2
11 12 2
12 13 2
13 14 2
14 15 2
15 16 2
16 17 2
17 18 2
18 19 2
19 20 2
20 21 2
21 22 2
22 23 2
23 24 2
24 25 2
25 26 2
26 27 2
27 28 2
28 29 2
29 30 2
30 31 2
31 32 2
32 ...

output:

081ce3c351cbf526b37954b9ad30f2b531a7585c
OK
782

result:

ok 

Test #80:

score: 0
Accepted
time: 0ms
memory: 3876kb

input:

cc61ad56a4797fb3f5c9529f73ce6fcedd85669b
1
479 125 447 1424607405
56 138 910494
18 388 75519
131 200 963045
241 478 513812
325 333 602142
274 418 162456
325 393 932727
231 441 48291
78 295 64695
317 445 669764
355 476 197443
17 305 357141
12 383 699964
188 232 533225
38 210 496326
316 319 440930
81 ...

output:

081ce3c351cbf526b37954b9ad30f2b531a7585c
OK
220

result:

ok 

Test #81:

score: 0
Accepted
time: 0ms
memory: 3928kb

input:

cc61ad56a4797fb3f5c9529f73ce6fcedd85669b
1
474 112 251 1400212114
6 25 418373
114 191 861244
6 78 908890
385 449 962430
306 322 572803
88 97 368762
21 87 995910
147 430 241909
336 416 362214
281 439 522899
133 381 330701
217 337 258062
53 216 546070
49 425 684817
80 461 937780
444 464 661943
211 395...

output:

081ce3c351cbf526b37954b9ad30f2b531a7585c
OK
177

result:

ok 

Test #82:

score: 0
Accepted
time: 1ms
memory: 3888kb

input:

cc61ad56a4797fb3f5c9529f73ce6fcedd85669b
1
484 66 243 899235688
68 382 730423
13 152 321760
354 405 165850
215 280 260695
206 207 467848
122 199 8420
131 473 389043
237 274 844418
31 59 16263
4 324 28375
151 315 630448
191 322 909510
180 289 7107
43 171 653553
479 482 458826
5 451 722382
95 370 7912...

output:

081ce3c351cbf526b37954b9ad30f2b531a7585c
OK
294

result:

ok 

Test #83:

score: 0
Accepted
time: 1ms
memory: 3924kb

input:

cc61ad56a4797fb3f5c9529f73ce6fcedd85669b
3
390 214 317 132843361
3 214 490
3 373 138915
7 373 386904
7 341 98
124 341 360003
124 340 675318
302 340 196
3 317 490
3 20 196
317 330 294
57 317 490
72 317 392
152 330 245
242 330 343
287 330 98
252 330 490
268 330 343
152 361 98
13 152 98
34 152 196
81 1...

output:

081ce3c351cbf526b37954b9ad30f2b531a7585c
OK
779
131
85

result:

ok 

Test #84:

score: 0
Accepted
time: 1ms
memory: 4080kb

input:

cc61ad56a4797fb3f5c9529f73ce6fcedd85669b
3
412 123 248 100842
38 248 441
27 38 479563
27 214 182672
214 226 196
170 226 158564
170 312 281946
312 403 392
38 123 343
38 238 392
38 331 392
36 38 196
38 157 294
38 361 294
38 75 392
5 38 196
38 155 441
123 358 98
89 123 392
123 301 343
123 187 49
123 38...

output:

081ce3c351cbf526b37954b9ad30f2b531a7585c
OK
175
10
11

result:

ok 

Test #85:

score: 0
Accepted
time: 1ms
memory: 3808kb

input:

cc61ad56a4797fb3f5c9529f73ce6fcedd85669b
7
74 21 70 22148
22 70 196
22 32 910518
3 32 357602
3 66 245
53 66 237454
53 55 525672
55 59 294
21 22 392
22 36 147
22 34 343
11 22 147
22 40 245
15 22 343
22 67 98
20 21 343
21 50 49
21 62 98
14 21 441
36 46 490
36 71 245
34 54 294
34 44 490
49 54 49
11 38 ...

output:

081ce3c351cbf526b37954b9ad30f2b531a7585c
OK
62
141
141
43
199
29
39

result:

ok 

Subtask #8:

score: 10
Accepted

Dependency #4:

100%
Accepted

Dependency #7:

100%
Accepted

Test #86:

score: 10
Accepted
time: 2ms
memory: 3836kb

input:

cc61ad56a4797fb3f5c9529f73ce6fcedd85669b
66
50 17 39 7891950
42 49 526130
34 49 526130
32 42 789195
4 42 263065
22 32 789195
21 32 789195
7 32 526130
18 22 789195
9 22 789195
16 22 789195
22 43 263065
3 22 263065
15 22 526130
13 22 789195
17 22 526130
22 46 789195
18 24 789195
9 23 526130
9 19 52613...

output:

081ce3c351cbf526b37954b9ad30f2b531a7585c
OK
13
91
49
51
37
50
54
55
57
68
70
74
8
57
59
19
50
61
63
58
50
53
73
16
18
25
55
66
68
30
41
58
63
77
65
72
74
33
27
57
33
25
49
64
66
38
63
68
14
33
33
54
61
35
50
63
65
54
52
65
67
72
43
48
35
67

result:

ok 

Test #87:

score: 0
Accepted
time: 2ms
memory: 3860kb

input:

cc61ad56a4797fb3f5c9529f73ce6fcedd85669b
11
274 16 205 4449250
14 156 17797
14 108 17797
14 159 53391
14 232 35594
104 156 17797
72 156 35594
132 156 35594
156 170 35594
156 266 35594
156 198 17797
156 212 53391
112 156 17797
104 235 17797
104 120 17797
104 176 53391
55 72 35594
72 191 17797
72 223 ...

output:

081ce3c351cbf526b37954b9ad30f2b531a7585c
OK
50
333
508
68
139
148
166
306
306
273
26

result:

ok 

Test #88:

score: 0
Accepted
time: 2ms
memory: 3840kb

input:

cc61ad56a4797fb3f5c9529f73ce6fcedd85669b
30
100 17 89 1146113818
0 1 927093
1 2 776866
2 3 238001
3 4 490778
4 5 789866
5 6 708758
6 7 675877
7 8 377400
8 9 572746
9 10 49275
10 11 385972
11 12 248203
12 13 617049
13 14 454336
14 15 214289
15 16 606329
16 17 439492
17 18 160785
18 19 852661
19 20 93...

output:

081ce3c351cbf526b37954b9ad30f2b531a7585c
OK
145
155
152
149
148
147
154
155
151
154
146
153
151
148
148
152
153
150
146
146
147
146
154
145
155
152
151
148
153
150

result:

ok 

Test #89:

score: 0
Accepted
time: 2ms
memory: 4128kb

input:

cc61ad56a4797fb3f5c9529f73ce6fcedd85669b
20
150 86 132 37824737
60 86 517251
60 73 891
10 73 186
10 143 716
78 143 381
66 78 59
66 146 775
115 146 497
42 115 464
42 72 736
72 140 216
71 140 37
41 71 560
41 96 600
80 96 740
75 80 969
75 109 386
56 109 89
46 56 607
3 46 202
3 29 7
29 30 36
30 139 854
...

output:

081ce3c351cbf526b37954b9ad30f2b531a7585c
OK
98
123
168
123
205
203
131
158
202
160
100
79
86
171
162
142
135
105
174
138

result:

ok 

Test #90:

score: 0
Accepted
time: 2ms
memory: 4100kb

input:

cc61ad56a4797fb3f5c9529f73ce6fcedd85669b
20
150 68 73 612117465
68 112 653739
59 112 611275
30 59 915184
30 138 792018
14 138 84858
14 106 734221
90 106 666213
90 129 961073
129 139 614497
100 139 324368
75 100 505172
75 98 751671
98 110 518727
110 126 384423
13 126 936176
13 31 217775
31 121 779036...

output:

081ce3c351cbf526b37954b9ad30f2b531a7585c
OK
158
172
165
161
181
86
149
117
198
111
141
106
112
200
178
90
98
136
168
103

result:

ok 

Test #91:

score: 0
Accepted
time: 2ms
memory: 4272kb

input:

cc61ad56a4797fb3f5c9529f73ce6fcedd85669b
1
3000 1159 2990 60083014218
1885 2843 743373
2312 2803 261285
1030 2698 936980
36 952 312833
1776 1814 461190
1659 2744 990635
1121 2033 97228
103 2567 681388
1024 1621 821145
877 2524 707181
706 1545 208768
31 378 589602
1597 1864 849776
975 1834 467412
221...

output:

081ce3c351cbf526b37954b9ad30f2b531a7585c
OK
5035

result:

ok 

Test #92:

score: 0
Accepted
time: 2ms
memory: 4316kb

input:

cc61ad56a4797fb3f5c9529f73ce6fcedd85669b
1
2715 1743 2225 598198971407791566
2097 2583 784566
156 1748 803938
693 1557 393741
2308 2544 120269
974 2382 19907
826 2597 487779
274 1652 248719
1497 2338 131447
493 2155 292307
312 991 847458
864 1658 251347
304 1853 839484
1434 2172 570368
1505 2505 639...

output:

081ce3c351cbf526b37954b9ad30f2b531a7585c
OK
5430

result:

ok 

Test #93:

score: 0
Accepted
time: 2ms
memory: 4552kb

input:

cc61ad56a4797fb3f5c9529f73ce6fcedd85669b
1
2986 1015 1366 10734269651
7 1239 465224
2242 2265 518785
391 2762 243369
975 1943 41922
517 2822 76830
74 455 659431
549 1731 273686
920 1108 592606
373 1294 151302
400 1937 18111
1035 2787 487474
705 2886 918424
200 439 79306
360 2832 929381
242 2006 2942...

output:

081ce3c351cbf526b37954b9ad30f2b531a7585c
OK
626

result:

ok 

Test #94:

score: 0
Accepted
time: 2ms
memory: 4528kb

input:

cc61ad56a4797fb3f5c9529f73ce6fcedd85669b
1
2783 1345 2693 23266675
660 1325 994980
1341 2289 444625
537 1983 786018
280 2688 618930
1140 2151 576936
2058 2485 229286
191 2262 497049
848 2780 639862
445 965 732703
681 2129 366207
2327 2665 230864
512 1276 229223
814 1386 47597
1059 1226 296362
761 20...

output:

081ce3c351cbf526b37954b9ad30f2b531a7585c
OK
25

result:

ok 

Test #95:

score: 0
Accepted
time: 2ms
memory: 4216kb

input:

cc61ad56a4797fb3f5c9529f73ce6fcedd85669b
1
2813 1267 2437 18821
231 1805 784096
250 1397 546763
1641 2447 925336
277 581 1
385 1498 46731
239 686 129797
805 2588 1
527 2102 176346
652 1704 123605
727 1363 451879
1206 1692 956699
30 2780 744943
982 2564 118779
680 1411 870944
134 147 830092
505 2772 ...

output:

081ce3c351cbf526b37954b9ad30f2b531a7585c
OK
4

result:

ok 

Test #96:

score: 0
Accepted
time: 2ms
memory: 4620kb

input:

cc61ad56a4797fb3f5c9529f73ce6fcedd85669b
1
2854 0 2176 2084130
0 1 1
1 2 1
2 3 1
3 4 1
4 5 1
5 6 1
6 7 1
7 8 1
8 9 1
9 10 1
10 11 1
11 12 1
12 13 1
13 14 1
14 15 1
15 16 1
16 17 1
17 18 1
18 19 1
19 20 1
20 21 1
21 22 1
22 23 1
23 24 1
24 25 1
25 26 1
26 27 1
27 28 1
28 29 1
29 30 1
30 31 1
31 32 1
...

output:

081ce3c351cbf526b37954b9ad30f2b531a7585c
OK
2182

result:

ok 

Test #97:

score: 0
Accepted
time: 0ms
memory: 4340kb

input:

cc61ad56a4797fb3f5c9529f73ce6fcedd85669b
1
2925 0 2364 12919619
0 1 3
1 2 3
2 3 3
3 4 3
4 5 3
5 6 3
6 7 3
7 8 3
8 9 3
9 10 3
10 11 3
11 12 3
12 13 3
13 14 3
14 15 3
15 16 3
16 17 3
17 18 3
18 19 3
19 20 3
20 21 3
21 22 3
22 23 3
23 24 3
24 25 3
25 26 3
26 27 3
27 28 3
28 29 3
29 30 3
30 31 3
31 32 3...

output:

081ce3c351cbf526b37954b9ad30f2b531a7585c
OK
4733

result:

ok 

Test #98:

score: 0
Accepted
time: 2ms
memory: 4360kb

input:

cc61ad56a4797fb3f5c9529f73ce6fcedd85669b
1
2735 564 957 70120154311
1060 1713 354392
286 2520 828018
1169 2513 121185
721 2517 326957
380 2371 422326
93 1626 247210
1163 1463 979490
2129 2519 935127
1704 2088 293131
1065 1750 762304
979 1284 251835
786 2684 196442
580 2638 799099
469 2259 601853
118...

output:

081ce3c351cbf526b37954b9ad30f2b531a7585c
OK
1240

result:

ok 

Test #99:

score: 0
Accepted
time: 2ms
memory: 4396kb

input:

cc61ad56a4797fb3f5c9529f73ce6fcedd85669b
1
2918 187 2087 738915176852
1226 1718 291705
116 2757 812446
760 1197 171209
1068 1399 51363
343 2150 409103
2070 2852 828658
306 362 219356
734 1347 931996
745 2239 406396
1928 2622 770421
2523 2873 348176
1742 2111 161736
569 1672 747226
95 1956 443434
670...

output:

081ce3c351cbf526b37954b9ad30f2b531a7585c
OK
5055

result:

ok 

Test #100:

score: 0
Accepted
time: 2ms
memory: 4320kb

input:

cc61ad56a4797fb3f5c9529f73ce6fcedd85669b
1
2878 253 1454 2916636765
904 969 870762
60 270 629062
490 752 669990
2103 2694 386049
1855 2132 510077
791 2751 295076
1934 2805 243514
1259 1707 163034
1925 2623 200217
2051 2305 975718
1954 2549 910339
973 1101 46643
755 1721 792421
2386 2455 196344
70 12...

output:

081ce3c351cbf526b37954b9ad30f2b531a7585c
OK
990

result:

ok 

Test #101:

score: 0
Accepted
time: 2ms
memory: 4548kb

input:

cc61ad56a4797fb3f5c9529f73ce6fcedd85669b
1
3000 745 1941 3823220709
745 2771 4970
1296 2771 151088
1296 1969 588945
124 1597 277326
124 671 29820
527 671 1491
1941 2771 272853
124 2290 138166
1941 2056 3976
1185 1941 4473
1941 2609 1491
1729 2056 3976
2056 2888 3479
194 2056 994
1185 2760 2982
1185 ...

output:

081ce3c351cbf526b37954b9ad30f2b531a7585c
OK
5999

result:

ok 

Test #102:

score: 0
Accepted
time: 0ms
memory: 4216kb

input:

cc61ad56a4797fb3f5c9529f73ce6fcedd85669b
5
2084 196 352 79723
352 1916 147
734 1916 596624
242 734 393323
242 1587 196
589 1587 745584
589 1366 963389
230 1366 147
196 1916 441
1763 1916 147
473 1916 343
1531 1916 343
748 1916 392
1916 2067 49
402 1916 441
268 1916 49
1566 1916 147
1916 2055 392
191...

output:

081ce3c351cbf526b37954b9ad30f2b531a7585c
OK
180
198
31
27
9

result:

ok 

Test #103:

score: 0
Accepted
time: 2ms
memory: 3964kb

input:

cc61ad56a4797fb3f5c9529f73ce6fcedd85669b
10
286 67 106 11858
29 106 147
29 94 919828
94 263 259945
239 263 441
239 267 148715
190 267 291403
71 190 49
29 67 343
29 251 343
29 34 392
3 29 294
29 238 392
29 161 490
29 237 392
47 67 343
67 69 490
67 175 49
67 140 294
67 72 98
67 264 294
225 251 98
42 2...

output:

081ce3c351cbf526b37954b9ad30f2b531a7585c
OK
36
999
705
48
669
953
65
291
41
33

result:

ok 

Subtask #9:

score: 17
Accepted

Dependency #1:

100%
Accepted

Dependency #2:

100%
Accepted

Dependency #3:

100%
Accepted

Dependency #4:

100%
Accepted

Dependency #5:

100%
Accepted

Dependency #6:

100%
Accepted

Dependency #7:

100%
Accepted

Dependency #8:

100%
Accepted

Test #104:

score: 17
Accepted
time: 83ms
memory: 6428kb

input:

cc61ad56a4797fb3f5c9529f73ce6fcedd85669b
2214
86 5 22 5074274
39 62 65334
39 75 43556
3 39 43556
6 39 43556
58 62 43556
62 72 43556
62 71 43556
20 62 65334
50 62 21778
75 76 43556
24 58 65334
68 72 21778
41 72 21778
31 72 21778
0 72 43556
14 72 21778
43 72 21778
3 23 65334
3 52 43556
3 70 43556
3 79...

output:

081ce3c351cbf526b37954b9ad30f2b531a7585c
OK
48
137
137
123
107
107
118
100
117
121
138
141
148
152
139
140
144
99
136
138
111
126
128
52
73
75
132
132
152
141
111
117
134
128
128
137
149
145
148
156
99
99
29
163
53
161
71
61
54
114
25
150
165
167
87
100
135
36
99
32
43
93
100
104
117
96
113
115
108
...

result:

ok 

Test #105:

score: 0
Accepted
time: 93ms
memory: 6544kb

input:

cc61ad56a4797fb3f5c9529f73ce6fcedd85669b
548
399 76 254 364904595
108 185 426789
185 342 426789
77 185 284526
125 185 284526
185 285 142263
185 341 142263
15 108 284526
108 109 284526
46 108 142263
108 337 426789
108 237 142263
108 192 284526
108 373 142263
15 288 284526
15 199 142263
15 228 426789
...

output:

081ce3c351cbf526b37954b9ad30f2b531a7585c
OK
214
215
216
217
217
218
219
220
221
348
350
352
354
356
358
360
362
364
366
368
370
372
374
376
378
380
382
384
386
388
390
392
394
396
398
400
560
562
564
566
568
570
572
574
576
578
580
582
584
586
588
590
683
685
687
689
691
693
695
697
699
701
703
705
...

result:

ok 

Test #106:

score: 0
Accepted
time: 151ms
memory: 42300kb

input:

cc61ad56a4797fb3f5c9529f73ce6fcedd85669b
1
200000 73428 83752 206110305543
73428 94155 8
94155 101090 8
45600 101090 8
45600 130822 8
113957 130822 8
85730 113957 8
85730 116160 8
116160 152242 8
152242 184120 8
184120 189328 8
89250 189328 8
89250 165059 8
55278 165059 8
55278 169958 8
55257 169958...

output:

081ce3c351cbf526b37954b9ad30f2b531a7585c
OK
333334

result:

ok 

Test #107:

score: 0
Accepted
time: 102ms
memory: 7436kb

input:

cc61ad56a4797fb3f5c9529f73ce6fcedd85669b
20
10000 4398 5878 2033219462
2999 4398 728979
2999 3337 1
2401 3337 1
2401 7142 2
7142 9651 2
7173 9651 1
2094 7173 2
1880 2094 2
1880 3510 2
3510 7665 1
236 7665 1
236 8587 2
4038 8587 3
4038 7269 2
3856 7269 3
3856 4621 2
3384 4621 1
3384 4577 3
4457 4577 ...

output:

081ce3c351cbf526b37954b9ad30f2b531a7585c
OK
5778
2296
262
7419
5246
8335
5681
6650
8067
2452
5104
7559
4785
6974
5491
6168
9414
6565
3210
1414

result:

ok 

Test #108:

score: 0
Accepted
time: 97ms
memory: 6816kb

input:

cc61ad56a4797fb3f5c9529f73ce6fcedd85669b
40
5000 2973 3518 2080136508
1716 3518 829609
1716 4436 29
624 4436 43
624 3096 22
825 3096 67
825 1363 91
1363 3311 38
3227 3311 75
3227 4684 68
3234 4684 47
583 3234 96
583 2825 71
358 2825 27
358 1321 97
283 1321 23
283 586 50
586 2295 89
2295 3122 37
1411...

output:

081ce3c351cbf526b37954b9ad30f2b531a7585c
OK
4243
6881
4673
2328
5640
6052
6516
3987
6941
2038
2741
6176
4737
2205
6677
2141
5033
6232
2641
3777
4046
2653
3455
5131
5436
5611
6527
4960
4484
5664
3295
6753
4002
3515
2198
5258
5550
4842
4033
5395

result:

ok 

Test #109:

score: 0
Accepted
time: 59ms
memory: 35456kb

input:

cc61ad56a4797fb3f5c9529f73ce6fcedd85669b
1
182336 8057 79578 1547007
0 8057 3
1 8057 3
2 8057 3
3 8057 3
4 8057 3
5 8057 3
6 8057 3
7 8057 3
8 8057 3
9 8057 3
10 8057 3
11 8057 3
12 8057 3
13 8057 3
14 8057 3
15 8057 3
16 8057 3
17 8057 3
18 8057 3
19 8057 3
20 8057 3
21 8057 3
22 8057 3
23 8057 3
2...

output:

081ce3c351cbf526b37954b9ad30f2b531a7585c
OK
349003

result:

ok 

Test #110:

score: 0
Accepted
time: 60ms
memory: 35676kb

input:

cc61ad56a4797fb3f5c9529f73ce6fcedd85669b
1
186860 20219 137167 1560573
0 137167 1
1 137167 1
2 137167 1
3 137167 1
4 137167 1
5 137167 1
6 137167 1
7 137167 1
8 137167 1
9 137167 1
10 137167 1
11 137167 1
12 137167 1
13 137167 1
14 137167 1
15 137167 1
16 137167 1
17 137167 1
18 137167 1
19 137167 1...

output:

081ce3c351cbf526b37954b9ad30f2b531a7585c
OK
373719

result:

ok 

Test #111:

score: 0
Accepted
time: 69ms
memory: 43244kb

input:

cc61ad56a4797fb3f5c9529f73ce6fcedd85669b
1
188782 14291 159536 211761
0 1 786930
1 2 314343
2 3 766148
3 4 316322
4 5 353006
5 6 938886
6 7 341391
7 8 471461
8 9 924890
9 10 295112
10 11 978859
11 12 357774
12 13 545812
13 14 453284
14 15 742323
15 16 662868
16 17 349497
17 18 678070
18 19 280841
19...

output:

081ce3c351cbf526b37954b9ad30f2b531a7585c
OK
5

result:

ok 

Test #112:

score: 0
Accepted
time: 175ms
memory: 38972kb

input:

cc61ad56a4797fb3f5c9529f73ce6fcedd85669b
1
200000 106877 118624 24542821809632
17359 21669 856493
117919 120990 493002
153636 179968 654300
39893 135531 848979
108485 162589 743837
91586 147436 699265
19679 41670 382783
65607 111341 606488
148428 158849 47062
29570 140241 564937
78013 83082 870159
5...

output:

081ce3c351cbf526b37954b9ad30f2b531a7585c
OK
283501

result:

ok 

Test #113:

score: 0
Accepted
time: 124ms
memory: 43892kb

input:

cc61ad56a4797fb3f5c9529f73ce6fcedd85669b
1
190305 106375 106393 3906600881581570
0 1 538027
1 2 267441
2 3 669094
3 4 344362
4 5 273144
5 6 624485
6 7 781316
7 8 248074
8 9 980410
9 10 200372
10 11 197376
11 12 308896
12 13 513662
13 14 719505
14 15 968710
15 16 327236
16 17 310175
17 18 557259
18 1...

output:

081ce3c351cbf526b37954b9ad30f2b531a7585c
OK
353458

result:

ok 

Test #114:

score: 0
Accepted
time: 163ms
memory: 38464kb

input:

cc61ad56a4797fb3f5c9529f73ce6fcedd85669b
1
196513 93137 157547 24397740
8120 136678 332261
60097 176503 456844
170214 191406 684555
88692 155607 618017
73094 88809 45691
78691 121238 247860
109586 143094 147681
35900 47030 701610
22683 194679 889150
55427 75448 583191
91900 160719 556452
111720 1855...

output:

081ce3c351cbf526b37954b9ad30f2b531a7585c
OK
22

result:

ok 

Test #115:

score: 0
Accepted
time: 152ms
memory: 38564kb

input:

cc61ad56a4797fb3f5c9529f73ce6fcedd85669b
1
190040 38819 156602 379545
56658 90965 510829
73740 87786 662399
137627 142153 255566
20637 117193 651725
165652 173211 779127
16043 123235 562066
51234 181357 655155
64658 85223 988653
57389 164513 301039
45075 101839 704382
16949 113797 706933
30274 34210...

output:

081ce3c351cbf526b37954b9ad30f2b531a7585c
OK
4

result:

ok 

Test #116:

score: 0
Accepted
time: 134ms
memory: 36968kb

input:

cc61ad56a4797fb3f5c9529f73ce6fcedd85669b
1
194834 0 5108 14516245
0 1 2
1 2 2
2 3 2
3 4 2
4 5 2
5 6 2
6 7 2
7 8 2
8 9 2
9 10 2
10 11 2
11 12 2
12 13 2
13 14 2
14 15 2
15 16 2
16 17 2
17 18 2
18 19 2
19 20 2
20 21 2
21 22 2
22 23 2
23 24 2
24 25 2
25 26 2
26 27 2
27 28 2
28 29 2
29 30 2
30 31 2
31 32...

output:

081ce3c351cbf526b37954b9ad30f2b531a7585c
OK
5114

result:

ok 

Test #117:

score: 0
Accepted
time: 68ms
memory: 44588kb

input:

cc61ad56a4797fb3f5c9529f73ce6fcedd85669b
1
193875 0 193676 28133625880
0 1 1
1 2 1
2 3 1
3 4 1
4 5 1
5 6 1
6 7 1
7 8 1
8 9 1
9 10 1
10 11 1
11 12 1
12 13 1
13 14 1
14 15 1
15 16 1
16 17 1
17 18 1
18 19 1
19 20 1
20 21 1
21 22 1
22 23 1
23 24 1
24 25 1
25 26 1
26 27 1
27 28 1
28 29 1
29 30 1
30 31 1
...

output:

081ce3c351cbf526b37954b9ad30f2b531a7585c
OK
387357

result:

ok 

Test #118:

score: 0
Accepted
time: 166ms
memory: 43688kb

input:

cc61ad56a4797fb3f5c9529f73ce6fcedd85669b
1
184059 34460 68431 245105974181643
65425 119252 751359
99069 139446 116057
78600 102224 982197
102573 145005 465180
54210 160611 316785
101778 141620 488793
8317 89167 631555
46142 130213 906837
46911 85324 146453
85547 182467 334318
29674 114482 689680
544...

output:

081ce3c351cbf526b37954b9ad30f2b531a7585c
OK
125329

result:

ok 

Test #119:

score: 0
Accepted
time: 147ms
memory: 39348kb

input:

cc61ad56a4797fb3f5c9529f73ce6fcedd85669b
1
189382 7896 50437 657060297474739
14713 140091 583737
32745 60621 761136
20814 82576 639199
18851 158633 593236
62700 176105 788642
5770 35345 700660
102309 138458 969208
60656 121867 468857
36367 47070 321981
90579 147656 887480
52377 103261 878060
109483 ...

output:

081ce3c351cbf526b37954b9ad30f2b531a7585c
OK
114616

result:

ok 

Test #120:

score: 0
Accepted
time: 168ms
memory: 39012kb

input:

cc61ad56a4797fb3f5c9529f73ce6fcedd85669b
1
199887 82724 178667 626450831093
122965 197376 897902
81291 100410 876005
3175 183772 364214
54296 75243 225561
162385 182023 382214
54094 87738 221775
70922 182995 787131
17709 164614 79441
96196 153613 759918
115639 177285 506584
92361 166237 974945
34058...

output:

081ce3c351cbf526b37954b9ad30f2b531a7585c
OK
117616

result:

ok 

Test #121:

score: 0
Accepted
time: 133ms
memory: 9792kb

input:

cc61ad56a4797fb3f5c9529f73ce6fcedd85669b
12
17173 279 4487 583590
2469 4487 490
2261 2469 365540
891 2261 9849
891 14416 392
14416 15063 54831
15063 16412 333592
16412 16684 294
279 2469 245
320 2469 98
250 2469 196
1652 2469 98
862 2469 294
2469 7721 49
2469 10367 98
2469 3828 441
2469 13940 245
24...

output:

081ce3c351cbf526b37954b9ad30f2b531a7585c
OK
979
49999
41813
604
44727
43137
28
36275
44583
762
3191
853

result:

ok 

Test #122:

score: 0
Accepted
time: 82ms
memory: 6476kb

input:

cc61ad56a4797fb3f5c9529f73ce6fcedd85669b
2411
94 20 39 6468
37 39 147
37 86 257593
27 86 202615
4 27 441
4 49 460698
49 56 978334
42 56 392
20 37 392
21 37 245
12 37 294
10 37 343
20 31 441
5 21 49
21 36 392
12 28 490
12 74 441
12 51 490
12 82 245
28 33 490
28 90 196
28 57 196
28 64 147
28 40 147
28...

output:

081ce3c351cbf526b37954b9ad30f2b531a7585c
OK
19
199
199
34
135
129
15
129
189
63
199
185
24
131
28
99
183
30
163
183
19
139
183
42
199
185
16
149
183
22
107
46
199
189
27
199
183
65
199
187
25
199
183
45
183
185
39
145
185
33
199
185
38
199
185
74
107
37
199
185
32
137
187
24
199
37
141
23
167
185
55...

result:

ok 

Extra Test:

score: 0
Extra Test Passed