QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#292651#7118. Closing Timetraining4usaco18 273ms170532kbC++176.2kb2023-12-28 10:26:532023-12-28 10:26:53

Judging History

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

  • [2024-04-28 08:13:32]
  • 管理员手动重测本题所有提交记录
  • 测评结果:18
  • 用时:306ms
  • 内存:173084kb
  • [2023-12-28 10:26:53]
  • 评测
  • 测评结果:18
  • 用时:273ms
  • 内存:170532kb
  • [2023-12-28 10:26:53]
  • 提交

answer

#include <iostream>
#include <vector>
#include <algorithm>
#include <assert.h>
using namespace std;

//#define int long long
typedef long long ll;
#define pii pair<ll, ll>
#define all(v) v.begin(), v.end()
#define ff first
#define ss second
const ll MAXN = 2e5 + 5;
const ll MAXM = 5e6 + 5;   // implicit segtree
const ll INF = 1e18 + 7;
const ll MAX = 1e12 + 5;

ll dist[MAXN][2];
ll a[MAXN], b[MAXN];   // 2 costs
ll ord[MAXN];
ll ans, ans2;  // no overlap, overlap
vector<pii> adj[MAXN];

ll have;

ll tot = 1;
ll val[MAXM], cnt[MAXM];
ll lc[MAXM], rc[MAXM];
vector<ll> costa, costb;

bool comp(ll i, ll j) {
    if(costb[i] == costb[j]) return costa[i] < costa[j];
    return costb[i] < costb[j];
}

void check() {
    if(tot >= MAXM) while(true) cout << "oof";
}

void pull(ll u) {
    val[u] = val[lc[u]] + val[rc[u]];
    cnt[u] = cnt[lc[u]] + cnt[rc[u]];
}

void ins(ll u, ll l, ll r, ll pos, ll freq) {  // segtree indexed by val so pos = val
    check();
    if(l == r) {
//        cout << "updating with " << pos << " " << freq << endl;
        val[u] += pos * freq;
        cnt[u] += freq;
        return;
    }

    ll mid = (l + r) / 2;

    if(pos <= mid) {
        if(lc[u] == 0) lc[u] = ++tot;
        ins(lc[u], l, mid, pos, freq);
    }
    else {
        if(rc[u] == 0) rc[u] = ++tot;
        ins(rc[u], mid + 1, r, pos, freq);
    }
    pull(u);
}

int walk(ll u, ll l, ll r) {
    if(u == 0) return 0;
    // cout << u << " " << l << " " << r << " " << val[u] << " " << cnt[u] << endl;
    if(l == r) {
//        cout << l << " " << cnt[u] << " " << have << " " << l << endl;
        ll sub = min(cnt[u], have / l);
        have -= l * sub;
//        cout << "returning " << sub << endl;
        return sub;
    }

    ll mid = (l + r) / 2;
    if(val[lc[u]] > have) return walk(lc[u], l, mid);

//    cout << "left val: " << val[lc[u]] << " node, lc: " << u << " " << lc[u] << endl;
    have -= val[lc[u]];
    if(have) return cnt[lc[u]] + walk(rc[u], mid + 1, r);
    return cnt[lc[u]];
}

void dfs(ll u, ll p, ll type) {
    for(auto [v, w] : adj[u]) {
        if(v == p) continue;
        dist[v][type] = dist[u][type] + w;

        dfs(v, u, type);
    }
}

