QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#118460 | #6629. Travelling Trader | pandapythoner# | 11 | 161ms | 42760kb | C++20 | 5.1kb | 2023-07-03 16:23:22 | 2024-05-31 18:53:42 |
Judging History
answer
// #define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ll long long
#define flt double
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
mt19937 rnd(234);
const ll inf = 1e18;
int n, k;
vector<ll> a;
vector<vector<int>> g;
vector<int> prnt;
vector<int> ans;
vector<int> szs;
vector<ll> dp, dp_ret, dp_aboba;
void build_szs(int v) {
szs[v] = 1;
int mx_sz = -1;
int mx_sz_pos = -1;
for (int i = 0; i < (int)g[v].size(); i += 1) {
int to = g[v][i];
build_szs(to);
szs[v] += szs[to];
if (szs[to] > mx_sz) {
mx_sz = szs[to];
mx_sz_pos = i;
}
}
if (mx_sz_pos != -1) {
swap(g[v][0], g[v][mx_sz_pos]);
}
}
void dfs0(int v, int p) {
prnt[v] = p;
auto it = find(all(g[v]), p);
if (it != g[v].end()) {
g[v].erase(it);
}
for (auto to : g[v]) {
dfs0(to, v);
}
}
void dfs1(int v, ll sm, pair<ll, int> &rs) {
sm += a[v];
rs = max(rs, make_pair(sm, v));
for (auto to : g[v]) {
dfs1(to, sm, rs);
}
}
void dfs2(int v) {
if(g[v].empty()){
dp[v] = a[v];
dp_ret[v] = a[v];
return;
}
ll sm = 0;
for (auto to : g[v]) {
dfs2(to);
sm += a[to];
}
int sns = g[v].size();
vector<pair<ll, int>> srtd_dp(sns), srtd_dp_ret(sns), srtd_dp_aboba(sns);
for(int i = 0; i < sns; i += 1){
int to = g[v][i];
srtd_dp[i] = make_pair(dp[to], i);
srtd_dp_ret[i] = make_pair(dp_ret[to], i);
srtd_dp_aboba[i] = make_pair(dp_aboba[to], i);
}
sort(rall(srtd_dp));
sort(rall(srtd_dp_ret));
sort(rall(srtd_dp_aboba));
dp_ret[v] = max(dp_ret[v], a[v] + srtd_dp_ret[0].first + sm - a[g[v][srtd_dp_ret[0].second]]);
dp_aboba[v] = max(dp_aboba[v], srtd_dp[0].first + sm - a[g[v][srtd_dp[0].second]]);
dp[v] = max(dp[v], a[v] + srtd_dp[0].first + sm - a[g[v][srtd_dp[0].second]]);
for(int i = 0; i < sns && i < 4; i += 1){
for(int j = 0; j < sns && j < 4; j += 1){
if(srtd_dp_ret[i].second != srtd_dp[j].second){
dp_aboba[v] = max(dp_aboba[v], a[v] + srtd_dp_ret[i].first + srtd_dp[j].first + sm - a[g[v][srtd_dp_ret[i].second]] - a[g[v][srtd_dp[j].second]]);
dp[v] = max(dp[v], a[v] + srtd_dp_ret[i].first + srtd_dp[j].first + sm - a[g[v][srtd_dp_ret[i].second]] - a[g[v][srtd_dp[j].second]]);
}
if(srtd_dp_ret[i].second == srtd_dp_ret[j].second){
continue;
}
for(int k = 0; k < sns && k < 4; k += 1){
if(srtd_dp_ret[i].second == srtd_dp[k].second || srtd_dp_ret[j].second == srtd_dp[k].second){
continue;
}
dp_aboba[v] = max(dp_aboba[v], a[v] + srtd_dp_ret[i].first + srtd_dp_ret[j].first + srtd_dp[k].first + sm - a[g[v][srtd_dp_ret[i].second]] - a[g[v][srtd_dp_ret[j].second]] - a[g[v][srtd_dp[k].second]]);
}
}
}
}
list<int>::iterator dfs3(int v, list<int> &rs, list<int>::iterator it, bool rvrsd) {
auto ret_val = it;
if (!rvrsd) {
ret_val = rs.insert(it, v);
} else {
it = rs.insert(it, v);
}
for (int i = 0; i < (int)g[v].size(); i += 1) {
int to = g[v][i];
if (!rvrsd) {
dfs3(to, rs, it, !rvrsd);
} else {
it = dfs3(to, rs, it, !rvrsd);
}
}
return ret_val;
}
ll solve() {
ans.clear();
if (k == 1) {
pair<ll, int> rs = {-1, -1};
dfs1(0, 0, rs);
vector<int> way;
int v = rs.second;
while (v != -1) {
way.push_back(v);
v = prnt[v];
}
reverse(all(way));
ans = way;
return rs.first;
}
if (k == 2) {
dp.assign(n, -1);
dp_ret.assign(n, -1);
dp_aboba.assign(n, -1);
dfs2(0);
return -1;
}
if (k == 3) {
szs.resize(n);
build_szs(0);
list<int> rs;
dfs3(0, rs, rs.begin(), false);
for (auto x : rs) {
ans.push_back(x);
}
ll sm = 0;
for (int i = 0; i < n; i += 1) {
sm += a[i];
}
return sm;
}
assert(0);
return -1;
}
int32_t main() {
if (1) {
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
}
cin >> n >> k;
g.assign(n, vector<int>());
for (int i = 0; i < n - 1; i += 1) {
int u, v;
cin >> u >> v;
--u;
--v;
g[u].push_back(v);
g[v].push_back(u);
}
a.resize(n);
for (int i = 0; i < n; i += 1) {
cin >> a[i];
}
prnt.resize(n);
dfs0(0, -1);
ll rs = solve();
cout << rs << "\n";
cout << (int)ans.size() << "\n";
for (auto t : ans) {
cout << t + 1 << " ";
}
cout << "\n";
return 0;
}
/*
10 3
1 2
2 3
2 4
2 5
5 6
1 7
7 8
7 9
8 10
1 1 1 1 1 1 1 1 1 1
*/
详细
Subtask #1:
score: 2
Accepted
Test #1:
score: 2
Accepted
time: 0ms
memory: 3660kb
input:
2 1 1 2 255959470 961356354
output:
1217315824 2 1 2
result:
ok correct!
Test #2:
score: 0
Accepted
time: 1ms
memory: 3700kb
input:
1000 1 730 89 762 280 923 523 740 22 679 350 448 769 102 712 154 965 219 32 238 289 484 502 183 311 999 682 806 450 275 101 131 197 749 720 131 937 960 202 503 320 95 262 595 133 809 560 659 451 843 218 258 842 564 316 729 727 413 237 606 531 469 258 612 8 707 539 359 680 957 639 381 708 104 490 234...
output:
95535 17 1 173 449 472 396 545 668 270 981 489 852 836 763 6 218 843 758
result:
ok correct!
Test #3:
score: 0
Accepted
time: 73ms
memory: 18384kb
input:
200000 1 111811 133538 179217 151840 171974 117009 187613 169656 64662 13136 132434 89348 52802 175565 194821 191312 196047 99457 40339 152969 29669 180026 147677 57771 119598 58048 80707 146623 72232 101624 48109 11800 71536 69 31573 129 24409 17263 1033 148614 66977 149926 138624 87653 141889 1178...
output:
221 35 1 145832 90178 52464 3517 55709 39776 67451 59386 143855 102872 38865 13093 177086 7366 190908 160039 69864 196809 13257 612 171083 182883 14221 93359 52156 27994 103745 151704 138607 5346 14735 29598 89600 128747
result:
ok correct!
Test #4:
score: 0
Accepted
time: 69ms
memory: 18324kb
input:
200000 1 102636 78442 179388 84484 161437 35179 102313 154299 62439 71542 176361 125315 174129 186376 180886 54947 154823 114239 174647 112385 136495 187134 157035 96260 101101 192444 58209 23947 55494 191600 168007 162648 140149 73180 130665 180633 129328 67380 90262 134914 185905 104220 111321 154...
output:
21795891322 36 1 13557 199188 104317 71891 69787 1221 63258 191536 179446 83510 187880 124824 43888 83237 194602 59080 196038 195977 18490 43421 110298 60011 137785 140692 48345 68279 128780 198550 29394 56331 112092 192199 177180 16418 142142
result:
ok correct!
Test #5:
score: 0
Accepted
time: 64ms
memory: 18508kb
input:
200000 1 682 75953 92444 160568 113369 93705 154622 193304 149619 128186 104784 48913 131684 161196 25886 151867 89191 19511 99233 137377 104650 120096 64347 93526 111350 71598 7568 120116 123497 76821 25436 190715 99884 33654 109438 69462 165464 2475 163215 34551 33926 85078 101208 193355 50705 828...
output:
99327575017 197 1 178606 82034 53029 10508 21404 203 109187 121716 142023 3901 36728 9916 192913 18250 170199 113960 179753 163922 179588 31797 31645 183321 83207 13973 128176 38001 160968 9055 62809 168173 43933 187373 123795 114656 2192 193151 25062 141855 133596 155793 64049 57320 93903 33957 139...
result:
ok correct!
Test #6:
score: 0
Accepted
time: 59ms
memory: 19304kb
input:
200000 1 91999 92900 195726 58991 132067 99937 168188 152017 188495 19779 105961 45241 53406 75757 85118 170259 46250 47585 132248 8609 195110 32777 164307 95643 133411 739 170952 145623 19297 14414 171045 97619 74663 193421 139543 189434 36319 56453 77520 91164 91469 30021 128798 62259 183807 15271...
output:
9098893435 13 1 164355 56677 150505 174723 115829 88068 105453 199874 190131 165416 182628 114943
result:
ok correct!
Test #7:
score: 0
Accepted
time: 38ms
memory: 18852kb
input:
200000 1 189797 1 1 148138 1 95067 141831 1 168151 1 1 25692 95612 1 1 135979 1 141581 119622 1 1 131946 86508 1 98799 1 1 189104 1 117526 46338 1 1 166375 1 28026 165221 1 54204 1 1 98743 1 181414 1 34313 1 71302 1 161200 1 146339 1 47014 1 137258 1 57857 1 196493 1 99105 54487 1 104725 1 1 45203 1...
output:
1175349557 2 1 153544
result:
ok correct!
Test #8:
score: 0
Accepted
time: 60ms
memory: 18208kb
input:
199999 1 56367 178046 1 156890 170478 1 111308 177326 1 188427 1 90169 126610 1 161930 167698 96500 126424 118330 158517 186608 1 95505 107863 1 142887 72279 27494 1 114700 118535 1 68584 63156 97555 19966 39239 1 128030 1 1 86200 66974 1 34616 47100 173578 1 1 117279 89769 43412 1 89670 103573 1 13...
output:
2999144210 3 1 52552 129910
result:
ok correct!
Test #9:
score: 0
Accepted
time: 80ms
memory: 29652kb
input:
200000 1 95601 67789 174512 65854 198542 123861 153390 92355 141969 168754 177054 101194 25665 15524 131869 168080 171051 30732 97293 119758 103002 59019 141990 124310 161550 116618 2585 170410 132999 38200 99202 98733 73949 155033 144918 64086 1594 34916 37138 165382 13452 170885 136973 62178 15250...
output:
200000000000000 200000 1 47213 179780 132180 145558 41335 179095 156350 24912 104386 94658 54370 97034 108043 73905 141018 157563 199841 176455 147422 87545 190562 135095 24903 62484 36389 156106 45144 120321 4911 173474 102976 13602 68252 7332 141515 59337 182112 124040 38089 15458 161370 41901 144...
result:
ok correct!
Test #10:
score: 0
Accepted
time: 81ms
memory: 25768kb
input:
200000 1 122636 169264 76896 89915 72116 125306 186356 74852 84394 177419 21725 144848 106395 111991 189102 195804 6151 170169 185460 146764 6304 149801 147880 99539 6202 175326 104277 26515 39402 33436 116555 185545 44341 92305 197925 125286 28215 102176 182103 160554 105237 169007 105618 75618 190...
output:
49951940813408 100001 1 88700 18534 14218 21693 84470 150823 121376 192964 139616 11067 93019 188349 55336 13628 87630 31553 28945 29827 140175 179655 10038 38915 99968 89953 72978 102045 45280 176852 171879 100086 93399 183932 84482 111738 112608 136016 101850 19371 96135 54333 95939 2865 140685 13...
result:
ok correct!
Test #11:
score: 0
Accepted
time: 39ms
memory: 18908kb
input:
200000 1 1 2 1 3 2 4 2 5 3 6 3 7 4 8 4 9 5 10 5 11 6 12 6 13 7 14 7 15 8 16 8 17 9 18 9 19 10 20 10 21 11 22 11 23 12 24 12 25 13 26 13 27 14 28 14 29 15 30 15 31 16 32 16 33 17 34 17 35 18 36 18 37 19 38 19 39 20 40 20 41 21 42 21 43 22 44 22 45 23 46 23 47 24 48 24 49 25 50 25 51 26 52 26 53 27 54...
output:
13954593167 18 1 2 5 10 20 40 80 161 323 647 1295 2590 5181 10363 20727 41454 82908 165817
result:
ok correct!
Subtask #2:
score: 0
Wrong Answer
Test #12:
score: 0
Wrong Answer
time: 0ms
memory: 3860kb
input:
2 2 2 1 243296356 635616793
output:
-1 0
result:
wrong answer Integer 0 violates the range [1, 2]
Subtask #3:
score: 0
Skipped
Dependency #2:
0%
Subtask #4:
score: 0
Skipped
Dependency #3:
0%
Subtask #5:
score: 4
Accepted
Test #83:
score: 4
Accepted
time: 1ms
memory: 3948kb
input:
2000 3 1359 90 1703 163 158 188 360 1501 195 664 1414 215 1546 1756 536 1096 1726 1223 1150 104 1757 703 1982 282 1023 998 1180 419 576 1759 1496 1993 44 670 1703 952 855 849 1998 1399 1280 980 1533 1090 1270 678 1680 387 469 1734 1799 263 473 588 303 226 5 295 1489 1471 1094 1667 1912 210 1368 1360...
output:
1008611451196 2000 1 1091 961 605 1613 454 1237 1823 1101 1617 1369 1840 562 1256 901 1040 709 1291 1526 1238 129 523 1919 816 674 1961 452 297 1903 1656 560 739 183 863 1522 951 877 1973 1548 191 1265 1344 33 1679 565 774 276 139 926 1397 36 46 1019 1376 1427 289 545 16 1076 1880 1684 1968 81 1504 ...
result:
ok correct!
Test #84:
score: 0
Accepted
time: 1ms
memory: 3812kb
input:
2000 3 1727 567 1783 1850 205 985 323 1094 1153 821 1756 117 377 1928 1026 1303 1343 1814 268 745 242 948 1140 1218 7 1675 101 1798 1403 1752 1184 671 87 248 1953 30 1580 1441 507 1438 525 419 901 421 1585 1405 1575 883 1952 1930 1988 1325 615 722 994 1202 178 474 1978 1500 899 481 216 409 999 1817 ...
output:
1012330476243 2000 1 525 419 422 269 1545 1454 1724 88 1364 1696 1158 1918 345 1057 1532 1725 650 1807 719 693 175 234 1935 220 92 1530 1315 257 993 1275 1046 319 1885 399 750 838 722 615 449 477 723 1205 163 1561 676 1347 1449 1768 1466 1993 1342 1631 1585 571 1902 975 481 899 346 1321 550 735 1639...
result:
ok correct!
Test #85:
score: 0
Accepted
time: 1ms
memory: 4076kb
input:
2000 3 1213 130 101 508 72 1199 1550 1096 1099 861 1515 627 1299 1672 1338 105 1444 1019 15 1560 1949 971 52 1312 30 529 186 1687 1917 484 1971 349 537 1223 1955 1377 300 1060 1786 1811 1960 90 1959 1353 1831 1548 303 511 1073 1197 863 1527 1379 994 31 9 1247 1707 1395 1532 29 1544 119 296 1919 1554...
output:
1001405462082 2000 1 1255 1002 830 513 1940 1369 668 1557 1292 1010 374 640 1085 33 1261 1450 954 1703 146 295 729 1955 1377 242 181 1899 1527 863 1067 1356 384 1503 1069 1801 710 1303 388 1208 1310 1483 854 78 570 358 1680 486 674 63 150 1694 1027 1372 1907 72 1199 1152 434 898 333 578 281 666 1307...
result:
ok correct!
Test #86:
score: 0
Accepted
time: 1ms
memory: 3844kb
input:
2000 3 532 64 99 960 1271 519 1141 1056 1986 1889 930 817 639 1188 841 771 1334 179 1336 1163 1687 1909 281 1300 1410 207 1018 1471 1645 972 711 1504 623 1739 1905 1959 1423 738 1747 34 1684 204 61 1012 1092 1350 1977 1130 62 473 1623 1021 1157 227 427 832 1900 1792 1910 584 265 330 1874 1186 1797 1...
output:
1002207066842 2000 1 1093 1848 1011 1948 1348 1659 1619 719 864 861 1513 1106 1637 1773 466 762 1255 182 1295 1808 1762 804 225 1068 1901 652 233 1074 1293 228 997 1834 857 595 317 1143 1799 1830 923 618 240 789 1882 926 547 1100 1017 269 1634 828 1396 1468 67 1166 1971 754 731 591 1840 1503 443 667...
result:
ok correct!
Test #87:
score: 0
Accepted
time: 1ms
memory: 3932kb
input:
2000 3 1 2 1 3 2 4 2 5 3 6 3 7 4 8 4 9 5 10 5 11 6 12 6 13 7 14 7 15 8 16 8 17 9 18 9 19 10 20 10 21 11 22 11 23 12 24 12 25 13 26 13 27 14 28 14 29 15 30 15 31 16 32 16 33 17 34 17 35 18 36 18 37 19 38 19 39 20 40 20 41 21 42 21 43 22 44 22 45 23 46 23 47 24 48 24 49 25 50 25 51 26 52 26 53 27 54 2...
output:
995663027103 2000 1 5 21 85 341 1365 1364 682 1367 1366 683 340 1361 1360 680 1363 1362 681 170 343 1373 1372 686 1375 1374 687 342 1369 1368 684 1371 1370 685 171 84 337 1349 1348 674 1351 1350 675 336 1345 1344 672 1347 1346 673 168 339 1357 1356 678 1359 1358 679 338 1353 1352 676 1355 1354 677 1...
result:
ok correct!
Test #88:
score: 0
Accepted
time: 0ms
memory: 4068kb
input:
2000 3 1 2 1 3 1 4 2 5 2 6 2 7 3 8 3 9 3 10 4 11 4 12 4 13 5 14 5 15 5 16 6 17 6 18 6 19 7 20 7 21 7 22 8 23 8 24 8 25 9 26 9 27 9 28 10 29 10 30 10 31 11 32 11 33 11 34 12 35 12 36 12 37 13 38 13 39 13 40 14 41 14 42 14 43 15 44 15 45 15 46 16 47 16 48 16 49 17 50 17 51 17 52 18 53 18 54 18 55 19 5...
output:
1000109641799 2000 1 7 61 547 1640 1641 1642 546 1637 1638 1639 545 1634 1635 1636 182 550 1649 1650 1651 549 1646 1647 1648 548 1643 1644 1645 183 553 1658 1659 1660 552 1655 1656 1657 551 1652 1653 1654 184 60 538 1613 1614 1615 537 1610 1611 1612 536 1607 1608 1609 179 541 1622 1623 1624 540 1619...
result:
ok correct!
Test #89:
score: 0
Accepted
time: 0ms
memory: 3560kb
input:
2 3 1 2 820567835 309877233
output:
1130445068 2 1 2
result:
ok correct!
Test #90:
score: 0
Accepted
time: 0ms
memory: 3624kb
input:
50 3 28 1 40 30 17 31 41 25 1 30 38 6 19 9 50 6 37 4 5 44 13 31 21 46 35 14 25 10 36 41 42 32 37 11 27 20 48 45 31 10 42 17 29 40 26 35 43 3 23 24 27 34 42 39 25 5 7 18 35 48 15 31 30 23 20 17 42 12 39 16 7 32 17 3 41 38 31 47 13 8 33 9 22 33 49 48 29 11 31 19 26 31 41 2 40 17 20 21 4 4 10 2 7 6 3 4...
output:
270 50 1 23 24 40 3 43 20 34 27 46 21 42 7 18 32 16 39 12 31 25 2 36 38 50 6 41 44 5 10 8 13 15 47 9 22 33 19 35 49 45 48 14 26 17 11 4 37 29 30 28
result:
ok correct!
Test #91:
score: 0
Accepted
time: 1ms
memory: 3868kb
input:
2000 3 1651 76 620 463 764 704 1648 768 1235 1183 915 523 1417 75 758 442 1952 271 1018 947 659 320 1976 562 337 965 1184 35 1234 1609 664 1444 580 737 1331 720 1314 973 945 1890 1760 1986 210 567 186 12 1306 1774 224 1073 1885 314 641 1144 1524 446 1148 1576 859 1438 1991 343 89 1665 140 537 183 14...
output:
994118359072 2000 1 1145 974 1374 581 559 1997 1214 917 203 1212 374 68 396 250 577 272 1437 1617 220 982 804 183 1119 710 1471 565 1796 1761 1938 494 1646 861 1386 1657 1210 30 550 955 777 78 1451 387 713 928 431 833 759 95 179 990 1207 1503 457 785 1244 1770 889 1139 1342 1305 108 1249 1531 1373 1...
result:
ok correct!
Test #92:
score: 0
Accepted
time: 1ms
memory: 3828kb
input:
2000 3 574 1963 1305 849 1271 853 1365 1853 12 1402 1010 1462 1353 494 74 1688 1786 1435 405 1012 1229 924 1085 1565 713 1742 796 1929 1844 1725 801 79 1089 1137 1255 1331 1659 754 341 1929 1233 956 615 1455 1798 867 1105 1943 196 790 1357 678 1160 1797 1310 1963 857 792 35 1464 1576 1251 1628 913 1...
output:
1002312168974 2000 1 27 1959 307 1795 1885 1256 231 1317 1357 732 1255 1331 1218 1312 701 1726 465 1275 1154 711 1804 1710 184 222 14 1624 48 526 704 12 175 628 1341 149 376 1277 1222 1083 1103 249 817 1457 1402 990 41 724 1441 639 1877 90 397 925 332 926 1669 1941 211 1502 1888 540 511 1034 937 107...
result:
ok correct!
Test #93:
score: 0
Accepted
time: 2ms
memory: 3892kb
input:
2000 3 684 1375 1184 445 1723 1722 473 1351 1019 941 1595 1572 718 56 974 696 308 1015 650 1134 338 1313 210 277 1735 1134 1053 283 1112 1862 90 450 1762 1042 1903 1927 1472 337 312 1925 815 1234 1226 206 1371 994 108 1604 1249 674 1509 1501 1232 1669 1519 1474 1368 780 953 749 1201 1422 351 325 101...
output:
1000468940262 2000 1 224 241 911 427 1868 184 769 867 560 187 26 1096 204 557 1694 1587 1956 1589 1033 925 54 1582 1927 1510 568 66 1716 693 1447 485 659 1818 1767 318 1255 1347 1003 1321 1227 476 947 1465 271 835 3 98 543 1433 104 1151 1529 306 411 331 1839 781 1597 1876 433 521 852 240 408 525 172...
result:
ok correct!
Test #94:
score: 0
Accepted
time: 1ms
memory: 4128kb
input:
2000 3 1317 1228 1811 1659 491 1756 1622 1016 730 1196 873 59 1567 441 144 1469 1726 647 698 1631 1985 1711 1005 616 1286 964 1408 625 246 1404 125 1488 16 982 1576 1223 750 1845 1831 604 1502 458 1043 1552 1360 921 180 1800 266 1261 1021 1308 1421 625 99 403 891 1500 602 482 1520 610 486 1899 843 1...
output:
977343950277 2000 1 112 649 280 1250 707 1313 1964 1563 1947 272 844 1869 797 1248 319 119 1091 1928 39 1292 371 1554 720 1089 1512 390 1048 467 521 1825 898 1914 1904 286 823 1300 61 1417 1234 1684 1216 448 1642 581 1206 1855 694 402 1992 882 200 1709 460 1320 1877 880 1494 323 794 780 1392 1182 14...
result:
ok correct!
Test #95:
score: 0
Accepted
time: 1ms
memory: 4048kb
input:
2000 3 1188 1181 1574 1619 944 1974 626 789 1798 27 159 547 1759 1110 1304 1360 1172 997 1815 1043 1496 1948 1781 1513 1884 993 652 1079 1983 1436 88 1953 1221 174 383 1741 48 814 1532 1319 1039 1401 1737 1829 996 920 222 1902 590 1270 692 1504 1918 654 928 1602 208 1165 1251 1596 329 856 1068 577 2...
output:
985678197158 2000 1 219 1255 1104 463 1605 1175 381 130 439 1593 223 1428 116 373 1129 621 318 1105 1312 251 474 610 1498 84 786 1305 186 1617 1586 141 1574 59 477 264 1050 1911 243 236 1166 1262 165 660 2000 1293 1901 826 962 753 1999 362 71 1570 1809 882 558 876 1553 1721 536 1109 1756 625 1330 57...
result:
ok correct!
Test #96:
score: 0
Accepted
time: 1ms
memory: 3772kb
input:
2000 3 892 807 1866 64 123 674 1147 1184 1897 1873 385 1877 7 1697 1753 234 191 1453 625 850 91 1195 320 1560 1827 43 426 1801 1338 1775 55 1070 1138 127 627 1985 225 882 232 1144 124 1208 1665 54 819 898 1038 1676 1642 327 1827 1548 559 1243 69 854 1806 195 943 654 1426 905 691 1598 532 1304 235 53...
output:
1023444069399 2000 1 669 1447 1299 781 1519 4 1025 1356 1256 1830 1166 1544 1607 123 9 145 1861 391 880 515 1822 1865 1518 101 1439 1747 326 1978 1329 849 316 1336 1220 1934 1918 1957 1169 576 1652 1901 254 1250 1362 1815 253 1182 1979 1161 1225 650 648 1346 1659 296 1860 890 1778 28 144 572 1617 88...
result:
ok correct!
Test #97:
score: 0
Accepted
time: 1ms
memory: 3936kb
input:
2000 3 1367 159 1497 1532 1105 440 1955 1658 129 1964 272 956 1165 1745 625 1694 257 726 645 476 623 1098 648 303 665 847 1304 1665 307 926 319 1098 619 1582 1920 1770 874 1257 1443 815 121 578 1280 943 555 1602 1575 583 545 447 1708 1104 911 146 347 1466 1108 1412 1548 567 451 1182 1449 813 634 168...
output:
1010882805670 2000 1 700 1857 1119 1167 1706 1476 40 443 1660 884 227 1922 496 174 1545 1734 828 3 117 1895 1490 181 1635 839 1288 1760 241 554 1374 260 1656 1815 1821 970 724 1929 1444 1459 916 962 1301 1272 1305 992 666 296 1394 856 955 1483 341 652 1414 293 194 495 1540 743 1518 1893 1389 1191 48...
result:
ok correct!
Test #98:
score: 0
Accepted
time: 1ms
memory: 3840kb
input:
2000 3 1611 477 1551 698 1677 1706 712 1391 685 1755 1645 749 1510 671 1952 809 1398 368 213 1597 361 1006 651 971 437 409 1563 1815 704 16 42 404 930 26 1857 1089 1832 173 877 850 1876 1304 349 628 515 241 1700 787 1627 1311 1106 1040 1527 1685 591 1374 1350 359 240 359 456 1245 397 637 297 972 83 ...
output:
1014963178537 2000 1 1360 742 104 1241 1634 1458 504 1208 468 1897 27 1001 221 542 96 1195 1441 120 1438 612 1023 500 152 413 375 1045 190 560 78 301 427 1902 463 1670 1491 837 192 1081 1835 1513 9 938 1757 411 610 1480 1510 671 479 395 1268 1771 1798 260 1610 706 766 1731 188 1772 1361 77 1564 198 ...
result:
ok correct!
Test #99:
score: 0
Accepted
time: 1ms
memory: 3936kb
input:
2000 3 1595 236 1251 497 809 946 633 735 282 191 1643 1997 1563 640 366 1468 640 1510 1781 1617 1157 1659 535 1144 990 1887 687 1221 675 931 214 809 196 724 330 427 596 271 221 1994 947 841 520 640 1251 1215 1331 1042 640 149 1617 1887 202 1223 1400 1429 1127 898 106 1015 615 1707 968 1043 490 1299 ...
output:
1003217858982 2000 1 1074 1463 891 1532 379 1144 424 255 889 171 1551 960 738 1156 554 186 1072 1432 1183 602 546 279 522 596 1472 1462 478 1876 531 1621 575 1600 1127 898 756 504 837 1618 357 322 1169 1265 543 741 241 178 1355 1210 1088 1963 1948 61 1945 1915 370 1853 1910 1701 1508 1507 1738 1066 ...
result:
ok correct!
Test #100:
score: 0
Accepted
time: 0ms
memory: 3776kb
input:
2000 3 988 1 204 1 1 1855 1 226 26 1 1 1079 1 1825 572 1 50 1 1 1215 1 1532 1 1118 1 770 108 1 1 1207 1845 1 432 1 1369 1 1 879 1 203 460 1 154 1 135 1 492 1 1 873 1 1625 1212 1 1 107 1321 1 1818 1 1 292 1 1427 49 1 1 1233 1 1712 1579 1 418 1 1 793 1 1090 1 1842 1302 1 1 227 201 1 1 912 654 1 1 69 1...
output:
996901666648 2000 1 988 204 1855 226 26 1079 1825 572 50 1215 1532 1118 770 108 1207 1845 432 1369 879 203 460 154 135 492 873 1625 1212 107 1321 1818 292 1427 49 1233 1712 1579 418 793 1090 1842 1302 227 201 912 654 69 51 746 1953 354 1172 1656 896 1550 125 1729 297 1234 1940 1336 186 1515 14 1823 ...
result:
ok correct!
Test #101:
score: 0
Accepted
time: 1ms
memory: 4084kb
input:
1999 3 1773 1351 1 1076 1754 1646 1267 1 1157 983 1 978 1 1751 1392 1119 379 1 1 5 1 360 613 769 1 1472 1 1447 851 1 1867 1319 175 1 976 1 1760 1519 1 1718 1 1919 1 835 757 1060 1000 1 1331 1412 338 1 1341 11 1563 1415 1713 1127 772 477 1855 1 168 1248 600 1 335 1825 704 928 236 919 1815 1692 729 57...
output:
1997213132735 1999 1 842 1076 1719 1267 1100 978 1798 1751 1375 379 858 5 1110 360 746 1472 1475 1447 1621 851 216 175 1477 976 1602 1718 1018 1919 1282 835 637 1000 1796 338 532 1855 1770 600 1483 1592 1074 1869 49 1517 899 1874 1382 392 878 1935 856 85 1129 492 1309 953 1740 1205 1817 239 370 1009...
result:
ok correct!
Test #102:
score: 0
Accepted
time: 1ms
memory: 3832kb
input:
1997 3 1399 516 1 716 1426 1537 965 594 1856 855 1284 1479 1566 927 1454 1924 890 1748 84 1373 95 1672 185 1374 1 1082 34 1 211 782 1298 176 1310 776 1661 594 1931 428 980 916 693 1664 1598 91 981 1 30 1 536 121 154 1558 668 641 1637 1 777 13 302 673 889 360 1 1282 929 1 1035 204 1168 1923 190 151 8...
output:
1995219549052 1997 1 40 968 522 716 27 5 1350 1082 181 511 1600 34 1384 584 1055 981 1332 565 1451 30 1404 1484 933 1637 1977 65 680 1282 529 313 1010 929 954 887 18 1478 429 1004 451 996 477 1922 1708 1492 825 107 1379 873 679 385 1363 393 1711 1789 668 641 1299 250 1894 1495 1131 1160 1482 10 1375...
result:
ok correct!
Test #103:
score: 0
Accepted
time: 1ms
memory: 3844kb
input:
1936 3 341 1240 946 1597 1195 959 1733 1240 615 937 184 592 1258 1799 1601 1409 880 1258 91 1718 1417 1139 916 1592 184 911 1852 180 452 1793 803 1343 180 1895 575 1888 171 1778 1176 1912 1173 107 1173 372 1108 1094 1066 1293 1139 1561 771 1835 651 1675 1637 1675 41 1879 1396 771 1772 497 1687 752 1...
output:
959283331124 1936 1 994 461 722 1183 219 380 879 1366 486 1744 1517 856 962 1373 1758 1685 1215 1665 1539 168 1326 986 977 670 1111 1911 855 1149 522 1825 971 1167 1198 433 1000 1869 1320 65 371 112 1114 677 643 1793 452 1871 857 1927 1910 142 850 924 888 696 1452 1515 1885 1513 1790 324 182 774 866...
result:
ok correct!
Test #104:
score: 0
Accepted
time: 1ms
memory: 3968kb
input:
2000 3 1370 1319 6 1661 982 1460 654 816 1368 70 841 1391 332 1111 107 46 387 1390 928 196 369 1792 742 337 1906 1604 1278 672 154 1991 1518 308 849 846 705 158 1835 1612 780 1779 881 1867 597 1965 1956 409 1099 1242 828 1821 1662 344 760 1126 911 306 948 1909 1296 830 1642 892 516 1614 957 796 1038...
output:
2000000000000 2000 1 1699 152 1065 1008 155 1616 1486 1792 616 1577 945 383 525 444 690 1212 1542 1749 1436 876 1571 654 661 1267 898 1056 729 846 53 507 430 1433 1430 1923 586 937 454 1987 46 1609 1359 1982 1000 712 241 148 775 16 310 866 1150 713 1518 673 831 695 739 59 1856 1621 1579 208 596 1963...
result:
ok correct!
Test #105:
score: 0
Accepted
time: 1ms
memory: 3848kb
input:
2000 3 531 824 1828 527 489 1172 118 1355 370 562 1080 1962 535 1707 1302 1749 1996 347 424 1282 236 30 1937 1327 395 1060 672 1730 850 1700 19 1215 1989 1284 762 1946 646 1551 1478 249 446 1426 906 1103 1765 267 177 785 1231 699 410 415 1905 1059 1518 1948 219 987 825 1030 1812 995 1260 962 149 786...
output:
987613898700 2000 1 252 1554 139 1308 981 1492 859 1465 683 314 1456 554 1419 884 614 1412 396 459 117 1141 10 845 1644 107 592 201 781 106 1935 866 332 40 1553 335 1423 1962 1988 12 1460 544 1051 1718 39 1670 1732 1290 1529 496 1929 286 774 93 155 497 1688 1902 1279 1843 392 1854 316 787 999 1062 1...
result:
ok correct!
Subtask #6:
score: 5
Accepted
Dependency #5:
100%
Accepted
Test #106:
score: 5
Accepted
time: 105ms
memory: 28520kb
input:
200000 3 147012 182751 154277 181776 95094 76426 30313 86629 126223 49995 166060 157842 122541 40371 6521 182375 175030 110447 78367 175134 131250 97285 132337 99771 133031 2158 102720 163461 104670 46325 70722 156875 99733 7253 130400 31525 38020 23547 104556 120340 152061 174001 112957 138331 6972...
output:
99966483941576 200000 1 61981 96517 2100 7527 113272 43763 150352 99665 97539 80063 29048 18618 47712 53562 188072 60129 5812 156768 86008 139198 138204 57128 199314 50399 199648 80321 27375 131293 97915 154149 191410 6117 65011 160098 157480 166496 80288 72009 116176 81766 118629 167533 112321 1344...
result:
ok correct!
Test #107:
score: 0
Accepted
time: 92ms
memory: 28332kb
input:
200000 3 88318 81002 165280 125130 123213 158997 170916 134482 177516 24669 83023 47275 56744 198831 61378 114675 142731 71814 37961 109617 197131 149557 68375 143769 129315 188798 47241 2192 45374 89479 141586 98813 117482 28948 47723 198356 153753 15033 74174 89660 120110 20697 166201 153612 56703...
output:
100200484512997 200000 1 1618 42302 82162 27584 165183 60015 182279 142801 137049 70628 118993 72988 179334 113559 84740 188187 34904 126422 185238 18933 61519 115469 3638 79926 122564 132880 152822 5442 180885 123751 165926 149053 133121 167092 175573 5614 165640 132793 184160 128887 147357 153946 ...
result:
ok correct!
Test #108:
score: 0
Accepted
time: 102ms
memory: 28304kb
input:
200000 3 158080 150707 87713 27325 92660 116209 54409 23694 2943 189354 174240 164818 63040 89575 78660 136513 161745 60054 17228 137313 33135 77303 46614 163540 176388 144256 20069 160599 164840 98121 163973 193193 93832 65863 151238 29299 13510 176374 95565 29436 172499 151626 4052 2523 149429 151...
output:
99876819168945 200000 1 172557 99867 123803 1012 175494 113664 122505 57416 138454 52351 63429 153652 119428 15277 49156 185932 78719 191267 57281 77643 161552 109045 42586 69265 118099 189301 136285 1049 161361 143059 28284 179989 90170 27136 75909 10212 102539 117427 19447 66561 93874 140049 8275 ...
result:
ok correct!
Test #109:
score: 0
Accepted
time: 90ms
memory: 28388kb
input:
200000 3 13458 31389 54935 62559 19438 94761 190500 137721 133057 27282 118646 10976 158688 189150 50966 88936 64367 138380 1248 98893 70840 18433 7913 117595 102418 46367 54395 8227 170625 128662 95469 29899 156391 75448 147167 88351 146838 184391 77624 107403 24058 128408 178325 168636 48464 73268...
output:
99910494745784 200000 1 120139 54718 36377 15678 110982 191608 113834 171940 30292 182317 48930 21905 156330 66914 133152 51555 141189 12297 154405 12752 63830 119500 142315 2640 90881 157631 95499 178159 94076 189345 183457 154780 182337 73109 86888 85870 93878 7067 102594 136097 132906 118833 1590...
result:
ok correct!
Test #110:
score: 0
Accepted
time: 103ms
memory: 28384kb
input:
200000 3 57046 131800 29987 88605 171474 148623 99129 28902 45321 30680 75505 16586 12530 86028 120454 7164 33933 150164 82906 37260 121117 104053 192033 47278 37159 45570 153727 27709 16556 116173 105577 75450 55530 147064 27341 46913 36453 101815 29637 43794 123623 61867 3629 59534 75839 5762 3583...
output:
100006037268766 200000 1 153415 182427 38806 40756 126663 123143 92330 110831 78243 65925 164549 145166 84474 111593 46100 186162 89509 101398 19561 25178 185744 174988 101728 12609 26927 80194 57170 137826 100438 165487 75801 82856 141570 193654 25860 183048 68085 91428 13677 20664 80072 25594 8088...
result:
ok correct!
Test #111:
score: 0
Accepted
time: 115ms
memory: 28044kb
input:
200000 3 139477 43272 191114 76077 179020 189948 28137 1021 65951 108562 103570 145873 115851 178975 178592 72360 173350 154567 84335 161076 142716 153606 185307 176576 104994 143521 73511 116320 168667 92228 160372 179510 78166 57346 137423 155483 76454 179369 194690 69013 2700 101118 100200 94223 ...
output:
99890707584446 200000 1 130935 71778 20458 11895 30188 57067 170549 54517 124378 154676 161247 151883 4017 151253 12541 59363 154633 17703 175049 76027 6879 64910 62649 23086 173685 68419 78185 29393 78733 137017 110170 121575 175474 139523 91840 145676 144197 79811 169360 21111 195566 116864 103928...
result:
ok correct!
Test #112:
score: 0
Accepted
time: 85ms
memory: 28984kb
input:
200000 3 179253 61326 193064 25770 101250 104257 127308 168366 75652 156351 48789 45946 3246 138024 161405 143701 41976 91073 162591 27995 104694 9725 96951 60586 170891 35876 127049 121655 51111 162908 75978 187533 87785 85717 12359 132567 161307 112872 153158 48573 98012 48629 103902 196093 99788 ...
output:
99804652763041 200000 1 123524 49022 78090 157756 158751 162801 135568 124580 191430 54903 135001 70520 3003 112383 119369 144088 145726 17201 199628 137900 47622 121821 168535 685 20462 105161 157143 170466 121869 97487 76654 76919 34807 119508 150810 191363 169386 10641 15248 51662 161076 56757 10...
result:
ok correct!
Test #113:
score: 0
Accepted
time: 113ms
memory: 28264kb
input:
200000 3 62838 75939 87826 180015 72625 160066 31793 97154 87330 68381 163447 73473 12778 146477 175129 158989 171461 14472 86022 120141 194508 29080 158722 75883 50290 83476 106106 21819 178861 182937 166058 96930 179108 125006 199570 132827 170051 193208 121118 189720 86617 54823 184821 60430 8819...
output:
100006003713207 200000 1 108035 3447 13336 172366 19633 144122 74490 23805 30283 69160 64002 69980 131982 36484 7102 52461 104 41042 182351 116230 147086 130628 121858 170363 23164 68371 39369 176423 77525 64463 54231 122067 31234 25116 169559 132600 82046 100742 174870 130161 21 112819 151237 13595...
result:
ok correct!
Test #114:
score: 0
Accepted
time: 88ms
memory: 29144kb
input:
200000 3 153989 10517 27314 72036 93500 132724 93638 100042 192943 181118 59968 98240 154528 61181 20366 181919 7218 87940 38589 133947 154187 77410 116666 2957 70560 16300 128562 51840 109869 105397 60196 3012 161863 18667 36797 61682 180020 54807 127767 42942 90184 125480 96410 114460 178356 14309...
output:
100132596896132 200000 1 176997 183492 47162 104212 66389 139522 170106 59550 180780 183658 146492 124242 27450 110052 198442 177118 7430 159319 94758 19585 23444 101870 5166 199094 16017 137824 160929 41309 44809 162232 78685 188560 19219 176435 35241 176096 169923 101341 102269 160307 176771 12951...
result:
ok correct!
Test #115:
score: 0
Accepted
time: 102ms
memory: 28052kb
input:
200000 3 193823 30011 91709 11809 501 45254 82025 86617 184348 23880 103950 119507 37454 8974 174384 115451 23634 107320 97650 182412 42066 177636 111315 60332 130053 54528 1558 155819 7733 158979 164488 110559 46281 59042 72138 22510 13718 2327 133303 92964 105935 168350 39293 164483 15208 86000 84...
output:
99823050174586 200000 1 126235 76871 140207 45547 64424 36177 100789 34775 28417 55113 130212 121694 154722 175669 45995 32897 56636 31568 6680 10859 5927 169223 11756 166773 45408 45716 187788 151754 76653 39141 83020 14269 167257 124559 164978 197613 55483 38054 101797 149089 143536 84176 160041 1...
result:
ok correct!
Test #116:
score: 0
Accepted
time: 84ms
memory: 29380kb
input:
200000 3 167904 154479 99791 26520 66032 21354 89797 127514 81807 174766 2597 165492 80439 48156 101761 132200 96442 63449 199372 164659 160562 84653 92296 7081 71393 42324 196440 127414 61112 184736 80407 46397 193310 58007 189525 22158 112277 132008 187852 91575 33497 40060 121384 1910 174332 7252...
output:
100032502601811 200000 1 114247 114264 20546 83222 165313 137008 48520 79096 148580 133797 181357 31025 176710 123215 71912 129176 157470 130139 52491 15635 126467 28330 131998 97689 9795 87225 124064 185180 161564 88419 70568 144886 51202 57269 54503 15424 191767 163339 157523 102761 122717 34880 8...
result:
ok correct!
Test #117:
score: 0
Accepted
time: 60ms
memory: 29712kb
input:
200000 3 57696 1 1 118308 1 63302 143342 1 1 32977 169723 1 1 99113 1 20536 104991 1 1 176676 1 35771 1 199270 1 140871 1 71858 77751 1 133782 1 1 116525 63323 1 1 82450 125231 1 1 57698 1 192616 1 127854 168916 1 25125 1 73904 1 38396 1 1 4002 192295 1 150580 1 1 159320 1 62139 46661 1 1 150820 1 4...
output:
100188092398438 200000 1 57696 118308 63302 143342 32977 169723 99113 20536 104991 176676 35771 199270 140871 71858 77751 133782 116525 63323 82450 125231 57698 192616 127854 168916 25125 73904 38396 4002 192295 150580 159320 62139 46661 150820 44895 161850 81349 77478 196641 142082 54519 85648 1246...
result:
ok correct!
Test #118:
score: 0
Accepted
time: 79ms
memory: 27860kb
input:
199999 3 85151 130580 91456 1 1 126463 75828 52651 1 166438 97319 1 142822 72349 86125 191843 42036 15244 79975 99266 1 43347 1 136116 144573 104329 70554 1 154747 1 36845 1805 44410 1 182186 83316 155755 1 71223 129018 1 127862 1 78098 195817 18601 1 194275 1 85673 12603 92383 14771 191475 112155 1...
output:
199823206822200 199999 1 44657 91456 108452 126463 118937 166438 94576 97319 132319 43347 127963 136116 183123 70554 5003 154747 181730 44410 172396 155755 162404 127862 112742 78098 119131 194275 139728 85673 75012 112155 42969 121815 151737 179498 135199 75557 100511 100382 2682 86774 100921 18704...
result:
ok correct!
Test #119:
score: 0
Accepted
time: 81ms
memory: 28472kb
input:
199997 3 131613 140540 69978 138510 168678 157222 178811 3528 18491 28791 101558 152962 181277 930 134819 58137 2395 48734 147095 1 186977 95913 8298 1 179118 19885 27772 137115 62062 22064 27659 63226 91886 588 2211 1 1 2193 27574 1 96584 59043 46821 111679 6754 156644 140820 130625 114787 1 57183 ...
output:
199821436893275 199997 1 142331 176347 40782 147095 180790 146032 56817 8298 73637 180695 80154 2211 156535 94187 111989 2193 6555 186581 195744 27574 199314 101135 130951 114787 42143 64820 176865 17971 131214 82328 28292 197493 90998 60959 15050 1784 193506 167448 135194 159388 139318 195359 17431...
result:
ok correct!
Test #120:
score: 0
Accepted
time: 91ms
memory: 28900kb
input:
199809 3 94685 130894 41571 74291 26864 192447 123025 103411 12655 63756 121771 108019 65438 48656 176986 96765 10202 194287 108921 26742 51953 110771 87549 119680 133398 172870 85286 49434 144205 158162 157948 108072 59452 52518 103411 185204 170486 73773 140828 61920 160006 153902 186600 142638 33...
output:
100198293228920 199809 1 122999 116684 103487 148204 59979 78716 1619 50709 55070 64516 112066 74778 71377 131938 116500 76617 167243 82472 116632 23346 21087 63554 91451 196138 17649 103468 170708 74526 105991 48658 186702 52004 21277 146277 92266 148232 144837 126925 111604 176323 41254 186392 164...
result:
ok correct!
Test #121:
score: 0
Accepted
time: 161ms
memory: 42760kb
input:
200000 3 9586 193144 171563 40905 6622 65112 70106 27821 188019 98031 47484 179201 43370 65160 62820 27032 152546 143501 125446 69794 135672 118195 27893 16069 172623 134805 164806 148766 108617 14368 66935 108798 159549 983 14719 163836 173818 163624 24054 100996 151308 144701 130442 142208 142769 ...
output:
200000000000000 200000 1 4538 121952 179585 86793 149077 188525 103155 143762 89783 97753 192471 184882 142397 168109 178895 57407 103744 128769 118927 136732 64237 63338 47463 95403 1323 174747 122411 103074 127920 369 3539 115111 4291 116221 146572 91034 109240 106855 61817 85620 91238 146022 1632...
result:
ok correct!
Test #122:
score: 0
Accepted
time: 118ms
memory: 36508kb
input:
200000 3 5381 142906 195916 107149 28028 86513 140805 179412 120296 155640 88810 138241 67680 36075 18302 103548 197422 113736 107225 185275 96224 191998 71426 84989 148160 128735 7180 115757 72027 78126 132940 2260 68261 167840 11075 11586 136344 159122 71717 66896 3688 131894 188506 19576 177339 4...
output:
99938006915289 200000 1 34556 135207 2376 69269 148746 53259 27491 196612 44775 90763 103466 184158 42907 137009 127703 73659 112133 48472 143147 168822 86388 4314 153557 25845 75424 30013 91048 155556 108868 195837 17170 183880 106065 5101 161919 73021 31820 151047 171633 179397 159617 197234 11207...
result:
ok correct!
Test #123:
score: 0
Accepted
time: 103ms
memory: 33868kb
input:
200000 3 81359 23709 47617 60906 88252 102848 98019 112549 30197 80744 65659 97659 158878 19909 94219 11691 86418 94004 59681 135769 143977 151753 77274 138576 30461 150335 85619 146257 168877 47780 141821 36612 36628 12386 3027 198618 98013 74369 156285 199585 5968 75053 144088 37775 44797 3792 133...
output:
100070095386096 200000 1 118600 161437 82149 18430 76517 55602 61689 189414 2587 7312 122304 139855 68610 54103 152692 16166 33532 194737 9051 187102 117307 50107 82523 20655 84913 91836 59809 80279 31721 39276 65706 88058 58331 14722 118563 170165 152144 74221 59178 78019 65699 54946 194265 62094 7...
result:
ok correct!
Test #124:
score: 0
Accepted
time: 136ms
memory: 32708kb
input:
200000 3 44823 19469 157522 45675 35223 33063 48384 43574 153370 51203 50021 198093 2217 130181 148628 37413 65646 9542 12916 145699 99195 110491 55343 51767 71138 8376 188306 160428 198328 139379 70854 18315 48129 43378 142336 95958 25165 189153 174301 27234 184222 93794 179422 38902 76681 78714 11...
output:
100106249361173 200000 1 66109 156914 49344 68073 173750 766 107543 194409 8234 17970 198631 23825 49556 113369 58344 29523 199323 194653 182144 92516 22346 135751 34940 170504 154619 132830 199557 168819 147607 199751 58337 143991 158221 58803 104283 19331 169512 176556 84741 195592 185882 116803 8...
result:
ok correct!
Test #125:
score: 0
Accepted
time: 107ms
memory: 30748kb
input:
200000 3 66925 159827 183145 173667 142615 151805 40331 125850 86779 21981 193285 55703 16332 64097 128674 29528 54281 177585 19905 93782 8189 66728 71597 107045 32330 126864 156780 162970 13291 153811 79967 4617 56093 197260 58256 844 51390 86594 192713 154318 161746 34026 127522 198605 36672 18301...
output:
100002327466724 200000 1 110268 16264 182419 173228 93563 178228 10102 67468 117053 27170 115811 146327 60008 108858 174271 162200 174046 37632 192168 7723 101235 186710 185990 152665 67507 129019 194598 55025 63522 159331 107832 87246 28603 151036 196958 131212 69047 126678 84969 135933 119528 6110...
result:
ok correct!
Test #126:
score: 0
Accepted
time: 104ms
memory: 30052kb
input:
200000 3 50618 142550 5660 103232 108320 43974 83591 71194 150884 191741 143985 51298 153093 87002 46612 90512 140403 27213 68268 191693 192026 183039 4113 198531 149099 49121 21431 59973 76644 153024 66828 94440 178145 174081 162793 31269 101449 54928 110314 93043 58967 49470 136375 71440 174999 11...
output:
99965628723367 200000 1 83983 103766 108491 97802 113307 193488 92524 82909 119940 18411 1844 104013 178309 172611 83422 64686 103985 32804 130756 154223 171683 137771 196674 21068 29846 52556 7856 35649 199514 180012 37069 112383 57257 163081 126179 197591 35644 191542 48341 77451 157401 90393 1098...
result:
ok correct!
Test #127:
score: 0
Accepted
time: 55ms
memory: 28720kb
input:
200000 3 1 2 1 3 2 4 2 5 3 6 3 7 4 8 4 9 5 10 5 11 6 12 6 13 7 14 7 15 8 16 8 17 9 18 9 19 10 20 10 21 11 22 11 23 12 24 12 25 13 26 13 27 14 28 14 29 15 30 15 31 16 32 16 33 17 34 17 35 18 36 18 37 19 38 19 39 20 40 20 41 21 42 21 43 22 44 22 45 23 46 23 47 24 48 24 49 25 50 25 51 26 52 26 53 27 54...
output:
99887916695349 200000 1 5 21 85 341 1365 5461 21845 87381 174762 174763 87380 174760 174761 43690 87383 174766 174767 87382 174764 174765 43691 21844 87377 174754 174755 87376 174752 174753 43688 87379 174758 174759 87378 174756 174757 43689 10922 21847 87389 174778 174779 87388 174776 174777 43694 ...
result:
ok correct!
Test #128:
score: 0
Accepted
time: 65ms
memory: 28328kb
input:
200000 3 1 2 1 3 1 4 2 5 2 6 2 7 3 8 3 9 3 10 4 11 4 12 4 13 5 14 5 15 5 16 6 17 6 18 6 19 7 20 7 21 7 22 8 23 8 24 8 25 9 26 9 27 9 28 10 29 10 30 10 31 11 32 11 33 11 34 12 35 12 36 12 37 13 38 13 39 13 40 14 41 14 42 14 43 15 44 15 45 15 46 16 47 16 48 16 49 17 50 17 51 17 52 18 53 18 54 18 55 19...
output:
100298991530485 200000 1 7 61 547 4921 44287 132860 132861 132862 44286 132857 132858 132859 44285 132854 132855 132856 14762 44290 132869 132870 132871 44289 132866 132867 132868 44288 132863 132864 132865 14763 44293 132878 132879 132880 44292 132875 132876 132877 44291 132872 132873 132874 14764 ...
result:
ok correct!