QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#72637#68. Designated Citiesperspective33 410ms76884kbC++176.3kb2023-01-17 10:01:082023-01-17 10:01:09

Judging History

你现在查看的是最新测评结果

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-01-17 10:01:09]
  • 评测
  • 测评结果:33
  • 用时:410ms
  • 内存:76884kb
  • [2023-01-17 10:01:08]
  • 提交

answer

#include <bits/stdc++.h>
#include <bits/extc++.h>
 
#define StarBurstStream ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define iter(a) a.begin(), a.end()
#define riter(a) a.rbegin(), a.rend()
#define lsort(a) sort(iter(a))
#define gsort(a) sort(riter(a))
#define pb(a) push_back(a)
#define eb(a) emplace_back(a)
#define pf(a) push_front(a)
#define ef(a) emplace_front(a)
#define pob pop_back()
#define pof pop_front()
#define mp(a, b) make_pair(a, b)
#define F first
#define S second
#define mt make_tuple
#define gt(t, i) get<i>(t)
#define iceil(a, b) (((a) + (b) - 1) / (b))
#define tomax(a, b) ((a) = max((a), (b)))
#define tomin(a, b) ((a) = min((a), (b)))
#define topos(a) ((a) = (((a) % MOD + MOD) % MOD))
#define uni(a) a.resize(unique(iter(a)) - a.begin())
#define printv(a, b) {bool pvaspace=false; \
for(auto pva : a){ \
    if(pvaspace) b << " "; pvaspace=true;\
    b << pva;\
}\
b << "\n";}
 
using namespace std;
using namespace __gnu_pbds;
 
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
 
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using pdd = pair<ld, ld>;
using tiii = tuple<int, int, int>;
 
const ll MOD = 1000000007;
const ll MAX = 2147483647;
 
template<typename A, typename B>
ostream& operator<<(ostream& o, pair<A, B> p){
    return o << '(' << p.F << ',' << p.S << ')';
}
 
struct Node{
    int l = -1, r = -1;
    ll mx = 0, tag = 0;
    ll rv(){
        return mx + tag;
    }
};
 
struct SegmentTree{
    vector<Node> st;
    int ts = 0;
 
    SegmentTree(int sz): st(2 * sz) {}
 
    int build(int l, int r){
        int id = ts++;
        if(l == r) return id;
        int m = (l + r) / 2;
        st[id].l = build(l, m);
        st[id].r = build(m + 1, r);
        return id;
    }
 
    void modify(int l, int r, ll v, int L, int R, int id){
        if(l == L && r == R){
            st[id].tag += v;
            return;
        }
        int M = (L + R) / 2;
        if(r <= M) modify(l, r, v, L, M, st[id].l);
        else if(l > M) modify(l, r, v, M + 1, R, st[id].r);
        else{
            modify(l, M, v, L, M, st[id].l);
            modify(M + 1, r, v, M + 1, R, st[id].r);
        }
        st[id].mx = max(st[st[id].l].rv(), st[st[id].r].rv());
    }
 
    void push(int id){
        st[st[id].l].tag += st[id].tag;
        st[st[id].r].tag += st[id].tag;
        st[id].mx = st[id].rv();
        st[id].tag = 0;
    }
 
    int query(int L, int R, int id){
        if(L == R) return L;
        push(id);
        int M = (L + R) / 2;
        if(st[st[id].l].rv() >= st[st[id].r].rv()) return query(L, M, st[id].l);
        else return query(M + 1, R, st[id].r);
    }
 
    ll mx(){
        return st[0].rv();
    }
};
 
struct edge{
    ll a, b, c, d;
    ll get(int v){
        if(b == v) return c;
        else return d;
    }
    int ano(int v){
        return a ^ b ^ v;
    }
};
 
vector<vector<edge>> g;
vector<ll> dp, dp2, ans, ans2;
 
void dfs1(int now, int p){
    vector<ll> tmp;
    for(edge i : g[now]){
        int v = i.ano(now);
        if(v == p) continue;
        dfs1(v, now);
        dp[now] += dp[v] + i.get(v);
        dp2[now] = max(dp2[now], dp2[v] + i.get(v));
        tmp.eb(dp2[v] + i.get(v));
    }
    gsort(tmp);
    if(tmp.size() >= 2) ans2[now] = tmp[0] + tmp[1];
    else ans2[now] = dp2[now];
}
 