int max_score(int n, int x, int y, ll k, vector<int> u, vector<int> v, vector<int> w) {
    // cout << "hello" << endl;
    for(int i = 0; i < n - 1; ++i) {
        // cout << "i: " << i << endl;
        // cout << u[i] << " " << v[i] << " " << w[i] << endl;
        adj[u[i]].push_back({v[i], w[i]});
        adj[v[i]].push_back({u[i], w[i]});
    }

    // cout << "done with init" << endl;

    dfs(x, -1, 0); dfs(y, -1, 1);

    for(int i = 0; i < n; ++i) {
        a[i] = min(dist[i][0], dist[i][1]);
        b[i] = max(dist[i][0], dist[i][1]);
    }

    // seperate
    vector<ll> sortedDists;
    for(int i = 0; i < n; ++i) {
        sortedDists.push_back(dist[i][0]); sortedDists.push_back(dist[i][1]);
    }

    sort(all(sortedDists));

    // cout << "done with seperate" << endl;

    ll tot = k;
    for(auto val : sortedDists) {
        if(tot >= val) {
            ++ans; tot -= val;
        }
        else break;
    }

    // overlap
    bool flag = false;
    ll distXY = dist[y][0];    // dist between x,y

//    cout << "dist between x,y: " << distXY << endl;

    int forced = 0;
    for(int i = 0; i < n; ++i) {
        ord[i] = i;
        if(dist[i][0] + dist[i][1] == distXY) { // on the path
//            cout << "node " << i << " is on path" << endl;
            k -= a[i]; ++forced;  // forced

//            cout << "i: " << i << endl;
            costa.push_back(b[i] - a[i]);
            costb.push_back(INF);
//            cout << b[i] - a[i] << endl;
            ins(1, 1, MAX, b[i] - a[i], 1);
            if(k < 0) flag = true;
//            cout << "need " << b[i] - a[i] << " to turn to 2" << endl;
        }
        else {
            costa.push_back(a[i]);
            costb.push_back(b[i]);
            ins(1, 1, MAX, a[i], 1);
        }
//            cout << "need " << a[i] << " for extra" << endl;
    }

    // cout << "done with costa, costb: " << endl;

    sort(ord, ord + n, comp);

    // cout << "done sorting" << endl;
//
//    cout << "ord: ";
//    for(int i = 0; i < n; ++i) cout << ord[i] << " "; cout << endl;
//    cout << "costa: ";
//    for(int i = 0; i < n; ++i) cout << costa[ord[i]] << " "; cout << endl;
//    cout << "costb: ";
//    for(int i = 0; i < n; ++i) cout << costb[ord[i]] << " "; cout << endl;
//    cout << endl;

    ll sum = 0;

    have = k;
    ans2 = forced + walk(1, 1, MAX);

    // cout << "done with walk" << endl;

//    cout << "allmax: " << walk(1, 0, MAX) << endl;

//    cout << "k: " << k << endl;
    for(int i = 0; i < n - forced; ++i) {
        // cout << "i: " << i << endl;
//        cout << "before tot: " << t[1].cnt << endl;
        ins(1, 1, MAX, costa[ord[i]], -1); ins(1, 1, MAX, costb[ord[i]] - costa[ord[i]], 1);

        sum += costa[ord[i]];
        have = k - sum;
//        cout << "have: " << have << endl;
        if(have < 0) break;
        ll maxv = walk(1, 1, MAX) + i + 1;
//        cout << "maxv, forced: " << maxv << " " << forced << endl;
        ans2 = max(ans2, forced + maxv);
//        cout << "ans2: " << ans2 << endl;
    }

//    cout << "total val of tree: " << val[1] << endl;
//
//    cout << "forced overlap: " << forced << endl;
//    cout << "total overlap ans: " << ans2 << endl;
    if(flag) ans2 = 0;

//    cout << "have: " << have << endl;
    // cout << ans << " " << ans2 << endl;
    // cout << "returning" << endl;
    return max(ans, ans2);
}

// signed main() {
//     cout << "AHHH" << endl;
//     int n, x, y;
//     ll k; cin >> n >> x >> y >> k;
// //
//     vector<int> u(n - 1), v(n - 1), w(n - 1);
//
//     for(int i = 0; i < n - 1; ++i) cin >> u[i] >> v[i] >> w[i];
//
//     // for(int i = 0; i < n - 1; ++i) cin >> u[i];
//     // for(int i = 0; i < n - 1; ++i) cin >> v[i];
//     // for(int i = 0; i < n - 1; ++i) cin >> w[i];
//
//     cout << "doomed" << endl;
//
//     cout << "ans: " << max_score(n, x, y, k, u, v, w) << endl;
//     cout << "done" << endl;
//     return 0;
// }

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 0
Runtime Error

Test #1:

score: 8
Accepted
time: 267ms
memory: 146784kb

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: 273ms
memory: 170532kb

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: -8
Runtime Error

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:


result:


Subtask #2:

score: 9
Accepted

Test #4:

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

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: 18392kb

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: 2ms
memory: 18392kb

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: 18168kb

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: 2ms
memory: 16136kb

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: 18112kb

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: 18116kb

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: 2ms
memory: 18164kb

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: 2ms
memory: 18108kb

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: 18112kb

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: 2ms
memory: 16320kb

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: 0
Time Limit Exceeded

Dependency #2:

100%
Accepted

Test #15:

score: 0
Time Limit Exceeded

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:


result:


Subtask #4:

score: 0
Skipped

Dependency #3:

0%

Subtask #5:

score: 9
Accepted

Test #36:

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

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: 2ms
memory: 16064kb

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: 2ms
memory: 16052kb

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: 2ms
memory: 18076kb

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: 2ms
memory: 16056kb

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: 16052kb

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: 2ms
memory: 18112kb

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: 3ms
memory: 18364kb

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: 16336kb

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: 2ms
memory: 18116kb

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: 2ms
memory: 16072kb

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: 2ms
memory: 18160kb

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: 18104kb

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: 18112kb

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: 2ms
memory: 16056kb

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: 2ms
memory: 16060kb

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: 18116kb

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: 18096kb

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: 0
Runtime Error

Dependency #2:

100%
Accepted

Dependency #5:

100%
Accepted

Test #54:

score: 0
Runtime Error

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:


result:


Subtask #7:

score: 0
Skipped

Dependency #3:

0%

Subtask #8:

score: 0
Skipped

Dependency #4:

0%

Subtask #9:

score: 0
Skipped

Dependency #1:

0%