QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#605685 | #6662. 기지 간소화 | Matutino | 100 ✓ | 1320ms | 75764kb | C++17 | 2.0kb | 2024-10-02 18:35:36 | 2024-10-02 18:35:37 |
Judging History
answer
#include<bits/stdc++.h>
#define reg register
// #define int long long
const int N=3e5+10,mod=1e9+7;
int n,ans,sz[N],son[N],fw[N],S;
std::vector<std::pair<int,int>> G[N];
struct Node{std::pair<int,int> L,R; int ans,len;}t[N<<2];
inline Node operator+(reg Node A,reg Node B){
reg Node res; res={A.L,B.R,(A.ans+B.ans)%mod,res.len=A.len+B.len};
auto [x1,y1]=A.R; auto [x2,y2]=B.L;
if (x1==x2) res.ans=(res.ans+(1ll*(y1+y2)*(y1+y2+1)>>1)-(1ll*y1*(y1+1)>>1)-(1ll*y2*(y2+1)>>1))%mod;
if (A.L.second==A.len&&A.L.first==B.L.first) res.L.second=A.len+B.L.second;
if (B.R.second==B.len&&B.R.first==A.R.first) res.R.second=B.len+A.R.second;
return res;
}
void modify(reg int o,reg int l,reg int r,reg int x,reg int k){
if (l==r) return t[o]={{k,1},{k,1},1,1},void(); reg int mid=l+r>>1;
x<=mid?modify(o<<1,l,mid,x,k):modify(o<<1|1,mid+1,r,x,k); t[o]=t[o<<1]+t[o<<1|1];
}
void build(reg int o,reg int l,reg int r){
if (l==r) return t[o]={{0,1},{0,1},1,1},void(); reg int mid=l+r>>1;
build(o<<1,l,mid),build(o<<1|1,mid+1,r); t[o]=t[o<<1]+t[o<<1|1];
}
int tp,stk[N];
void Dfs(reg int u,reg int fa=0){
// std::cerr<<u<<"\n";
reg int L=tp;
for (auto [v,w]:G[u]) if (v!=fa&&v!=son[u]){
reg int lst=tp;
Dfs(v,u),ans=(ans+1ll*fw[v]*(S+mod-t[1].ans))%mod;
for (reg int i=lst+1;i<=tp;i++) modify(1,1,n,stk[i],0);
}
reg int R=tp;
if (son[u]) Dfs(son[u],u),ans=(ans+1ll*fw[son[u]]*(S+mod-t[1].ans))%mod;
for (reg int i=L+1;i<=R;i++) modify(1,1,n,stk[i],1);
stk[++tp]=u,modify(1,1,n,u,1);
}
void dfs(reg int u,reg int fa=0){
sz[u]=1;
for (auto [v,w]:G[u]) if (v^fa) fw[v]=w,dfs(v,u),sz[u]+=sz[v],sz[son[u]]<sz[v]?son[u]=v:0;
}
inline void add(reg int u,reg int v,reg int w){G[u].push_back({v,w}),G[v].push_back({u,w});}
int maintenance_costs_sum(std::vector<int> U, std::vector<int> V, std::vector<int> W) {
n=U.size()+1,S=1ll*n*(n+1)/2%mod;
for (reg int i=0;i<n-1;i++) add(U[i]+1,V[i]+1,W[i]);
build(1,1,n),dfs(1);
// for (reg int i=1;i<=n;i++) std::cerr<<i<<" "<<son[i]<<"\n";
Dfs(1);
return ans;
}
詳細信息
Subtask #1:
score: 5
Accepted
Test #1:
score: 5
Accepted
time: 2ms
memory: 41024kb
input:
2 1 0 1
output:
1
result:
ok single line: '1'
Test #2:
score: 5
Accepted
time: 3ms
memory: 42780kb
input:
299 72 263 662908099 170 230 583287081 181 87 461245480 117 116 41098264 282 218 300936390 238 128 561969086 175 105 305200697 152 28 927649982 211 58 290232523 233 188 304617152 246 74 61325892 283 120 724838352 207 94 123021801 138 241 893659708 171 283 82846115 104 250 142703714 111 63 547249068 ...
output:
93964028
result:
ok single line: '93964028'
Test #3:
score: 5
Accepted
time: 0ms
memory: 42824kb
input:
300 116 249 999999948 23 182 999999956 174 147 999999978 21 178 999999981 138 238 999999941 215 6 999999955 190 256 999999990 107 203 999999992 142 221 999999943 129 236 999999957 55 154 999999992 183 35 999999979 200 284 999999958 36 222 999999988 88 62 999999960 219 222 999999950 95 38 999999960 2...
output:
534442086
result:
ok single line: '534442086'
Test #4:
score: 5
Accepted
time: 4ms
memory: 40608kb
input:
5 0 2 2 2 1 3 2 4 6 0 3 5
output:
98
result:
ok single line: '98'
Test #5:
score: 5
Accepted
time: 3ms
memory: 42656kb
input:
10 1 5 1 6 2 10 8 1 3 3 9 1 8 0 10 2 3 6 7 0 5 2 4 7 4 7 3
output:
1625
result:
ok single line: '1625'
Test #6:
score: 5
Accepted
time: 3ms
memory: 39264kb
input:
10 2 5 242840396 4 7 425058513 7 9 975802175 7 1 647540462 3 7 239781206 2 0 873867121 4 0 132645393 6 4 862552539 0 8 542726039
output:
711424766
result:
ok single line: '711424766'
Test #7:
score: 5
Accepted
time: 4ms
memory: 40676kb
input:
299 107 270 74 187 221 79 142 129 40 77 272 27 94 152 1 117 171 74 64 79 87 263 36 91 257 176 1 183 191 82 109 67 23 91 90 30 116 228 76 276 152 15 59 165 40 160 235 71 235 116 82 102 44 88 130 289 72 241 150 14 62 176 23 277 50 83 206 38 11 66 250 72 84 120 66 137 259 54 46 287 82 209 263 57 151 24...
output:
399821685
result:
ok single line: '399821685'
Test #8:
score: 5
Accepted
time: 0ms
memory: 43020kb
input:
300 111 245 844422933 103 173 980761620 210 18 509066965 36 51 134507716 264 28 523343821 249 88 748193505 30 46 832843261 286 33 489900279 125 288 575144383 106 87 191375234 259 126 882094013 10 57 842095866 73 65 254207339 175 280 353530327 21 145 883665290 130 110 818300025 137 48 259121083 0 102...
output:
156555229
result:
ok single line: '156555229'
Test #9:
score: 5
Accepted
time: 2ms
memory: 40764kb
input:
292 37 89 397871374 184 205 437399619 14 234 93902029 40 155 84065200 12 60 367994608 143 35 623301168 125 0 307800516 68 281 653696611 146 260 978361615 177 79 385187016 251 192 369734594 245 159 471356654 109 53 96376804 248 103 681417305 85 288 837771859 25 110 145156090 129 46 874442695 252 249 ...
output:
702681209
result:
ok single line: '702681209'
Test #10:
score: 5
Accepted
time: 4ms
memory: 41796kb
input:
285 93 162 959772147 32 172 751202610 173 257 284177666 199 112 94146918 80 117 514639361 245 265 282507802 135 109 829039102 53 38 832201899 166 245 984506327 247 224 843352696 4 98 415992963 189 33 989751728 117 153 801360684 106 213 848238622 119 77 300949830 177 29 951903134 110 27 991808126 102...
output:
281677588
result:
ok single line: '281677588'
Test #11:
score: 5
Accepted
time: 0ms
memory: 42720kb
input:
300 238 117 820410457 230 235 506467445 200 74 653603782 62 76 485420791 105 275 392365065 20 121 28250604 203 87 723682049 109 151 342880635 133 79 302983289 47 297 671031835 257 299 444969934 255 116 860542983 91 92 332672418 205 280 290258390 103 160 769766288 106 137 789215359 159 204 831106721 ...
output:
144479203
result:
ok single line: '144479203'
Test #12:
score: 5
Accepted
time: 3ms
memory: 42752kb
input:
298 157 32 579243060 277 30 236601044 95 45 746850490 123 94 873131928 185 95 376156675 66 150 606904039 262 124 953899592 219 279 373193513 152 99 546195756 113 100 936194271 216 240 22619249 38 110 395200927 89 55 159263634 265 77 151240149 90 232 529211969 88 177 115952104 43 208 657967542 196 45...
output:
75917669
result:
ok single line: '75917669'
Test #13:
score: 5
Accepted
time: 8ms
memory: 39320kb
input:
300 86 72 35281851 86 65 772642113 86 85 267144561 68 86 237759697 225 86 275794715 188 86 708990293 86 224 212292280 61 86 139649599 141 86 852035124 131 86 522883805 62 86 374119946 86 107 661877081 218 86 365176681 14 86 676939669 86 254 678988772 86 189 741173114 86 175 101646645 86 10 776575255...
output:
970519677
result:
ok single line: '970519677'
Test #14:
score: 5
Accepted
time: 0ms
memory: 43028kb
input:
296 167 280 308339229 42 120 44980047 172 173 31087131 280 172 346584469 68 172 765593132 172 11 55592625 172 60 294200085 172 177 829489003 172 26 368114672 172 6 906646562 239 172 311081319 199 172 89488635 264 172 782569720 172 53 614220967 172 192 111994073 70 172 348033132 172 37 5375089 10 108...
output:
685676493
result:
ok single line: '685676493'
Test #15:
score: 5
Accepted
time: 0ms
memory: 39132kb
input:
299 219 189 428591428 214 280 645468138 239 124 44092787 278 109 973174819 229 28 708387042 118 105 231265201 106 23 115324206 127 163 182711436 61 68 171248721 67 218 585337538 198 30 576082156 147 49 179613791 109 244 356639356 122 205 714546250 179 207 831521336 292 188 754667151 91 55 962847082 ...
output:
442304238
result:
ok single line: '442304238'
Test #16:
score: 5
Accepted
time: 3ms
memory: 42756kb
input:
300 72 138 240810351 80 111 534427405 105 137 731389559 86 95 740641088 86 126 67440531 151 147 975723723 84 98 889126297 60 37 235430076 98 236 462897489 183 146 446541268 42 135 730090491 92 259 6083997 189 161 972025910 3 29 546634976 53 270 249844443 28 122 103308828 105 275 560940747 121 124 94...
output:
51045998
result:
ok single line: '51045998'
Test #17:
score: 5
Accepted
time: 0ms
memory: 39144kb
input:
298 15 284 446739499 274 218 9244552 64 69 913186698 79 63 70124148 253 46 192851114 165 30 798777080 30 123 824050137 199 104 363328962 23 70 471441 170 54 206153629 18 49 203147626 83 136 841021519 158 184 342247212 72 139 144579819 237 6 976320498 235 224 141859373 169 39 844270142 231 273 615291...
output:
874031476
result:
ok single line: '874031476'
Test #18:
score: 5
Accepted
time: 4ms
memory: 42736kb
input:
300 211 34 999999974 255 27 999999997 50 98 999999974 16 21 999999946 207 243 999999999 39 64 999999983 279 79 999999975 95 248 999999960 69 276 999999977 94 6 999999960 137 281 999999969 127 49 999999945 122 72 999999958 124 63 999999991 125 52 999999963 152 92 999999994 26 120 999999989 29 275 999...
output:
558463020
result:
ok single line: '558463020'
Subtask #2:
score: 6
Accepted
Dependency #1:
100%
Accepted
Test #19:
score: 6
Accepted
time: 5ms
memory: 43176kb
input:
3987 1834 2601 895910969 1701 1884 820508615 3406 1155 439833658 2977 3131 370614789 617 2254 829077229 1648 1576 977756493 597 2928 624126121 1165 3147 11258087 3888 2644 341340941 3007 2676 281856885 3971 957 644422867 3791 1181 166275464 3089 2273 36236019 1918 1080 747406617 3032 2602 102478217 ...
output:
695949490
result:
ok single line: '695949490'
Test #20:
score: 6
Accepted
time: 6ms
memory: 39696kb
input:
3996 2787 2080 999999558 3557 3990 999999513 1092 476 999999510 3925 539 999999701 2334 2431 999999969 895 152 999999232 219 3637 999999392 2547 2072 999999641 356 3936 999999660 741 3794 999999597 554 1962 999999246 1562 847 999999437 2515 3167 999999541 1793 2493 999999388 2723 1175 999999976 2394...
output:
274545286
result:
ok single line: '274545286'
Test #21:
score: 6
Accepted
time: 12ms
memory: 41952kb
input:
3929 2164 3410 1 1115 3069 1 313 571 1 1913 135 1 739 3902 1 3735 1024 1 1888 2039 1 2732 2069 1 276 3073 1 3568 1533 1 2550 3456 1 1519 3224 1 3692 463 1 3013 2755 1 104 2875 1 2838 926 1 1755 880 1 1263 1285 1 2823 492 1 2920 2177 1 3369 1547 1 527 1876 1 416 3588 1 2985 3903 1 3566 454 1 3438 244...
output:
130042608
result:
ok single line: '130042608'
Test #22:
score: 6
Accepted
time: 4ms
memory: 41320kb
input:
3979 1701 2739 947 550 1740 148 698 3394 439 998 1930 516 2860 789 927 3189 1474 727 708 525 93 3380 2998 356 1170 3170 161 3273 441 367 2735 912 327 3676 1798 652 2147 2986 902 374 1300 176 1209 2051 994 2466 2554 652 2952 1243 582 1283 3491 396 3230 3169 323 1357 2960 963 2061 2863 486 374 1551 74...
output:
477691640
result:
ok single line: '477691640'
Test #23:
score: 6
Accepted
time: 9ms
memory: 41828kb
input:
3993 129 1932 486250 3451 3517 971847 1040 2697 612116 2857 2720 474764 2266 1736 25882 608 1032 505927 885 2105 392299 1919 2570 296078 897 799 762212 3365 2413 202700 1016 356 738055 1782 1920 347257 3411 1463 42033 1517 3437 239957 2215 2285 472713 2088 2204 397307 64 1841 65633 2112 2683 695743 ...
output:
260910030
result:
ok single line: '260910030'
Test #24:
score: 6
Accepted
time: 4ms
memory: 41088kb
input:
4000 102 66 280319606 889 2757 123671658 573 410 214275598 1812 1239 562948670 3870 2162 811676687 3666 3927 782714296 743 1959 698091997 3631 1350 693401332 1711 3285 823728351 3648 67 738528891 2207 210 876427103 3115 2668 374409224 3736 1282 355828430 255 1050 984348990 1204 1133 399430224 1924 1...
output:
320372497
result:
ok single line: '320372497'
Test #25:
score: 6
Accepted
time: 8ms
memory: 41548kb
input:
3999 2915 2669 358447038 3538 1529 848338205 1238 1652 883628661 2570 2404 223452927 799 3024 713067679 3364 1135 944572237 1115 1024 910103338 3191 2454 774565382 1908 486 217064756 2637 1209 971634195 1318 634 448430962 1541 1145 290974969 802 2090 33398467 2463 2097 270639399 131 1103 813548390 9...
output:
291075730
result:
ok single line: '291075730'
Test #26:
score: 6
Accepted
time: 4ms
memory: 41716kb
input:
3991 3043 3747 72450807 1035 2439 847359979 992 3356 367969130 2460 2892 203363882 1910 3198 819770022 552 2675 346346980 2432 2936 540637143 190 2609 410257275 2453 3575 355529268 3880 240 12331157 3785 3424 117046626 308 3405 307714020 1833 1500 713642516 2163 3286 125103861 2959 3314 131450008 16...
output:
383646236
result:
ok single line: '383646236'
Test #27:
score: 6
Accepted
time: 4ms
memory: 39796kb
input:
3992 3278 133 82819135 1138 1628 883942927 1518 1562 287462306 3906 2285 844307305 1123 3665 401186676 3421 2844 717868422 3912 2599 449585462 1058 204 196625144 2303 3869 74773481 3479 100 566381291 2638 3113 454696105 2492 2568 324166296 458 1181 267475836 2144 735 853935672 2661 1297 546999171 84...
output:
41229967
result:
ok single line: '41229967'
Test #28:
score: 6
Accepted
time: 0ms
memory: 41456kb
input:
3988 892 3476 65536289 1143 2155 78839637 2281 3630 277410807 945 2594 77206150 2323 1428 493894594 2462 190 55532886 3692 3325 33104595 1172 3873 760727613 314 1369 239234837 3747 3958 475742505 546 452 197939417 2821 2508 957723778 3234 3065 101320967 3010 2914 19947142 985 959 567195224 2766 1066...
output:
855099036
result:
ok single line: '855099036'
Test #29:
score: 6
Accepted
time: 0ms
memory: 43580kb
input:
3994 2898 1643 747208501 2589 2491 449233552 1952 108 167973884 809 516 700981441 2928 1529 486022338 996 3324 91061838 195 3011 976655798 2835 2673 861780462 255 1432 112332747 454 3339 275103950 3446 2406 525262110 698 2274 21319511 1906 2757 242526935 2008 3900 78216819 1939 3454 55978905 1478 47...
output:
926381062
result:
ok single line: '926381062'
Test #30:
score: 6
Accepted
time: 12ms
memory: 40944kb
input:
3999 3472 781 632697752 3913 3472 745809874 1012 3472 486404015 3472 1596 224135418 3472 391 174124536 2633 3472 668535346 3472 3820 309058783 3472 2891 828286963 3472 3137 207500886 3827 3472 55431764 3472 3426 830682140 3472 30 17107264 2734 3472 472803946 3472 1632 745035389 3472 1403 940800825 3...
output:
507959495
result:
ok single line: '507959495'
Test #31:
score: 6
Accepted
time: 3ms
memory: 39448kb
input:
4000 174 2644 47696590 169 2644 58166462 956 2644 460771360 2644 1815 520855324 3501 2644 986792612 1093 2644 506436717 966 2644 738217798 900 2644 925731103 2644 3182 714219046 2448 1924 763935310 2644 782 834386632 2516 2644 120793747 2644 1931 124334474 2644 2152 579180059 2644 2521 623628522 164...
output:
433113345
result:
ok single line: '433113345'
Test #32:
score: 6
Accepted
time: 3ms
memory: 43272kb
input:
3991 1764 2443 439882798 426 3349 992175122 2547 235 940448392 3812 2967 72708965 3066 3137 686248279 1981 112 936946216 3045 2145 956855424 3312 649 533586589 2188 2462 64477706 3422 1113 95138241 2078 3202 127346842 901 2425 482329548 3535 2014 303899910 2730 1390 831016026 2128 1974 105603514 17 ...
output:
134545619
result:
ok single line: '134545619'
Test #33:
score: 6
Accepted
time: 7ms
memory: 39308kb
input:
3989 583 3061 706872124 3869 629 162035787 1917 2195 400147505 115 541 844975714 3513 2008 667322023 1355 2871 481525925 1807 2969 702729114 900 2818 55373170 1638 2513 294382411 2375 3093 485828042 1605 507 778393073 3304 3618 865154341 3053 2947 676091124 2773 2732 941702348 1365 3111 167647093 17...
output:
277990633
result:
ok single line: '277990633'
Test #34:
score: 6
Accepted
time: 4ms
memory: 43096kb
input:
4000 1300 3993 2591399 3255 1495 614218131 24 3304 493255228 1569 2170 381311184 3026 3582 712596783 1738 3970 293387004 3384 781 361133661 2795 2371 93547297 58 698 879035234 573 2317 31056223 2188 3953 11876411 2899 3835 395815431 1436 1529 317267294 2116 2218 285301158 1012 1141 909178003 2762 20...
output:
794389140
result:
ok single line: '794389140'
Test #35:
score: 6
Accepted
time: 4ms
memory: 43008kb
input:
3996 2148 549 999999448 3741 562 999999858 3245 255 999999581 3611 762 999999421 1088 36 999999288 65 38 999999563 567 93 999999882 3413 841 999999485 3745 1149 999999267 3707 3415 999999905 2468 974 999999999 2085 2633 999999998 3339 1978 999999753 805 1857 999999996 3088 542 999999810 2596 3051 99...
output:
390647746
result:
ok single line: '390647746'
Subtask #3:
score: 10
Accepted
Test #36:
score: 10
Accepted
time: 578ms
memory: 57824kb
input:
249494 137621 137622 1 198127 198128 1 117358 117359 1 155777 155778 1 112742 112743 1 235668 235669 1 20632 20622 1 41333 41334 1 170699 170692 1 130269 130268 1 137208 137207 1 37791 37767 1 130187 130178 1 89795 89817 1 91408 91359 1 243301 243574 1 22017 22018 1 116466 116467 1 160094 160095 1 4...
output:
714152529
result:
ok single line: '714152529'
Test #37:
score: 10
Accepted
time: 583ms
memory: 57768kb
input:
249988 60491 60489 6472 121939 121913 6308 173388 173387 8137 226065 226066 8977 124350 124349 2792 112200 112199 428 125721 125743 5363 23768 23767 75 153585 153587 2454 17575 17576 5720 94114 94113 9201 42276 42275 6155 76932 76933 8614 159668 159667 6494 146337 146336 9800 141314 141315 4256 1985...
output:
540610742
result:
ok single line: '540610742'
Test #38:
score: 10
Accepted
time: 612ms
memory: 57864kb
input:
249949 110548 110549 662920624 134621 134620 922164993 29294 29349 82667705 63017 63018 181551959 141206 141207 58318778 219568 219569 243357791 228521 228523 273934957 110836 110835 422662545 81151 81169 946526999 142445 142444 137916420 105444 105443 281588867 92357 92356 245508044 10069 10068 879...
output:
344332803
result:
ok single line: '344332803'
Test #39:
score: 10
Accepted
time: 1064ms
memory: 59076kb
input:
245678 89757 89756 155391811 170243 170242 678414126 230026 230030 881876642 72714 72716 693782528 208267 208263 22136390 94867 94869 389177464 240642 240646 216439003 28244 28242 14195051 65285 65413 861566882 16224 16225 369352941 21937 21938 169150963 27334 27335 720935259 100896 100888 296530390...
output:
373360444
result:
ok single line: '373360444'
Test #40:
score: 10
Accepted
time: 273ms
memory: 56452kb
input:
249995 141471 141470 327048559 116145 116146 897388635 206969 206970 128664534 28759 28758 749729131 116328 116329 844162253 149258 149259 172817659 246856 246855 395943027 229241 229240 905934497 182913 182914 309665867 197036 197037 763849183 109941 109940 564771913 73129 73130 656099408 235626 23...
output:
752780497
result:
ok single line: '752780497'
Test #41:
score: 10
Accepted
time: 287ms
memory: 60048kb
input:
250000 134845 134846 466565529 185450 185449 817520917 215521 215520 776852811 144179 144178 316640634 215626 215627 53470755 100510 100511 715821258 43409 43410 830532323 49985 49984 135348988 44590 44589 765958567 184749 184750 866713888 131829 131828 720469562 84089 84090 68621499 138594 138593 6...
output:
870408073
result:
ok single line: '870408073'
Test #42:
score: 10
Accepted
time: 150ms
memory: 75236kb
input:
247895 238221 238222 248435190 72156 72157 551450278 207548 207549 399290807 90677 90676 677564034 161394 161393 5341818 69124 69123 742813393 221917 221916 26840154 236030 236031 946632037 130189 130190 671433126 41839 41840 516043271 222569 222568 817877821 222039 222038 463686875 169604 169603 49...
output:
419043868
result:
ok single line: '419043868'
Test #43:
score: 10
Accepted
time: 317ms
memory: 57960kb
input:
249999 1 45467 619603438 32391 1 524153120 90889 1 910241054 1 84612 194802279 111529 1 643175211 82950 1 941614263 1 165282 952432099 1 132642 729915764 226149 1 442323939 56566 1 514838027 1 31453 555549857 94539 1 326339705 1 185482 299208738 122426 1 222981519 1 87019 684073539 1 169760 93568646...
output:
720055738
result:
ok single line: '720055738'
Test #44:
score: 10
Accepted
time: 228ms
memory: 62748kb
input:
250000 208733 208734 9036857 172597 172596 543284398 177250 177249 487597922 144876 144875 965898025 142223 142222 137193288 228091 228092 760755548 240480 240481 588087353 42084 42085 828924723 142981 142980 392874807 79112 79113 729389895 67150 67149 492799568 211021 211022 617810690 239916 239915...
output:
875124277
result:
ok single line: '875124277'
Test #45:
score: 10
Accepted
time: 544ms
memory: 57952kb
input:
249876 11372 11373 421585794 161635 161634 844343671 57835 57837 664077792 198834 198833 400144251 84977 84979 229306352 4245 4246 32092880 33107 33108 369644322 96051 96052 382527446 139317 139316 233617537 107853 107854 57141382 226859 226858 186107729 130675 130676 373854872 200987 200988 4749065...
output:
220645957
result:
ok single line: '220645957'
Test #46:
score: 10
Accepted
time: 234ms
memory: 67064kb
input:
249494 7470 7471 519800108 208665 248383 748077390 117835 117836 650832209 52980 52979 127522075 150122 150119 208102371 118419 166013 738043718 16671 16672 706726275 223564 223565 438613462 181446 72271 130486064 228457 228455 986171214 13219 200864 909519520 180816 74228 589716372 166614 116734 48...
output:
951832631
result:
ok single line: '951832631'
Test #47:
score: 10
Accepted
time: 297ms
memory: 58940kb
input:
247890 161984 161598 851663633 106797 106792 597835198 200878 121434 103468576 201205 121132 129023395 74629 245553 761200345 73556 246607 489075625 31344 42557 128806247 17167 56925 445177692 129509 192315 725988466 4876 4895 528747953 144036 177861 810185771 128020 128042 502069966 24375 49152 946...
output:
514060017
result:
ok single line: '514060017'
Subtask #4:
score: 26
Accepted
Test #48:
score: 26
Accepted
time: 248ms
memory: 73676kb
input:
249876 133760 107716 545485826 57898 35556 542825636 159559 78814 588304799 9037 105623 735470824 242676 240955 258616989 58653 143501 194781066 36591 97835 699376285 95049 123298 35300031 91751 203920 865003045 53908 18382 376452723 211462 200538 638209824 48693 89388 132147210 238496 151742 322726...
output:
497361697
result:
ok single line: '497361697'
Test #49:
score: 26
Accepted
time: 280ms
memory: 69332kb
input:
249898 30821 89222 216312158 187500 216600 82182821 178583 92149 738550090 20272 67983 201443365 226166 240997 607575228 21824 103898 173056789 124183 84399 125781413 109415 8162 284766496 148772 50384 554947241 79841 186471 143709856 226554 90303 941506662 134802 110426 45957568 134303 220206 18126...
output:
138702489
result:
ok single line: '138702489'
Test #50:
score: 26
Accepted
time: 219ms
memory: 75764kb
input:
249998 110276 109142 706213006 187871 199516 570804389 68462 115495 637877974 87896 74943 423361328 9505 22272 367332332 77495 207078 93762892 168372 200382 573428926 63400 178179 55167257 2213 81451 371317017 237440 166953 522478816 185903 201723 421328628 113439 4162 443967468 210960 53857 1915475...
output:
581860656
result:
ok single line: '581860656'
Test #51:
score: 26
Accepted
time: 281ms
memory: 68364kb
input:
250000 148767 113484 723604481 190960 146379 812221719 206193 104064 624630673 19741 205518 787245322 164790 146521 4760497 113038 8924 439499812 73720 22367 371947607 149669 142309 108304525 172139 74613 440300363 186472 208693 527620165 104374 30757 131621613 156953 91941 967850470 208965 233964 1...
output:
320333169
result:
ok single line: '320333169'
Test #52:
score: 26
Accepted
time: 278ms
memory: 69672kb
input:
249996 227802 129318 999996258 12 105314 999970484 188686 202946 999957721 215589 210404 999978434 33539 72816 999957659 188872 42051 999953060 146117 167627 999982950 5418 200918 999952067 102337 234452 999971433 40997 33932 999995916 172892 179004 999989959 191930 115340 999970471 184223 204953 99...
output:
643670145
result:
ok single line: '643670145'
Subtask #5:
score: 53
Accepted
Dependency #1:
100%
Accepted
Dependency #2:
100%
Accepted
Dependency #3:
100%
Accepted
Dependency #4:
100%
Accepted
Test #53:
score: 53
Accepted
time: 702ms
memory: 57756kb
input:
250000 148932 96833 1 157942 46517 1 36868 153235 1 182941 16660 1 55139 142077 1 51121 229141 1 41652 27495 1 201436 198356 1 4738 152473 1 85147 170373 1 85658 25238 1 174915 180550 1 191960 45186 1 180804 47228 1 154153 11394 1 208610 223209 1 14412 178226 1 142384 138649 1 210345 148230 1 180 46...
output:
717991550
result:
ok single line: '717991550'
Test #54:
score: 53
Accepted
time: 711ms
memory: 57768kb
input:
249494 112219 248162 686 107029 46563 971 6452 7844 127 95570 236363 921 220576 167219 907 92157 232380 795 117404 244068 575 76504 71006 738 19890 1350 966 242144 136130 613 181071 206246 297 225206 132843 847 71239 17306 730 183447 85819 77 161777 3818 253 49052 39617 611 32480 193391 441 64446 19...
output:
221799412
result:
ok single line: '221799412'
Test #55:
score: 53
Accepted
time: 689ms
memory: 56668kb
input:
234234 194686 70300 85468 110647 160612 808752 59754 8114 315663 113629 167723 332500 228816 119617 325635 125098 171866 984882 38360 222261 739032 80873 181368 255666 187998 206457 273861 65543 228253 43694 164974 104617 570985 94362 49714 711490 201569 140248 627305 24295 210605 349143 170015 1584...
output:
716897551
result:
ok single line: '716897551'
Test #56:
score: 53
Accepted
time: 707ms
memory: 57572kb
input:
244888 12629 132037 258012419 115176 74595 935084513 8997 97643 25447794 211066 94889 197977659 61449 6862 318675706 4790 37937 308450928 17354 129355 769043814 196062 55200 205095816 179603 183623 156634362 123868 41747 917422807 199273 29029 697959990 192427 2967 409317721 98643 4079 631836634 105...
output:
907418145
result:
ok single line: '907418145'
Test #57:
score: 53
Accepted
time: 1320ms
memory: 59152kb
input:
249999 156371 170215 888098413 112983 87427 40452269 242578 214856 970395868 224631 114096 651854304 149570 129915 948520339 103154 184848 183569553 91127 128311 109510199 209765 72040 348310199 131359 45696 779504374 8499 159035 898297579 93167 49777 810700763 173718 111140 889351818 27855 199908 2...
output:
267235703
result:
ok single line: '267235703'
Test #58:
score: 53
Accepted
time: 1303ms
memory: 59084kb
input:
249998 66912 223624 418255735 46339 125363 232004892 249068 70915 749406318 164187 31018 155716457 151283 190489 623493396 6185 207538 597897110 58736 156789 749121713 142954 163846 340019812 34131 111239 429161828 189327 4929 513092461 14625 13225 927646973 139627 71816 651410692 18124 182435 36483...
output:
393103475
result:
ok single line: '393103475'
Test #59:
score: 53
Accepted
time: 431ms
memory: 56808kb
input:
250000 148893 209088 809015169 103088 212980 757728195 119592 230515 198091154 136742 209926 347703275 233253 236079 856779815 124574 189765 229283496 110637 130181 405716376 78638 18233 258432152 130463 249794 452931115 41446 83077 87312652 52649 101215 701186789 134217 146388 605184247 53847 18966...
output:
494292891
result:
ok single line: '494292891'
Test #60:
score: 53
Accepted
time: 591ms
memory: 56744kb
input:
249987 206342 178958 706410783 245824 100301 323321966 19023 234287 649178265 242477 65408 51289673 82075 157846 729272155 96146 154343 703761625 374 18095 971961013 212617 207054 746755433 121269 234149 901496895 238677 171425 548759757 188662 156011 269614122 193494 239670 964619625 202214 36024 5...
output:
119350537
result:
ok single line: '119350537'
Test #61:
score: 53
Accepted
time: 331ms
memory: 64256kb
input:
249989 51319 152112 374132608 185017 3727 71308511 55016 78197 146611902 35816 21676 34700125 189337 97122 419028397 176556 162063 806098683 126559 13911 157457986 189502 147305 779946071 92309 104771 701418324 201791 14777 534149969 40171 224899 871324767 161847 141328 389703677 102772 145314 70240...
output:
253952978
result:
ok single line: '253952978'
Test #62:
score: 53
Accepted
time: 231ms
memory: 75348kb
input:
250000 243937 39091 785537294 229456 180824 332525584 215871 226231 782388936 141247 166073 855615228 888 2386 628615054 112944 42705 334878116 72165 2652 835594702 78346 13172 959707876 195668 131419 737866763 55209 246463 115907164 102150 112534 192634378 230741 210235 743010457 158066 214059 6027...
output:
114815276
result:
ok single line: '114815276'
Test #63:
score: 53
Accepted
time: 315ms
memory: 57840kb
input:
249899 129586 228200 10488622 129586 131117 130269107 142696 237288 312176271 34798 129586 356948073 129586 115575 338361549 129586 47611 394530488 241716 30449 204104461 244112 129586 530267991 129586 5583 582350008 25343 129586 137687987 44645 129586 822794020 246094 129586 89506162 129586 18689 3...
output:
488867247
result:
ok single line: '488867247'
Test #64:
score: 53
Accepted
time: 312ms
memory: 64252kb
input:
249966 195637 126259 928553841 10390 3977 633851020 155121 203831 531154793 201538 194275 364039295 5503 76850 604474934 16123 198946 206395844 247642 65292 321660948 6070 10611 204523621 141959 232038 930387126 8640 78670 553547881 182770 59977 487831183 88886 45036 946748039 105566 217531 40409168...
output:
865013340
result:
ok single line: '865013340'
Test #65:
score: 53
Accepted
time: 305ms
memory: 70380kb
input:
250000 99630 132489 665338977 82010 50765 141685126 80585 76160 243756417 126418 3012 391263001 50383 107636 833139490 152466 99792 884884495 87650 63962 285423724 186771 180538 307795197 94674 100518 813919106 156519 119552 468548752 204149 225853 437824055 246570 174704 532476972 114099 138090 640...
output:
348697106
result:
ok single line: '348697106'
Test #66:
score: 53
Accepted
time: 304ms
memory: 65600kb
input:
249987 115631 632 466533575 126455 57545 202572155 197284 153273 434928057 64570 113323 228324202 167099 219333 465650190 113645 152990 784134194 54855 208403 497264423 89231 120103 189947848 197081 231419 388740670 162465 141346 686606828 176903 24592 750173036 130069 35600 719848304 51300 41270 75...
output:
589958837
result:
ok single line: '589958837'
Test #67:
score: 53
Accepted
time: 352ms
memory: 57632kb
input:
249898 218754 99203 816736850 141080 207883 94414474 161685 12700 405562924 126748 188321 550144705 3650 225673 129852622 44666 65642 844947773 171833 190553 455901507 61089 220160 799153741 21438 236327 296520897 113811 207653 578981285 212355 49155 768724343 17590 238625 711008609 184189 101802 78...
output:
655453194
result:
ok single line: '655453194'
Test #68:
score: 53
Accepted
time: 271ms
memory: 70924kb
input:
250000 127086 39550 874158454 37747 190119 770610416 140119 125228 340662940 169243 36135 617022555 116653 26937 160118527 23298 10654 626637698 189281 180668 981797943 124140 199044 241594477 220235 77626 896936446 43703 150643 362878115 196520 95062 87867237 219469 142274 654724739 6633 120768 958...
output:
418481366
result:
ok single line: '418481366'
Test #69:
score: 53
Accepted
time: 675ms
memory: 57656kb
input:
250000 15874 221117 299746950 183454 233217 228105795 217607 53197 467275534 1131 237035 295532014 66464 181509 236341521 35845 58377 724662612 74356 136958 993331061 167725 21851 251999721 90358 201070 207819031 106656 95581 817768329 128190 97647 747079770 218178 247617 971849146 150212 60029 7462...
output:
698830093
result:
ok single line: '698830093'
Test #70:
score: 53
Accepted
time: 394ms
memory: 63052kb
input:
250000 70634 248197 37333811 204051 93265 979357434 41382 242060 894619469 169671 171066 738132114 175377 161026 859941471 136984 36860 511774428 228232 189616 903602520 153837 59905 428529835 245538 110612 652855087 214971 46082 525174862 199522 176211 530661714 153038 167483 689158079 42595 80273 ...
output:
790225437
result:
ok single line: '790225437'
Test #71:
score: 53
Accepted
time: 334ms
memory: 68004kb
input:
249998 52784 10325 17188916 21895 209744 131845018 27615 110201 393171209 212966 34176 478655394 198447 100632 969796458 125466 74292 278671845 47403 238062 89798394 239596 108518 713197167 14014 131954 91208356 158566 197755 815291761 211138 180554 188601967 98644 36979 764643281 136113 63980 69811...
output:
903580761
result:
ok single line: '903580761'
Test #72:
score: 53
Accepted
time: 273ms
memory: 69484kb
input:
249898 91216 215056 532309897 144201 148348 955839612 17578 232456 281453973 40057 132653 757068102 63261 106183 523370343 3455 45914 19644136 92185 182128 634623024 131985 86305 152081258 154850 225498 4312175 178023 52971 518416243 162072 17913 248867262 97523 165017 605764832 45987 93497 82646150...
output:
508368597
result:
ok single line: '508368597'
Test #73:
score: 53
Accepted
time: 346ms
memory: 62200kb
input:
249999 20979 200380 826248198 127591 172002 56204158 81857 74640 993818352 135905 91333 171816436 114722 157022 202753447 12766 206391 599512757 238700 168439 414937163 83989 4990 721449922 60352 224658 811423731 96417 140382 991073872 199135 153351 805259120 160733 243559 198961064 200350 247490 52...
output:
263383850
result:
ok single line: '263383850'
Test #74:
score: 53
Accepted
time: 263ms
memory: 71332kb
input:
249996 115779 219849 999981736 94861 55518 999985474 58830 46862 999982614 102659 94803 999968818 133391 176467 999977804 138500 241536 999977380 16144 166081 999952726 170090 43479 999994291 14279 228124 999972954 74622 84116 999965196 81462 53403 999992843 222027 41374 999967397 59984 243208 99998...
output:
880569513
result:
ok single line: '880569513'