void dfs2(int now, int p){
    for(edge i : g[now]){
        int v = i.ano(now);
        if(v == p){
            ans[now] = ans[p] - i.get(now) + i.get(p);
            continue;
        }
    }
    for(edge i : g[now]){
        int v = i.ano(now);
        if(v == p){
            continue;
        }
        dfs2(v, now);
    }
}
 
vector<int> in, out, pr;
int ts = 0;
vector<ll> pw;
 
void dfs3(int now, int p, ll w){
    pr[now] = p;
    pw[now] = w;
    in[now] = ++ts;
    for(edge i : g[now]){
        int v = i.ano(now);
        if(v == p) continue;
        dfs3(v, now, i.get(v));
    }
    out[now] = ts;
}
 
int main(){
    StarBurstStream
 
    int n;
    cin >> n;
 
    dp.resize(n + 1);
    dp2.resize(n + 1);
    ans.resize(n + 1);
    ans2.resize(n + 1);
    in.resize(n + 1);
    out.resize(n + 1);
    pr.resize(n + 1);
    pw.resize(n + 1);
 
    g.resize(n + 1);
    for(int i = 0; i < n - 1; i++){
        int u, v, c, d;
        cin >> u >> v >> c >> d;
        edge e({u, v, c, d});
        g[u].eb(e);
        g[v].eb(e);
    }
 
    dfs1(1, 1);
    ans[1] = dp[1];
    dfs2(1, 1);
//    printv(dp, cerr);
//    printv(dp2, cerr);
//    printv(ans, cerr);
//    printv(ans2, cerr);
 
    int rt = 1;
    for(int i = 2; i <= n; i++){
        if(ans[i] - ans2[i] < ans[rt] - ans2[rt]) rt = i;
    }
 
    dfs3(rt, rt, 0);
 
    SegmentTree st(n);
    st.build(1, n);
//    printv(pw, cerr);
//    printv(in, cerr);
//    printv(out, cerr);
    vector<int> id(n + 1);
 
    for(int i = 1; i <= n; i++){
        id[in[i]] = i;
        st.modify(in[i], out[i], pw[i], 1, n, 0);
    }
//    cerr << rt << "\n";
 
    vector<ll> a(n + 1);
    ll a1 = 1LL << 60;
    ll a2 = 1LL << 60;
    for(int i = 1; i <= n; i++) a1 = min(a1, ans[i]), a2 = min(a2, ans[i] - ans2[i]);
    int deg = 0;
    int cnt = 1;
    vector<bool> del(n + 1);
    del[rt] = true;
    ll tans = 0;
    while(st.mx() > 0){
        int now = id[st.query(1, n, 0)];
        ll tmx = st.mx(), tcnt = 0;
        tans += st.mx();
//        cerr << "test " << now << " " << st.mx() << "\n";
        while(!del[now]){
            del[now] = true;
            st.modify(in[now], out[now], -pw[now], 1, n, 0);
            tcnt += pw[now];
//            cerr << "del " << now << "\n";
            now = pr[now];
        }
        if(now == rt){
            deg++;
            if(deg == 2) cnt--;
        }
        cnt++;
//        cerr << cnt << " " << tans << "\n";
        a[cnt] = tans;
    }
    for(int i = 1; i <= n; i++) a[i] = max(a[i - 1], a[i]);
    assert(a[2] <= ans2[rt]);
//    assert(a[2] == ans2[rt]);
//    printv(a, cerr);
//    cerr << ans[rt] << "\n";
 
    int q;
    cin >> q;
    while(q--){
        int e;
        cin >> e;
        if(e == 1) cout << a1 << "\n";
        else if(e == 2) cout << a2 << "\n";
        else cout << ans[rt] - a[e] << "\n";
    }
 
    return 0;
}

详细

Subtask #1:

score: 0
Wrong Answer

Test #1:

score: 6
Accepted
time: 0ms
memory: 3432kb

input:

2
1 2 781089648 283888890
2
1
2

output:

283888890
0

result:

ok 2 lines

Test #2:

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

input:

16
6 10 160848335 124052868
7 1 241203243 110601447
14 6 290972019 163072373
11 15 938517011 154373610
12 1 138651641 741445657
7 8 60218933 280830068
16 15 203079209 633547400
11 7 199606763 919756826
14 12 266702877 916493997
15 13 905937802 481991969
2 10 234605456 722866810
3 5 366455156 4966982...

output:

