QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#540881 | #8941. Even or Odd Spanning Tree | ucup-team1264# | AC ✓ | 505ms | 170536kb | C++20 | 3.9kb | 2024-08-31 18:01:58 | 2024-08-31 18:01:58 |
Judging History
answer
// https://www.youtube.com/watch?v=R0P_f0gXXqs
// I could feel your heartbeat
// I could feel somewhere you’re looking down
// ‘Cause it’s you who I’m loving
// And it’s you that I want in need
#ifndef ONLINE_JUDGE
#include "templates/debug.hpp"
#else
#define debug(...)
#endif
#include <bits/stdc++.h>
using namespace std;
using i64 = int64_t;
using u64 = uint64_t;
class UnionFindSet {
vector<int> fa, sz;
public:
UnionFindSet(int n) : fa(n), sz(n, 1) {
for (int i = 0; i < n; i++) {
fa[i] = i;
}
}
int size(int x) { return sz[find(x)]; }
int find(int x) { return x == fa[x] ? x : fa[x] = find(fa[x]); }
int merge(int x, int y) {
x = find(x), y = find(y);
if (x == y) return 0;
if (sz[x] < sz[y]) swap(x, y);
fa[y] = x, sz[x] += sz[y];
return 1;
}
};
#define int i64
constexpr int INF = 1e18;
void solve() {
int n, m; cin >> n >> m;
struct Edge {
int u, v, w;
bool operator < (const Edge& e) const {
return w < e.w;
}
};
vector<Edge> edges(m);
for (int i = 0; i < m; i++) {
cin >> edges[i].u >> edges[i].v >> edges[i].w;
edges[i].u--, edges[i].v--;
}
sort(edges.begin(), edges.end());
vector<vector<pair<int, int>>> adj(n);
UnionFindSet ufs(n);
int te = 0, s0 = 0;
for (auto [u, v, w]: edges) {
if (ufs.merge(u, v)) {
adj[u].emplace_back(v, w);
adj[v].emplace_back(u, w);
te++; s0 += w;
}
}
if (te < n - 1) {
cout << -1 << " " << -1 << "\n";
return;
}
array<int, 2> ans = {-1, -1};
ans[s0 % 2] = s0;
vector<vector<int>> fa(20, vector<int>(n));
array<vector<vector<int>>, 2> mx;
mx.fill(vector(20, vector<int>(n, -INF)));
vector<int> dep(n);
function<void(int, int)> dfs = [&](int u, int p) {
for (int b = 1; b < 20; b++) {
fa[b][u] = fa[b - 1][fa[b - 1][u]];
mx[0][b][u] = max(mx[0][b - 1][u], mx[0][b - 1][fa[b - 1][u]]);
mx[1][b][u] = max(mx[1][b - 1][u], mx[1][b - 1][fa[b - 1][u]]);
}
for (auto [v, w]: adj[u]) {
if (v == p) continue;
fa[0][v] = u;
mx[w % 2][0][v] = w;
dep[v] = dep[u] + 1;
dfs(v, u);
}
};
dfs(0, 0);
auto ancestor = [&](int u, int diff) {
for (int b = 19; b >= 0; b--) {
if (diff >> b & 1) u = fa[b][u];
}
return u;
};
auto anc_query = [&](int u, int diff, int o) {
int res = -INF;
for (int b = 19; b >= 0; b--) {
if (diff >> b & 1) {
res = max(res, mx[o][b][u]);
u = fa[b][u];
}
}
return res;
};
auto lca = [&] (int u, int v) {
if (dep[u] < dep[v]) swap(u, v);
u = ancestor(u, dep[u] - dep[v]);
if (u == v) return u;
for (int b = 19; b >= 0; b--) {
if (fa[b][u] != fa[b][v]) {
u = fa[b][u];
v = fa[b][v];
}
}
return fa[0][u];
};
int min_diff = INF;
for (auto [u, v, w]: edges) {
int l = lca(u, v), o = w % 2;
int ans = -INF;
ans = max(ans, anc_query(u, dep[u] - dep[l], o ^ 1));
ans = max(ans, anc_query(v, dep[v] - dep[l], o ^ 1));
if (ans != -INF) {
min_diff = min(min_diff, w - ans);
}
}
if (min_diff != INF) ans[(s0 & 1) ^ 1] = s0 + min_diff;
cout << ans[0] << " " << ans[1] << "\n";
}
#undef int
// Make bold hypotheses and verify carefully
int main() {
cin.tie(nullptr);
ios::sync_with_stdio(false);
int t = 1;
cin >> t;
while (t--) {
solve();
};
}
这程序好像有点Bug,我给组数据试试?
詳細信息
Test #1:
score: 100
Accepted
time: 0ms
memory: 3544kb
input:
3 2 1 1 2 5 3 1 1 3 1 4 4 1 2 1 1 3 1 1 4 1 2 4 2
output:
-1 5 -1 -1 4 3
result:
ok 6 numbers
Test #2:
score: 0
Accepted
time: 170ms
memory: 3664kb
input:
10000 16 50 1 2 649251632 2 3 605963017 3 4 897721528 4 5 82446151 5 6 917109168 6 7 79647183 7 8 278566178 7 9 573504723 3 10 679859251 8 11 563113083 1 12 843328546 10 13 594049160 11 14 997882839 7 15 569431750 2 16 244494799 16 7 960172373 13 4 317888322 13 3 446883598 9 3 678142319 5 8 43208692...
output:
3140067932 3159441841 1262790434 1309454727 1263932600 1307926149 1189242112 1180186165 2248358640 2261370885 3776889482 3738936375 1093500444 1058677117 3433711014 3402127725 1201099898 1187873655 1395482806 1410162043 3456885934 3486092007 3943951826 3988876469 2479987500 2535532661 2909126794 293...
result:
ok 20000 numbers
Test #3:
score: 0
Accepted
time: 181ms
memory: 4860kb
input:
100 1806 5000 1 2 139994119 2 3 184924112 3 4 670813536 4 5 443325848 5 6 767909046 6 7 531742851 7 8 364385440 8 9 918195219 9 10 731896671 10 11 671688362 11 12 558665746 12 13 154497842 13 14 28636459 14 15 570343686 15 16 419626123 16 17 817852951 17 18 517701907 18 19 952451718 19 20 141747977 ...
output:
380509244078 380509217939 236564714828 236564588423 317690341848 317690193297 416922743878 416923542879 411997066938 411996924725 231780454372 231780901543 156856996316 156856345151 239278757000 239278493321 288480848080 288481502909 347301406524 347301269265 362642903994 362643090967 158361335208 1...
result:
ok 200 numbers
Test #4:
score: 0
Accepted
time: 250ms
memory: 18496kb
input:
10 15547 50000 1 2 762013057 2 3 473514078 3 4 73078629 4 5 932961699 5 6 157436174 6 7 190061912 7 8 140204258 8 9 737720271 9 10 386190699 10 11 92718916 11 12 68384258 12 13 389445848 13 14 906761733 14 15 644882062 15 16 429774551 16 17 330771475 17 18 815808541 18 19 239714301 19 20 350847429 2...
output:
2833348523676 2833348592065 4133065384586 4133065395925 3395129351174 3395129357911 4109233311456 4109233300341 4201582590330 4201582656213 4055209304322 4055209286787 4274470524320 4274470529139 4221591172170 4221591328195 3155641613234 3155641574871 3656162030214 3656162010817
result:
ok 20 numbers
Test #5:
score: 0
Accepted
time: 479ms
memory: 158068kb
input:
1 200000 500000 1 2 485160054 2 3 698975729 3 4 100346974 4 5 820234671 5 6 389996728 6 7 914128102 7 8 439507064 8 9 938065130 9 10 353829140 2 11 391113348 7 12 685484428 8 13 492562017 7 14 269259412 4 15 133636977 7 16 189855044 16 17 393115842 9 18 196148136 13 19 272676317 1 20 778859832 12 21...
output:
46934564700640 46934564707403
result:
ok 2 number(s): "46934564700640 46934564707403"
Test #6:
score: 0
Accepted
time: 476ms
memory: 158008kb
input:
1 200000 500000 1 2 825868392 2 3 96775645 3 4 594837991 4 5 160657859 5 6 313806062 6 7 711860421 7 8 618363510 8 9 784016759 9 10 261473589 10 11 931365544 11 12 372625381 12 13 728196426 13 14 641630335 14 15 993361561 15 16 731849490 16 17 802998444 17 18 222098249 18 19 16513016 19 20 354524457...
output:
46801911175000 46801911171749
result:
ok 2 number(s): "46801911175000 46801911171749"
Test #7:
score: 0
Accepted
time: 477ms
memory: 157900kb
input:
1 200000 500000 1 2 842585427 2 3 791026412 3 4 843625151 4 5 729586460 5 6 157528721 6 7 846617054 7 8 737344300 8 9 915918783 9 10 697382206 10 11 647361071 11 12 438594908 12 13 472804786 13 14 426537066 14 15 93901471 15 16 183637656 16 17 785203928 17 18 741855632 18 19 800547153 19 20 58723676...
output:
46131143829898 46131143836751
result:
ok 2 number(s): "46131143829898 46131143836751"
Test #8:
score: 0
Accepted
time: 461ms
memory: 157928kb
input:
1 200000 500000 1 2 21536574 2 3 104440599 3 4 507646483 4 5 853564547 5 6 30231389 6 7 81344061 7 8 85488147 8 9 425069154 9 10 511681492 10 11 443781660 11 12 377608322 12 13 453040416 13 14 233386703 14 15 723131321 15 16 438749889 16 17 801233515 17 18 454069326 18 19 846692740 19 20 972424264 2...
output:
45558621285148 45558621284239
result:
ok 2 number(s): "45558621285148 45558621284239"
Test #9:
score: 0
Accepted
time: 436ms
memory: 158028kb
input:
1 200000 500000 1 2 519568971 2 3 853629719 3 4 300838777 4 5 853468350 5 6 593058273 6 7 370503500 7 8 46893088 8 9 571232687 9 10 657711042 10 11 271196301 11 12 331144994 12 13 715838787 13 14 53042548 14 15 115867361 15 16 766702189 16 17 731685076 17 18 362857236 18 19 413501522 19 20 397702264...
output:
45173663952580 45173663950355
result:
ok 2 number(s): "45173663952580 45173663950355"
Test #10:
score: 0
Accepted
time: 169ms
memory: 3848kb
input:
10000 20 50 1 2 147473388 2 3 605402240 3 4 522464618 2 5 707965800 3 6 3583550 6 7 268408004 4 8 462945122 8 9 474541356 2 10 205726788 5 11 330841004 6 12 523365722 12 13 941306492 2 14 573980412 2 15 156244250 14 16 507216542 11 17 463384792 10 18 473275012 6 19 345891816 5 20 533722940 10 1 6981...
output:
4008710456 4017336847 4946409492 4992621285 4696218760 4704258231 4674921744 4695521831 4946679402 4945691427 4478698910 4497256515 4783526390 4814213127 6123208914 6165320103 4133051540 4120131291 4194209082 4200997377 5060476734 5053009795 2412375120 2417221069 3330898760 3347313551 4382613900 437...
result:
ok 20000 numbers
Test #11:
score: 0
Accepted
time: 179ms
memory: 4696kb
input:
100 1610 5000 1 2 904287524 2 3 75953162 3 4 12435440 4 5 361167090 5 6 644441712 6 7 581450442 7 8 861614552 8 9 252436848 9 10 846939964 10 11 181497206 11 12 455157234 12 13 980036724 13 14 562452946 14 15 167199106 15 16 976061800 16 17 264541878 17 18 450292904 18 19 570015780 19 20 941168460 2...
output:
310919021480 310918978087 169799021650 169798866427 165431158820 165431087973 179832505830 179832156959 144382457024 144382154811 306492431780 306492339197 312896210638 312896338249 207725167692 207724961945 226476662054 226476300761 284720963798 284721089955 46893319730 46911208805 53207690380 5322...
result:
ok 200 numbers
Test #12:
score: 0
Accepted
time: 228ms
memory: 18016kb
input:
10 17574 50000 1 2 166340794 2 3 373972798 3 4 522169738 4 5 581967928 5 6 507291538 6 7 664693732 7 8 181493270 8 9 761378548 9 10 555703930 10 11 520699512 11 12 768435200 12 13 107051412 13 14 521048410 14 15 567386926 15 16 450543048 16 17 756344634 17 18 103405654 18 19 25262168 19 20 913368074...
output:
3656979404008 3656979434619 354537184370 354544063625 341759707004 341768797573 3404306510292 3404306513389 2541263693920 2541263703985 3113759618770 3113759622361 1913085413634 1913085422989 6249974944498 6250083092549 2976390899750 2976390845957 3512683798248 3512786834297
result:
ok 20 numbers
Test #13:
score: 0
Accepted
time: 445ms
memory: 141456kb
input:
1 177205 500000 1 2 18290056 2 3 11655538 3 4 16963148 4 5 2641924 5 6 25637680 6 7 4730356 7 8 27146378 8 9 15652194 9 10 14890628 10 11 19365486 11 12 3820786 12 13 11452196 13 14 5102768 14 15 7439266 15 16 25369914 16 17 14116212 17 18 3698702 18 19 4063592 19 20 1996234 20 21 13130350 21 22 146...
output:
2252002554076 2252002553015
result:
ok 2 number(s): "2252002554076 2252002553015"
Test #14:
score: 0
Accepted
time: 402ms
memory: 138180kb
input:
1 172216 500000 1 2 956765280 2 3 973677722 3 4 837393398 4 5 946237454 5 6 949499478 6 7 888941620 7 8 948636246 8 9 854806028 9 10 886928282 10 11 993073674 11 12 998847262 12 13 837823962 13 14 960884892 14 15 939320696 15 16 918711588 16 17 954208380 17 18 992095856 18 19 948877780 19 20 9919445...
output:
75272260956632 75272252843281
result:
ok 2 number(s): "75272260956632 75272252843281"
Test #15:
score: 0
Accepted
time: 367ms
memory: 126068kb
input:
1 155293 500000 1 2 384804188 2 3 63364234 3 4 177584976 4 5 328074256 5 6 275790972 6 7 378072002 7 8 54303408 8 9 383022922 9 10 387817490 10 11 86278032 11 12 64413800 12 13 187511028 13 14 321677058 14 15 228514696 15 16 43055978 16 17 177073484 17 18 138589066 18 19 67320634 19 20 119232370 20 ...
output:
24663756079214 24663756073521
result:
ok 2 number(s): "24663756079214 24663756073521"
Test #16:
score: 0
Accepted
time: 413ms
memory: 151728kb
input:
1 191060 500000 1 2 588860046 2 3 621642264 3 4 882088964 4 5 572796092 5 6 891347164 6 7 684474878 7 8 691206420 8 9 637066324 9 10 667218786 10 11 573407158 11 12 762042024 12 13 843998480 13 14 806619014 14 15 817306462 15 16 682991688 16 17 905928094 17 18 849964156 18 19 780739198 19 20 9264754...
output:
67741268383444 67741175242067
result:
ok 2 number(s): "67741268383444 67741175242067"
Test #17:
score: 0
Accepted
time: 392ms
memory: 145032kb
input:
1 182135 500000 1 2 574248454 2 3 688014902 3 4 599110558 4 5 734847794 5 6 569915634 6 7 497264762 7 8 733196458 8 9 479258008 9 10 472456988 10 11 516257788 11 12 512444304 12 13 593266558 13 14 637089030 14 15 570997318 15 16 532382458 16 17 560609000 17 18 660606072 18 19 490130424 19 20 7457994...
output:
97218791529902 97218791529393
result:
ok 2 number(s): "97218791529902 97218791529393"
Test #18:
score: 0
Accepted
time: 417ms
memory: 147972kb
input:
1 185994 500000 1 2 567397670 2 3 842120068 3 4 140249904 4 5 220412752 5 6 218292640 6 7 589406450 7 8 253438466 8 9 635314634 9 10 531942838 10 11 519438844 11 12 843096034 12 13 807489190 13 14 577058708 14 15 770561234 15 16 282672936 16 17 402179824 17 18 638565940 18 19 241158952 19 20 5523583...
output:
31505497994524 31505497993817
result:
ok 2 number(s): "31505497994524 31505497993817"
Test #19:
score: 0
Accepted
time: 413ms
memory: 139568kb
input:
1 174215 500000 1 2 977507036 2 3 968147144 3 4 965117090 4 5 956825304 5 6 974030604 6 7 962462238 7 8 972448906 8 9 995064350 9 10 989785662 10 11 951491960 11 12 977681774 12 13 961174660 13 14 977438930 14 15 995524486 15 16 965860712 16 17 993531136 17 18 960289144 18 19 956670950 19 20 9607840...
output:
105346434958994 105346442987463
result:
ok 2 number(s): "105346434958994 105346442987463"
Test #20:
score: 0
Accepted
time: 393ms
memory: 143068kb
input:
1 178944 500000 1 2 86098280 2 3 118410448 3 4 318199280 4 5 255691258 5 6 215247486 6 7 193429068 7 8 127237618 8 9 271018410 9 10 251319020 10 11 260349578 11 12 65823910 12 13 321553940 13 14 355045416 14 15 229434824 15 16 293078860 16 17 290590024 17 18 312156114 18 19 359955124 19 20 254870764...
output:
31389456568860 31389456568233
result:
ok 2 number(s): "31389456568860 31389456568233"
Test #21:
score: 0
Accepted
time: 400ms
memory: 139012kb
input:
1 173433 500000 1 2 775495394 2 3 747097450 3 4 796067104 4 5 814079670 5 6 752018466 6 7 732441186 7 8 748111278 8 9 780095242 9 10 734862818 10 11 791458116 11 12 793224776 12 13 755841044 13 14 737438058 14 15 768691928 15 16 790627580 16 17 732414788 17 18 810139090 18 19 796036718 19 20 8237082...
output:
36862858735808 36863317911709
result:
ok 2 number(s): "36862858735808 36863317911709"
Test #22:
score: 0
Accepted
time: 409ms
memory: 142276kb
input:
1 167656 500000 1 2 456035944 2 3 456025212 3 4 456028928 4 5 456020494 5 6 456033838 6 7 456031288 7 8 456037462 8 9 456036874 9 10 456033928 10 11 456036458 11 12 456025538 12 13 456034270 13 14 456032110 14 15 456020716 15 16 456037822 16 17 456027056 17 18 456030992 18 19 456024426 19 20 4560270...
output:
48928057289912 48928057293077
result:
ok 2 number(s): "48928057289912 48928057293077"
Test #23:
score: 0
Accepted
time: 419ms
memory: 151800kb
input:
1 180915 500000 1 2 865360666 2 3 865355962 3 4 865357604 4 5 865351302 5 6 865354964 6 7 865346792 7 8 865350400 8 9 865353668 9 10 865347726 10 11 865356066 11 12 865350906 12 13 865350600 13 14 865353584 14 15 865351338 15 16 865353102 16 17 865353218 17 18 865353740 18 19 865360630 19 20 8653553...
output:
53500496453210 53500621187019
result:
ok 2 number(s): "53500496453210 53500621187019"
Test #24:
score: 0
Accepted
time: 429ms
memory: 155904kb
input:
1 188726 500000 1 2 319399892 2 3 319405994 3 4 319397572 4 5 319394216 5 6 319399972 6 7 319400124 7 8 319389314 8 9 319398048 9 10 319401310 10 11 319392622 11 12 319398416 12 13 319392664 13 14 319399960 14 15 319395510 15 16 319402020 16 17 319399420 17 18 319403128 18 19 319392266 19 20 3194034...
output:
81837449286104 81837617131305
result:
ok 2 number(s): "81837449286104 81837617131305"
Test #25:
score: 0
Accepted
time: 368ms
memory: 163492kb
input:
1 183680 500000 1 2 39796574 2 3 39808868 3 4 39807614 4 5 39804968 5 6 39813792 6 7 39806732 7 8 39805728 8 9 39809550 9 10 39801200 10 11 39805452 11 12 39797604 12 13 39807478 13 14 39804424 14 15 39794882 15 16 39797934 16 17 39813038 17 18 39810440 18 19 39803752 19 20 39802924 20 21 39795836 2...
output:
11227439821002 11227522420245
result:
ok 2 number(s): "11227439821002 11227522420245"
Test #26:
score: 0
Accepted
time: 344ms
memory: 163724kb
input:
1 184055 500000 1 2 116873494 2 3 116881470 3 4 116883768 4 5 116867850 5 6 116870712 6 7 116876012 7 8 116866516 8 9 116872868 9 10 116882712 10 11 116870434 11 12 116883166 12 13 116874110 13 14 116868286 14 15 116884012 15 16 116879084 16 17 116867386 17 18 116867502 18 19 116885038 19 20 1168855...
output:
27197770581300 27197770566945
result:
ok 2 number(s): "27197770581300 27197770566945"
Test #27:
score: 0
Accepted
time: 373ms
memory: 164724kb
input:
1 185445 500000 1 2 62011092 2 3 62010570 3 4 62010882 4 5 62015460 5 6 62014982 6 7 62012918 7 8 62028256 8 9 62017540 9 10 62009270 10 11 62028570 11 12 62023016 12 13 62009642 13 14 62012434 14 15 62013866 15 16 62019854 16 17 62024480 17 18 62021490 18 19 62018950 19 20 62026254 20 21 62019222 2...
output:
14754646348982 14754646348259
result:
ok 2 number(s): "14754646348982 14754646348259"
Test #28:
score: 0
Accepted
time: 352ms
memory: 165296kb
input:
1 186316 500000 1 2 237200926 2 3 237203286 3 4 237204862 4 5 237189768 5 6 237198310 6 7 237197334 7 8 237188230 8 9 237198350 9 10 237189652 10 11 237186270 11 12 237200586 12 13 237185226 13 14 237192628 14 15 237196636 15 16 237203622 16 17 237192094 17 18 237197532 18 19 237198178 19 20 2371874...
output:
45659003608686 45659003640347
result:
ok 2 number(s): "45659003608686 45659003640347"
Test #29:
score: 0
Accepted
time: 353ms
memory: 164604kb
input:
1 187790 500000 1 2 697700868 2 3 697712434 3 4 697713790 4 5 697704054 5 6 697712492 6 7 697696430 7 8 697699938 8 9 697701682 9 10 697697874 10 11 697705920 11 12 697704250 12 13 697711128 13 14 697694322 14 15 697694326 15 16 697697790 16 17 697706356 17 18 697702424 18 19 697710350 19 20 6977015...
output:
70750723791724 70750723794005
result:
ok 2 number(s): "70750723791724 70750723794005"
Test #30:
score: 0
Accepted
time: 375ms
memory: 168248kb
input:
1 192542 500000 1 2 338517584 2 3 338514988 3 4 338517240 4 5 338523324 5 6 338528398 6 7 338514214 7 8 338521026 8 9 338514158 9 10 338517224 10 11 338519506 11 12 338512698 12 13 338512830 13 14 338519148 14 15 338515294 15 16 338513594 16 17 338520868 17 18 338526448 18 19 338514816 19 20 3385174...
output:
26700841303860 26700841291603
result:
ok 2 number(s): "26700841303860 26700841291603"
Test #31:
score: 0
Accepted
time: 372ms
memory: 170536kb
input:
1 195853 500000 1 2 377774534 2 3 377762624 3 4 377756866 4 5 377772564 5 6 377759692 6 7 377756712 7 8 377758824 8 9 377764106 9 10 377755284 10 11 377765032 11 12 377757028 12 13 377771156 13 14 377765060 14 15 377767342 15 16 377758006 16 17 377757986 17 18 377755250 18 19 377761720 19 20 3777656...
output:
70099966083398 70099966079527
result:
ok 2 number(s): "70099966083398 70099966079527"
Test #32:
score: 0
Accepted
time: 458ms
memory: 157920kb
input:
1 200000 500000 1 2 156834764 2 3 443705596 3 4 377950610 4 5 53573046 5 6 996502982 6 7 780195784 7 8 483175676 8 9 298225746 9 10 232871180 10 11 758498144 11 12 480047950 12 13 494846312 13 14 84116936 14 15 742051316 15 16 495327492 16 17 285390818 17 18 166303742 18 19 682776686 19 20 128163744...
output:
46049368820696 -1
result:
ok 2 number(s): "46049368820696 -1"
Test #33:
score: 0
Accepted
time: 465ms
memory: 157996kb
input:
1 200000 500000 1 2 713217359 2 3 972202229 3 4 905103201 4 5 516733643 5 6 225474475 6 7 902661739 7 8 87783253 8 9 39324463 9 10 744798971 10 11 656400931 11 12 161903491 12 13 666849929 13 14 863543385 14 15 364069915 15 16 727120301 16 17 486565163 17 18 650514875 18 19 196254799 19 20 354978037...
output:
-1 46195288313135
result:
ok 2 number(s): "-1 46195288313135"
Test #34:
score: 0
Accepted
time: 138ms
memory: 31276kb
input:
1 200000 500000 96702 77553 586161491 259 45671 924569135 37479 142703 132673490 167899 134625 36009966 40350 22355 395414534 21609 159796 704591866 96909 17324 499523552 179116 164712 821787572 24592 68433 556460893 172347 40225 760373175 96021 94688 166478055 74271 3262 965881966 134549 154977 828...
output:
-1 -1
result:
ok 2 number(s): "-1 -1"
Test #35:
score: 0
Accepted
time: 361ms
memory: 152128kb
input:
1 170366 500000 1 2 51904088 2 3 51906290 3 4 51901310 4 5 51899766 5 6 51889650 6 7 51888248 7 8 51906364 8 9 51894216 9 10 51896760 10 11 51895094 11 12 51887578 12 13 51892450 13 14 51894260 14 15 51897094 15 16 51891852 16 17 51889638 17 18 51900686 18 19 51893944 19 20 51900628 20 21 51905434 2...
output:
5209672799912 5209672777771
result:
ok 2 number(s): "5209672799912 5209672777771"
Test #36:
score: 0
Accepted
time: 361ms
memory: 152556kb
input:
1 171448 500000 1 2 354953150 2 3 354957390 3 4 354947982 4 5 354950694 5 6 354956980 6 7 354958112 7 8 354957406 8 9 354944650 9 10 354962902 10 11 354958726 11 12 354945674 12 13 354950716 13 14 354947010 14 15 354953320 15 16 354944500 16 17 354959016 17 18 354962056 18 19 354952550 19 20 3549437...
output:
46914465960680 46914465951805
result:
ok 2 number(s): "46914465960680 46914465951805"
Test #37:
score: 0
Accepted
time: 366ms
memory: 156576kb
input:
1 176970 500000 1 2 235787296 2 3 235785740 3 4 235801034 4 5 235793404 5 6 235788294 6 7 235796866 7 8 235794432 8 9 235783566 9 10 235782684 10 11 235786242 11 12 235794068 12 13 235795904 13 14 235783012 14 15 235799294 15 16 235795872 16 17 235783042 17 18 235789244 18 19 235797338 19 20 2357995...
output:
22329976664228 22329976652421
result:
ok 2 number(s): "22329976664228 22329976652421"
Test #38:
score: 0
Accepted
time: 377ms
memory: 152128kb
input:
1 170626 500000 1 2 269880340 2 3 269879070 3 4 269868826 4 5 269882102 5 6 269881214 6 7 269883780 7 8 269881630 8 9 269883236 9 10 269870838 10 11 269877126 11 12 269879198 12 13 269880600 13 14 269873878 14 15 269874858 15 16 269881476 16 17 269879578 17 18 269883756 18 19 269866876 19 20 2698701...
output:
30977034139142 30977034146903
result:
ok 2 number(s): "30977034139142 30977034146903"
Test #39:
score: 0
Accepted
time: 309ms
memory: 165212kb
input:
1 200000 500000 1 2 373765054 2 3 264982878 3 4 242686950 4 5 312159326 5 6 273659532 6 7 83557832 7 8 157943728 8 9 122366020 9 10 180269952 10 11 395023980 11 12 125067076 12 13 370484102 13 14 192773406 14 15 252715160 15 16 50810010 16 17 336689538 17 18 345818194 18 19 108762822 19 20 380647920...
output:
13523465394268 13523863430647
result:
ok 2 number(s): "13523465394268 13523863430647"
Test #40:
score: 0
Accepted
time: 307ms
memory: 165244kb
input:
1 200000 500000 1 2 75651043 2 3 250009861 3 4 193998963 4 5 127104475 5 6 52202429 6 7 24436277 7 8 168099447 8 9 4405285 9 10 195790917 10 11 180847969 11 12 73158259 12 13 125884679 13 14 129337959 14 15 359265571 15 16 176540199 16 17 9579693 17 18 235318345 18 19 176392715 19 20 59514675 20 21 ...
output:
13547516428012 13547118407417
result:
ok 2 number(s): "13547516428012 13547118407417"
Test #41:
score: 0
Accepted
time: 84ms
memory: 14896kb
input:
2 199998 1 163052 58007 1000000000 2 499999 1 2 1000000000 1 2 999999993 1 2 7 1 2 3 1 2 3 1 2 999999991 1 2 5 1 2 999999994 1 2 999999992 1 2 7 1 2 999999996 1 2 7 1 2 999999990 1 2 999999999 1 2 999999994 1 2 7 1 2 3 1 2 7 1 2 7 1 2 7 1 2 999999997 1 2 999999994 1 2 3 1 2 999999990 1 2 7 1 2 3 1 2...
output:
-1 -1 999999990 3
result:
ok 4 number(s): "-1 -1 999999990 3"
Test #42:
score: 0
Accepted
time: 505ms
memory: 168972kb
input:
1 200000 500000 1 2 1232 1 3 1232 4 2 21044 5 3 29150 6 4 72852 7 5 58890 8 6 97544 9 7 80162 10 8 66894 11 9 81258 12 10 6994 13 11 94404 14 12 15550 15 13 88650 16 14 27964 17 15 9568 18 16 36834 19 17 4312 20 18 63864 21 19 71804 22 20 91456 23 21 57074 24 22 47714 25 23 61478 26 24 73836 27 25 5...
output:
9981136576 10099627827
result:
ok 2 number(s): "9981136576 10099627827"
Extra Test:
score: 0
Extra Test Passed