6311369523
2092762454
966156735
60218933
0
0
0
0
0
0
0
0
0
0
0
0

result:

ok 16 lines

Test #3:

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

input:

16
3 4 204022014 914663555
9 10 11007340 458844696
2 7 605164817 895349276
14 11 434326485 550918606
14 7 712866927 489761842
6 1 356406033 534499656
16 8 942553720 855217399
5 10 865707145 586883622
6 13 108330979 234031340
15 8 769531307 948036095
3 16 358448538 363203546
5 2 419315988 76297418
12...

output:

7413430560
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0

result:

ok 16 lines

Test #4:

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

input:

16
4 5 1000000000 1000000000
10 5 1000000000 1000000000
8 5 1000000000 1000000000
11 13 999999646 999999646
15 16 999998089 999998089
7 5 929 929
14 7 898 898
16 9 159 159
6 12 603 603
9 2 999997930 999997930
3 6 999999242 999999242
5 12 155 155
16 14 84 84
14 1 999998173 999998173
12 13 199 199
16
...

output:

7999996107
5999996107
4999996107
3999996107
2999996107
1999996262
999998089
0
0
0
0
0
0
0
0
0

result:

ok 16 lines

Test #5:

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

input:

16
11 14 14368758 85219578
14 16 643747916 252121045
9 14 727413140 523990811
2 15 521253466 147320442
7 13 866289084 908489699
12 6 320730514 344516785
10 9 516379646 496493179
15 8 776569142 612383860
8 3 734861011 149748310
1 5 815040382 677607019
2 12 50609677 301797586
5 14 716517909 635543949
...

output:

7189308203
2211904770
1191420780
456559769
85219578
0
0
0
0
0
0
0
0
0
0
0

result:

ok 16 lines

Test #6:

score: -6
Wrong Answer
time: 1ms
memory: 3476kb

input:

16
13 9 720744296 759388601
13 5 458441737 833011123
1 16 698474192 71086181
3 8 861918984 114516836
15 10 278084894 710666762
4 8 287405359 250250967
1 6 741642264 735381406
2 15 792787000 825787518
6 12 261754526 230466084
13 7 938274540 78969406
12 10 202958723 294264294
12 4 98252269 169605483
3...

output:

5844026168
2690903861
2547369084
1128150596
458441737
0
0
0
0
0
0
0
0
0
0
0

result:

wrong answer 3rd lines differ - expected: '1848894892', found: '2547369084'

Subtask #2:

score: 7
Accepted

Test #12:

score: 7
Accepted
time: 2ms
memory: 3412kb

input:

2
1 2 683402985 526289818
1
1

output:

526289818

result:

ok single line: '526289818'

Test #13:

score: 0
Accepted
time: 348ms
memory: 47060kb

input:

200000
30498 170310 456566691 649436035
88553 73637 443596936 376869783
157116 8270 670934073 119072463
24742 48732 237943289 398782798
118620 71333 841086509 861755957
91523 118037 345609124 755508586
182978 92078 999023640 247489369
57480 73002 550952716 31090859
85037 151494 615937607 181113974
8...

output:

100090261531134

result:

ok single line: '100090261531134'

Test #14:

score: 0
Accepted
time: 339ms
memory: 72348kb

input:

200000
62380 190510 660465798 980286669
73494 59167 399860395 883378826
78917 156327 617261054 354160980
25845 163881 79154538 824380095
97426 144191 891448990 704743172
73271 43633 837335594 922276690
193758 169742 364918510 151494521
62996 52874 828453581 144363372
199529 178275 804482094 11831376...

output:

100066669866017

result:

ok single line: '100066669866017'

Test #15:

score: 0
Accepted
time: 309ms
memory: 47060kb

input:

200000
183258 143073 982 982
31786 177754 580 580
26332 6792 85 85
6390 70312 847 847
193105 75442 735 735
172433 196956 999926081 999926081
114861 33150 991 991
108634 161301 206 206
122529 105025 426 426
21388 86201 300 300
170711 87982 999923960 999923960
120595 43763 921 921
99462 120013 737 737...

output:

81103004367189

result:

ok single line: '81103004367189'

Test #16:

score: 0
Accepted
time: 327ms
memory: 46724kb

input:

200000
1539 92316 48323903 202410877
35890 69243 415172828 308900141
190963 50985 755719943 159735479
72146 159885 72946173 622268672
127505 64851 485107488 958218451
43378 89830 417162770 911217276
158176 69012 355971119 826228739
146386 106745 99361947 614603091
190012 95465 758111489 876554997
40...

output:

99944714663527

result:

ok single line: '99944714663527'

Test #17:

score: 0
Accepted
time: 349ms
memory: 50768kb

input:

200000
13693 159720 471504101 851110321
134244 80255 908560356 681906336
52579 127713 744119846 470734684
84038 32991 525544642 941494197
118155 105510 885724375 303139090
24258 176279 806826007 371683303
46557 54039 791816892 13705486
119090 160877 781290926 259135450
21899 55292 338745705 70209065...

output:

100142110488065

result:

ok single line: '100142110488065'

Test #18:

score: 0
Accepted
time: 298ms
memory: 46188kb

input:

200000
51485 158642 829759545 555246994
46408 182427 680884310 952048393
181386 51981 774364250 510078376
158642 137221 958595981 417456152
158642 13560 525026357 666355475
158642 119626 653370640 66503632
23721 100035 260540702 507629954
180546 101304 430322145 698388876
62412 158642 536391228 6818...

output:

100029161376725

result:

ok single line: '100029161376725'

Test #19:

score: 0
Accepted
time: 379ms
memory: 72940kb

input:

200000
172976 108672 288769649 485088836
159642 46318 971501113 486464598
120751 69878 169239703 173145059
44498 138117 820693607 695329677
158520 63527 366383754 437019528
19626 64856 939531671 635492288
21084 66469 694278429 909732840
30440 161053 573714265 203831805
160668 89739 513226897 3644949...

output:

99756547102864

result:

ok single line: '99756547102864'

Test #20:

score: 0
Accepted
time: 277ms
memory: 48324kb

input:

200000
154441 4651 747796649 453770199
137511 154441 46174763 669025918
154441 46408 501310306 365029626
154441 70897 637262505 711161748
149885 154441 906469650 910775313
56604 154441 120489234 529690198
154441 128437 857569560 602188933
154441 12895 528165172 22359068
177797 154441 947733025 70024...

output:

100044587345734

result:

ok single line: '100044587345734'

Subtask #3:

score: 9
Accepted

Test #21:

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

input:

2
2 1 92722556 873785501
1
2

output:

0

result:

ok single line: '0'

Test #22:

score: 0
Accepted
time: 322ms
memory: 46980kb

input:

200000
99982 83075 709942852 92942003
168325 12929 879930937 637190556
85628 123672 784369088 731448156
34917 117619 569166498 663184347
92257 112058 369526210 824568522
32464 109884 258245678 691717157
129594 115097 627894556 937225369
54700 187473 81636213 510866047
52020 197198 577461848 47343465...

output:

99980874607500

result:

ok single line: '99980874607500'

Test #23:

score: 0
Accepted
time: 313ms
memory: 76640kb

input:

200000
95719 149301 794275735 801652183
143736 125721 536375521 497451149
4070 82461 612985394 185791331
187444 177732 203761783 978534058
64389 115859 767852404 159121136
62787 153732 112099169 754249162
9791 45944 722996059 45421943
86166 76684 734259220 976172654
144257 171894 593459611 866106682...

output:

0

result:

ok single line: '0'

Test #24:

score: 0
Accepted
time: 314ms
memory: 47024kb

input:

200000
91072 122945 396 396
108944 92874 371 371
102962 134537 999957708 999957708
76444 112175 999974422 999974422
92013 18283 224 224
47655 149920 674 674
199293 47834 240 240
143059 145065 306 306
135615 109141 702 702
1701 49881 38 38
73750 69655 585 585
44570 126598 823 823
154521 29581 601 601...

output:

81260440461409

result:

ok single line: '81260440461409'

Test #25:

score: 0
Accepted
time: 331ms
memory: 46800kb

input:

200000
67335 151665 90056816 679694202
146132 193464 78979944 31693610
12681 195973 465813284 579615164
121902 196667 589074557 966872296
161123 6959 801681236 38291288
183137 2828 885145066 943464735
120574 8814 71857893 233909004
125797 191097 749557098 250997809
169492 36886 49204718 996198360
12...

output:

99809636135608

result:

ok single line: '99809636135608'

Test #26:

score: 0
Accepted
time: 350ms
memory: 51344kb

input:

200000
93451 53831 682115484 829322216
86322 162604 254622021 431488750
147239 61110 113915150 613534953
82511 156348 664035377 946257404
88519 17517 226289497 122021251
112417 43731 544607243 486486588
35770 121679 465952267 546169853
90586 30876 245521241 309759680
113666 65754 237364361 270831775...

output:

84393916618910

result:

ok single line: '84393916618910'

Test #27:

score: 0
Accepted
time: 307ms
memory: 47032kb

input:

200000
56712 10679 477548548 250987465
48768 10679 648414920 382252569
10679 138629 849839069 418932116
10679 196853 372927887 111589355
66660 10679 746411098 882637935
186062 10679 311457882 818901438
10679 60211 350285495 867834084
143533 10679 509730429 587741385
10679 87624 514054621 907539858
1...

output:

99896973077522

result:

ok single line: '99896973077522'

Test #28:

score: 0
Accepted
time: 410ms
memory: 63736kb

input:

200000
137614 48684 905625272 307783875
31464 61159 171680699 710988975
53283 142419 838631110 435432764
123798 38255 535935021 734147826
29584 149426 371764453 875958871
175282 48325 804482249 620893459
55526 102124 797947818 494644787
62800 128616 320838726 279002065
33102 171918 195788467 4014179...

output:

38157344174731

result:

ok single line: '38157344174731'

Test #29:

score: 0
Accepted
time: 268ms
memory: 46600kb

input:

200000
199712 1338 415002784 805964493
102372 1338 193298420 76290567
28728 1338 804225462 746940935
1338 98005 301699377 822393419
1338 162021 577703287 907659652
1338 57339 183927508 654074158
1338 168042 859700698 427766288
1338 87100 984454975 400556960
193867 1338 787582553 819174352
1338 18369...

output:

99976824303453

result:

ok single line: '99976824303453'

Subtask #4:

score: 0
Skipped

Dependency #1:

0%

Subtask #5:

score: 17
Accepted

Test #45:

score: 17
Accepted
time: 0ms
memory: 3536kb

input:

2
1 2 543195986 144983073
1
1

output:

144983073

result:

ok single line: '144983073'

Test #46:

score: 0
Accepted
time: 315ms
memory: 46984kb

input:

200000
73974 46059 151001152 42729969
112523 175399 580450366 914798605
65645 46109 848220487 698683602
63048 106502 596698349 144038980
98888 11174 948423025 972032422
115490 95315 788936645 231068151
5185 187319 690370465 616111588
10331 161483 606127487 195799307
133831 170948 694137989 490575964...

output:

5449143475272

result:

ok single line: '5449143475272'

Test #47:

score: 0
Accepted
time: 401ms
memory: 76884kb

input:

200000
55956 185434 219535533 77244021
65295 10318 437281446 132103674
53900 4204 965744871 874409893
67035 24879 596850278 341918390
70240 26074 837750040 304745373
116294 182996 806065306 688634320
21494 104498 465710706 695396976
71934 165575 761917591 524436924
95534 186806 199405432 534812435
1...

output:

99875550841137

result:

ok single line: '99875550841137'

Test #48:

score: 0
Accepted
time: 320ms
memory: 47068kb

input:

200000
7483 177514 697 697
3231 129745 999845999 999845999
109949 87100 999891988 999891988
29413 172327 299 299
170523 87926 999952504 999952504
124853 61455 999934698 999934698
42350 132622 91 91
69970 50413 815 815
55204 183824 999939325 999939325
59484 71281 206 206
37791 170069 451 451
50058 17...

output:

1780721830674

result:

ok single line: '1780721830674'

Test #49:

score: 0
Accepted
time: 314ms
memory: 47536kb

input:

200000
105838 73186 128349778 353598318
63031 136227 114628484 285882597
191398 198457 37866162 634787861
171869 171043 573009985 810912546
37331 137239 646433925 996743109
49856 185509 134224603 278011602
160259 37541 150993603 746491914
59331 161858 652495320 165803995
117507 178303 933794623 4222...

output:

98851135600011

result:

ok single line: '98851135600011'

Test #50:

score: 0
Accepted
time: 339ms
memory: 47316kb

input:

200000
140663 129611 636279 260017
196385 122941 547533 592198
114132 160778 43364 613890
88859 39847 443789 512911
114404 161183 856155 49796
67299 83775 31748 559092
72303 74977 250332 609125
68306 161828 565819 826801
65357 98383 789137 755350
108533 38461 214064 982695
137910 8024 674613 855905
...

output:

121701643090

result:

ok single line: '121701643090'

Test #51:

score: 0
Accepted
time: 358ms
memory: 47372kb

input:

200000
194805 91167 96006427 746087633
19172 51672 703076613 703507534
129776 6959 147190461 210591357
107179 63438 934326702 717246383
80551 7862 340033856 42790691
174094 147100 93534123 588911952
16841 106289 330166235 144103001
127608 89570 526650289 259902042
83162 168481 830039469 619808700
97...

output:

98850979599881

result:

ok single line: '98850979599881'

Test #52:

score: 0
Accepted
time: 346ms
memory: 47364kb

input:

200000
104188 40173 518798 400873
74450 186185 454835 624317
34752 157183 496291 489884
53876 145380 544680 183688
8015 65233 387174 69062
34450 54750 507740 406375
131441 167028 859185 425529
160168 160307 565172 163779
51621 92179 414635 854124
192560 59890 67817 557177
20346 38814 909372 207112
1...

output:

2073045420823

result:

ok single line: '2073045420823'

Test #53:

score: 0
Accepted
time: 331ms
memory: 47408kb

input:

200000
36234 48499 497762619 268240611
61631 22160 249970846 76734461
96939 174559 273525596 277814042
33667 191684 350573347 320714717
66892 81318 492270419 242486005
9223 51478 302202500 1452383
110040 35016 129099352 359187439
17314 132066 183661699 778288251
110040 70931 750625996 484714051
4396...

output:

51135293866439

result:

ok single line: '51135293866439'

Test #54:

score: 0
Accepted
time: 331ms
memory: 50736kb

input:

200000
183062 61942 195495034 670262692
160284 94545 558986737 74870683
162714 101868 929690547 336544868
189299 19925 853155959 659182060
121123 106943 326206617 124808162
26384 54945 996860044 871381136
28523 100744 300454000 658917117
143026 153583 958105033 893037327
157880 138484 444666156 3319...

output:

3299654185147

result:

ok single line: '3299654185147'

Test #55:

score: 0
Accepted
time: 348ms
memory: 48080kb

input:

200000
159287 10497 134128546 375519540
54050 6880 652209391 685600434
64819 100589 468264811 669713633
21538 42057 208086343 266212316
144623 154696 891658106 589370999
187481 49088 462695361 664697185
172258 8653 138424940 735985051
42828 173282 910919433 804041217
187820 48021 69765115 86631456
1...

output:

90571973135125

result:

ok single line: '90571973135125'

Test #56:

score: 0
Accepted
time: 308ms
memory: 46636kb

input:

200000
1668 46162 335237 921785
113769 127901 853451705 934150953
1626 35497 533058 791354
111597 54552 186865 35999
126603 83723 570650 215845
130809 113769 533240830 792980919
109646 143446 640055 759014
81148 77400 102642 184563
170617 167437 530479 964975
13500 177003 968531 702011
116634 165372...

output:

11052402240814

result:

ok single line: '11052402240814'

Test #57:

score: 0
Accepted
time: 284ms
memory: 45516kb

input:

200000
169530 195889 230163362 439799818
119233 134720 559035500 953508831
8940 134720 884441063 243088533
134720 69148 680467824 593559555
134720 29050 577681718 589369589
35824 166656 841766082 244727568
134720 198916 67469622 39769615
193336 149614 866808245 894158218
192941 134720 258122702 9382...

output:

40626528262020

result:

ok single line: '40626528262020'

Test #58:

score: 0
Accepted
time: 371ms
memory: 64736kb

input:

200000
110455 115168 942917483 944057356
24250 174224 120443609 532352510
11171 74665 190086664 829576737
159411 147194 706659415 940447640
21273 60049 121436594 924345007
199052 198780 576499335 914436406
80048 25499 994151154 181108553
21097 69194 919349404 246872582
69845 47327 610809487 71576289...

output:

29337562026797

result:

ok single line: '29337562026797'

Test #59:

score: 0
Accepted
time: 281ms
memory: 47496kb

input:

200000
103057 108208 924190969 473823292
103057 183266 908503598 913830751
160109 103057 152232631 446122875
150542 103057 645333429 20388717
9111 103057 958697887 339808805
186911 103057 832784802 864166960
103057 107162 110079035 799843025
103057 41684 472282933 46971465
120852 103057 515888934 87...

output:

68177387813969

result:

ok single line: '68177387813969'

Subtask #6:

score: 0
Skipped

Dependency #1:

0%