QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#323555 | #943. Dynamic Diameter | Camillus# | 7 | 898ms | 119960kb | C++20 | 6.1kb | 2024-02-10 00:42:00 | 2024-07-04 03:23:21 |
Judging History
answer
/// @author Camillus
#include "bits/stdc++.h"
using ll = long long;
using namespace std;
mt19937 rnd(228);
vector<pair<int, int>> g[100500];
int from[100500];
int to[100500];
ll w[100500];
int sz[100500];
bool mark[100500];
void dfs_sz(int u, int p = -1) {
sz[u] = 1;
for (auto [v, i] : g[u]) {
if (v != p && !mark[v]) {
dfs_sz(v, u);
sz[u] += sz[v];
}
}
}
namespace detail {
int component_size;
int level;
int centoid;
};
int get_centroid(int u, int p = -1) {
for (auto [v, i] : g[u]) {
if (v != p && !mark[v] && sz[v] * 2 > detail::component_size) {
return get_centroid(v, u);
}
}
return u;
}
int vertex_centroid[20][100500];
int tin[20][100500];
int tout[20][100500];
int timer[20];
namespace st {
static constexpr int size = 1 << 17;
struct node {
ll max = 0;
ll add = 0;
} tree[20][size * 2 - 1];
} // namespace st
struct segment_tree {
static constexpr int size = st::size;
st::node *tree;
segment_tree(int level) {
tree = st::tree[level];
}
inline void apply(int x, ll v) const {
tree[x].max += v;
tree[x].add += v;
}
inline void push(int x) const {
if (tree[x].add) {
apply(x * 2 + 1, tree[x].add);
apply(x * 2 + 2, tree[x].add);
tree[x].add = 0;
}
}
inline void pull(int x) const {
tree[x].max = max(tree[x * 2 + 1].max, tree[x * 2 + 2].max);
}
inline void set(int i, ll v) const {
int x = size + i - 1;
tree[x].max = v;
while (x) {
x = (x - 1) / 2;
pull(x);
}
}
void add(int l, int r, ll v, int x = 0, int lx = 0, int rx = size) const {
if (l >= rx || lx >= r) {
return;
}
if (l <= lx && rx <= r) {
apply(x, v);
return;
}
push(x);
add(l, r, v, x * 2 + 1, lx, (lx + rx) / 2);
add(l, r, v, x * 2 + 2, (lx + rx) / 2, rx);
pull(x);
}
ll get(int l, int r, int x = 0, int lx = 0, int rx = size) const {
if (l <= lx && rx <= r) {
return tree[x].max;
}
if (l >= rx || lx >= r) {
return 0;
}
push(x);
return max(
get(l, r, x * 2 + 1, lx, (lx + rx) / 2),
get(l, r, x * 2 + 2, (lx + rx) / 2, rx)
);
}
};
namespace st2 {
static constexpr int size = 1 << 17;
ll tree[size * 2 - 1];
void set(int i, ll v) {
int x = size + i - 1;
tree[x] = v;
while (x) {
x = (x - 1) / 2;
tree[x] = max(tree[x * 2 + 1], tree[x * 2 + 2]);
}
}
ll get() {
return tree[0];
}
};
vector<int> centoid_children[100500];
vector<ll> C1[100500];
multiset<ll, greater<ll>> C2[100500];
ll get_centroid_diameter(int u) {
if (C2[u].empty()) {
return 0;
} else if (C2[u].size() == 1) {
return C1[u].back();
} else {
return *C2[u].begin() + *next(C2[u].begin());
}
}
void update_cetroid_diameter(int u) {
st2::set(u, get_centroid_diameter(u));
}
void dfs_centroid(int u, int p = -1, ll d = 0) {
vertex_centroid[detail::level][u] = detail::centoid;
bool is_leaf = true;
for (auto [v, i] : g[u]) {
if (v != p && !mark[v]) {
dfs_centroid(v, u, d + w[i]);
if (is_leaf) {
tin[detail::level][u] = tin[detail::level][v];
}
tout[detail::level][u] = tout[detail::level][v];
is_leaf = false;
}
}
if (is_leaf) {
tin[detail::level][u] = timer[detail::level]++;
tout[detail::level][u] = timer[detail::level];
segment_tree(detail::level).set(tin[detail::level][u], d);
}
}
void dfs_main(int u, int l = 0) {
detail::level = l;
dfs_sz(u);
detail::component_size = sz[u];
u = get_centroid(u);
detail::centoid = u;
mark[u] = true;
dfs_centroid(u);
segment_tree ST(l);
for (auto [v, i] : g[u]) {
if (!mark[v]) {
C1[u].push_back(ST.get(tin[l][v], tout[l][v]));
C2[u].insert(C1[u].back());
centoid_children[u].push_back(v);
dfs_main(v, l + 1);
}
}
update_cetroid_diameter(u);
}
signed main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
int n, q;
cin >> n >> q;
ll W;
cin >> W;
for (int i = 0; i < n - 1; i++) {
int u, v;
cin >> u >> v >> w[i];
from[i] = u;
to[i] = v;
g[u].emplace_back(v, i);
g[v].emplace_back(u, i);
}
dfs_main(1);
ll last = 0;
while (q--) {
ll d, e;
cin >> d >> e;
d = (d + last) % (n - 1);
e = (e + last) % W;
int u = from[d];
int v = to[d];
for (int l = 0; l < 20; l++) {
if (!vertex_centroid[l][u] || vertex_centroid[l][u] != vertex_centroid[l][v]) {
break;
}
int c = vertex_centroid[l][u];
int L = max(tin[l][u], tin[l][v]);
int R = min(tout[l][u], tout[l][v]);
ll change = e - w[d];
w[d] = e;
segment_tree ST(l);
ST.add(L, R, change);
auto it = upper_bound(centoid_children[c].begin(), centoid_children[c].end(), L, [&l](int L, int u) -> bool {
return L < tin[l][u];
});
it = prev(it);
int i = it - centoid_children[c].begin();
int U = centoid_children[c][i];
C2[c].erase(C2[c].find(C1[c][i]));
C1[c][i] = ST.get(tin[l][U], tout[l][U]);
C2[c].insert(C1[c][i]);
update_cetroid_diameter(c);
}
last = st2::get();
cout << last << '\n';
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Subtask #1:
score: 0
Wrong Answer
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 36516kb
input:
10 100 10000 3 4 115 4 7 2757 1 5 5809 8 5 1111 6 2 7043 6 5 4932 6 4 4171 9 5 8499 10 5 2395 1 3517 8 7196 1 8064 6 7437 6 2421 8 67 7 6695 3 1217 1 920 1 1786 4 2541 5 266 4 6167 0 7590 6 195 8 4087 2 8073 6 8065 5 2882 2 3292 4 3435 6 8447 8 3419 0 9545 1 7922 0 4088 8 2546 4 7071 1 722 6 9178 0 ...
output:
21119 21746 23057 18619 18309 18309 19479 18309 19533 18309 18186 18262 19939 21768 20410 22382 20410 21356 17833 17119 13971 13971 13971 13971 13971 15449 16608 16608 15943 15943 15449 14859 16201 22716 22716 25710 25710 20420 20805 26368 25983 25983 26753 24373 23574 26266 17819 22705 26628 24360 ...
result:
wrong answer 21st lines differ - expected: '13244', found: '13971'
Subtask #2:
score: 0
Skipped
Dependency #1:
0%
Subtask #3:
score: 7
Accepted
Test #27:
score: 7
Accepted
time: 5ms
memory: 29520kb
input:
20 20 10000 1 2 835 1 3 57 1 4 1883 1 5 1349 1 6 1543 1 7 688 1 8 272 1 9 744 1 10 569 1 11 1019 1 12 201 1 13 1228 1 14 1194 1 15 1123 1 16 48 1 17 164 1 18 893 1 19 963 1 20 818 6 1 0 7412 10 6575 15 6696 0 7412 4 8318 18 7563 15 7502 1 7668 13 7859 14 8045 2 7969 12 8159 11 8040 2 8168 12 8192 0 ...
output:
3426 3426 3426 2892 2577 2577 2543 2472 2142 2142 2086 2018 1961 1961 1958 1653 1562 1432 1432 1064
result:
ok 20 lines
Test #28:
score: 0
Accepted
time: 0ms
memory: 27956kb
input:
20 200 10000 1 2 17 1 3 373 1 4 255 1 5 1243 1 6 468 1 7 1594 1 8 1375 1 9 383 1 10 36 1 11 1961 1 12 1816 1 13 1744 1 14 1611 1 15 1619 1 16 1620 1 17 144 1 18 1444 1 19 1129 1 20 1812 12 1 14 6239 16 6351 13 6228 17 6447 15 6815 10 6637 9 6762 4 6885 9 7217 18 7229 14 7381 8 7459 1 8746 18 9031 7 ...
output:
3777 3773 3773 3773 3556 3364 3239 3239 3064 2819 2687 2573 1597 1597 1757 1757 1096 851 756 776 776 776 1339 1339 776 759 759 746 746 746 624 501 416 364 805 364 270 189 112 111 107 107 1021 1620 1620 1190 360 191 121 107 103 78 172 77 588 791 588 948 509 166 729 863 1314 863 1228 863 863 774 762 7...
result:
ok 200 lines
Test #29:
score: 0
Accepted
time: 3ms
memory: 29860kb
input:
20 2000 10000 1 2 25 1 3 1900 1 4 1586 1 5 1319 1 6 219 1 7 1300 1 8 776 1 9 1051 1 10 362 1 11 1085 1 12 600 1 13 1576 1 14 315 1 15 1292 1 16 1167 1 17 1518 1 18 1911 1 19 1196 1 20 465 12 56 9 6271 1 6684 1 6622 6 6572 1 7038 3 6816 16 6979 4 8313 15 7409 5 7409 17 7710 10 7663 4 7957 17 7865 1 8...
output:
3811 3497 3487 3429 3230 3230 3211 2592 2592 2592 2496 2363 2252 2136 2136 1956 1505 1505 1267 1263 1173 1114 1630 934 1490 974 971 955 1421 955 378 470 470 728 470 378 371 1027 1190 543 534 301 301 292 290 1074 290 272 168 168 164 216 201 356 201 115 236 648 762 1241 1241 1206 1065 1500 1021 1249 8...
result:
ok 2000 lines
Test #30:
score: 0
Accepted
time: 11ms
memory: 26332kb
input:
20 20000 10000 1 2 1046 1 3 272 1 4 584 1 5 244 1 6 1124 1 7 1107 1 8 223 1 9 326 1 10 1816 1 11 891 1 12 1116 1 13 889 1 14 811 1 15 1377 1 16 636 1 17 69 1 18 1885 1 19 894 1 20 1613 2 267 12 6321 10 6503 10 6526 16 6628 14 6876 0 6939 14 7067 9 7348 6 7819 10 7891 11 7848 18 7848 1 8246 15 8316 9...
output:
3701 3498 3498 3498 3262 3262 3009 3009 2240 2223 2153 2153 1937 1780 1525 1246 1215 1527 910 882 861 424 869 869 1434 1011 424 547 547 525 691 525 384 361 286 240 477 465 210 192 186 368 1084 391 1184 1031 1374 652 309 555 484 1072 1487 1532 1597 1532 1532 1532 1487 1349 1007 913 415 413 390 215 17...
result:
ok 20000 lines
Test #31:
score: 0
Accepted
time: 48ms
memory: 28492kb
input:
20 100000 10000 1 2 499 1 3 916 1 4 1568 1 5 1135 1 6 136 1 7 1364 1 8 444 1 9 561 1 10 698 1 11 456 1 12 1543 1 13 1678 1 14 734 1 15 393 1 16 1768 1 17 1892 1 18 366 1 19 37 1 20 1051 6 354 11 6803 2 6437 6 6540 17 6688 5 6755 0 6860 11 7064 3 6998 2 7250 6 7399 1 7467 4 8496 13 9106 5 8569 2 8768...
output:
3660 3660 3570 3570 3246 3221 3042 3042 2813 2729 2594 1650 1432 1432 1259 1236 1197 1154 1064 1535 1203 1395 1203 1488 1488 1017 1132 1132 1017 1017 957 564 434 238 470 1110 1115 689 689 689 674 1180 1180 674 634 435 251 686 725 686 251 693 251 602 597 596 782 1242 1559 1265 782 1362 1420 1362 1362...
result:
ok 100000 lines
Test #32:
score: 0
Accepted
time: 3ms
memory: 29020kb
input:
2 10 10000 1 2 771 0 151 0 9855 0 9999 0 8476 0 1455 0 7763 0 3304 0 8286 0 2481 0 8467
output:
151 6 5 8481 9936 7699 1003 9289 1770 237
result:
ok 10 lines
Test #33:
score: 0
Accepted
time: 2ms
memory: 26184kb
input:
501 20 10000 1 2 1672 1 3 802 1 4 330 1 5 1394 1 6 1676 1 7 1751 1 8 417 1 9 1447 1 10 1736 1 11 956 1 12 224 1 13 203 1 14 1999 1 15 1385 1 16 1983 1 17 601 1 18 1800 1 19 1273 1 20 212 1 21 798 1 22 1535 1 23 669 1 24 1102 1 25 1117 1 26 563 1 27 1833 1 28 862 1 29 1243 1 30 1366 1 31 854 1 32 156...
output:
3989 3987 3986 3986 3986 3979 3979 3979 3974 3974 3968 3966 3966 3960 3954 3954 3952 3952 3952 3952
result:
ok 20 lines
Test #34:
score: 0
Accepted
time: 0ms
memory: 29052kb
input:
501 200 10000 1 2 392 1 3 9 1 4 1790 1 5 1700 1 6 321 1 7 1602 1 8 838 1 9 1217 1 10 1210 1 11 925 1 12 746 1 13 592 1 14 104 1 15 1647 1 16 1370 1 17 1827 1 18 709 1 19 1300 1 20 1659 1 21 590 1 22 1953 1 23 941 1 24 1653 1 25 1307 1 26 526 1 27 237 1 28 69 1 29 1993 1 30 947 1 31 396 1 32 1740 1 3...
output:
3989 3985 3985 3985 3985 3985 3980 3973 3973 3973 3970 3965 3965 3962 3948 3942 3942 3942 3942 3942 3936 3933 3933 3933 3924 3924 3924 3913 3887 3887 3887 3863 3863 3856 3856 3856 3855 3848 3848 3848 3848 3848 3845 3844 3844 3840 3840 3839 3839 3825 3821 3821 3811 3803 3803 3803 3802 3802 3796 3788 ...
result:
ok 200 lines
Test #35:
score: 0
Accepted
time: 4ms
memory: 29616kb
input:
501 2000 10000 1 2 178 1 3 1051 1 4 1631 1 5 1451 1 6 1282 1 7 1444 1 8 583 1 9 1321 1 10 1706 1 11 1108 1 12 279 1 13 573 1 14 1873 1 15 1931 1 16 1092 1 17 234 1 18 221 1 19 398 1 20 808 1 21 551 1 22 1274 1 23 982 1 24 242 1 25 1040 1 26 1018 1 27 577 1 28 451 1 29 1172 1 30 1088 1 31 1328 1 32 3...
output:
3981 3969 3968 3968 3967 3967 3964 3959 3956 3956 3951 3945 3945 3944 3938 3938 3935 3935 3931 3931 3931 3920 3920 3920 3920 3920 3910 3903 3903 3903 3903 3903 3899 3899 3893 3893 3893 3893 3893 3883 3883 3876 3875 3860 3860 3858 3858 3858 3857 3857 3857 3851 3841 3841 3838 3838 3829 3829 3829 3829 ...
result:
ok 2000 lines
Test #36:
score: 0
Accepted
time: 13ms
memory: 26248kb
input:
501 20000 10000 1 2 1385 1 3 510 1 4 1745 1 5 97 1 6 1133 1 7 1866 1 8 1058 1 9 1499 1 10 779 1 11 1822 1 12 476 1 13 1190 1 14 839 1 15 422 1 16 1534 1 17 39 1 18 56 1 19 37 1 20 1304 1 21 1161 1 22 1547 1 23 1533 1 24 1729 1 25 108 1 26 718 1 27 1784 1 28 1201 1 29 241 1 30 438 1 31 995 1 32 712 1...
output:
3994 3994 3991 3991 3991 3991 3991 3991 3986 3974 3974 3958 3958 3957 3957 3949 3949 3941 3939 3921 3921 3921 3921 3921 3906 3906 3903 3892 3887 3885 3885 3881 3881 3880 3880 3880 3880 3878 3878 3878 3873 3868 3868 3858 3841 3841 3841 3841 3837 3837 3832 3832 3832 3832 3813 3802 3802 3802 3802 3802 ...
result:
ok 20000 lines
Test #37:
score: 0
Accepted
time: 59ms
memory: 26480kb
input:
501 100000 10000 1 2 1459 1 3 960 1 4 1508 1 5 198 1 6 793 1 7 1364 1 8 1610 1 9 1201 1 10 721 1 11 840 1 12 539 1 13 1236 1 14 861 1 15 830 1 16 484 1 17 1610 1 18 272 1 19 381 1 20 1074 1 21 1921 1 22 1571 1 23 1709 1 24 408 1 25 1183 1 26 1380 1 27 1644 1 28 813 1 29 1498 1 30 1426 1 31 1276 1 32...
output:
3981 3981 3981 3981 3980 3961 3961 3959 3959 3957 3931 3931 3915 3910 3910 3910 3910 3908 3900 3900 3890 3889 3889 3882 3882 3882 3874 3874 3874 3874 3871 3868 3864 3861 3861 3855 3855 3854 3854 3854 3814 3814 3814 3814 3814 3808 3808 3808 3808 3794 3794 3779 3779 3748 3739 3739 3739 3737 3737 3737 ...
result:
ok 100000 lines
Test #38:
score: 0
Accepted
time: 0ms
memory: 27008kb
input:
5001 20 10000 1 2 1023 1 3 898 1 4 297 1 5 1041 1 6 145 1 7 543 1 8 111 1 9 1645 1 10 514 1 11 1671 1 12 1635 1 13 210 1 14 1820 1 15 311 1 16 811 1 17 373 1 18 1842 1 19 770 1 20 1106 1 21 418 1 22 168 1 23 524 1 24 950 1 25 1642 1 26 37 1 27 528 1 28 986 1 29 464 1 30 1448 1 31 364 1 32 982 1 33 1...
output:
4000 4000 3999 6886 6886 6886 6885 8630 5743 5742 3996 3996 3995 3994 3994 3994 5968 7835 5968 5968
result:
ok 20 lines
Test #39:
score: 0
Accepted
time: 4ms
memory: 29240kb
input:
5001 200 10000 1 2 1629 1 3 834 1 4 803 1 5 1119 1 6 1292 1 7 414 1 8 203 1 9 445 1 10 1644 1 11 1982 1 12 681 1 13 124 1 14 1135 1 15 671 1 16 64 1 17 1215 1 18 1594 1 19 1606 1 20 1545 1 21 314 1 22 1257 1 23 793 1 24 928 1 25 870 1 26 58 1 27 948 1 28 916 1 29 1937 1 30 126 1 31 1798 1 32 459 1 3...
output:
4000 4000 4000 4000 3999 3999 4182 3999 4033 5585 6502 4983 4033 4032 4032 3998 5276 5276 3998 5473 5473 5473 7954 6479 8685 6204 6203 6203 6203 6203 6203 7512 6203 8189 8189 6244 6203 7265 7265 7265 5058 5787 5787 4725 4725 4729 4725 5018 4725 4724 5148 4724 4723 4723 4723 3992 3991 4606 3991 3990 ...
result:
ok 200 lines
Test #40:
score: 0
Accepted
time: 3ms
memory: 29132kb
input:
5001 2000 10000 1 2 275 1 3 314 1 4 1278 1 5 1729 1 6 265 1 7 1139 1 8 782 1 9 291 1 10 821 1 11 518 1 12 93 1 13 202 1 14 1503 1 15 55 1 16 80 1 17 468 1 18 1525 1 19 1995 1 20 428 1 21 1376 1 22 426 1 23 830 1 24 255 1 25 1619 1 26 1009 1 27 702 1 28 376 1 29 150 1 30 1894 1 31 749 1 32 362 1 33 7...
output:
3999 3999 3999 3999 3999 3998 4952 4952 4952 4952 3998 5459 5800 6962 5842 5501 5501 3998 3998 3997 3997 3997 3996 3996 4685 4685 5240 5806 7048 5806 5240 6345 6211 4551 4734 4179 3996 4808 4808 4836 4836 4836 4836 4024 4024 6047 6047 6019 7327 7927 7212 5304 5302 5301 5301 6295 6295 6604 6604 7811 ...
result:
ok 2000 lines
Test #41:
score: 0
Accepted
time: 16ms
memory: 26968kb
input:
5001 20000 10000 1 2 1506 1 3 820 1 4 1164 1 5 1068 1 6 1945 1 7 527 1 8 1773 1 9 717 1 10 1836 1 11 1756 1 12 1304 1 13 221 1 14 1863 1 15 1820 1 16 410 1 17 220 1 18 554 1 19 1731 1 20 1028 1 21 465 1 22 695 1 23 1512 1 24 1995 1 25 343 1 26 1429 1 27 1335 1 28 1657 1 29 635 1 30 1328 1 31 226 1 3...
output:
4000 4000 4480 4480 4000 4000 4000 4000 4000 4000 5905 5905 4000 5035 6755 5035 4000 5785 4000 5504 6433 5504 6345 4841 5511 5511 6223 6223 6052 7200 7200 7200 6052 6052 7089 6052 6052 6346 5634 5038 4462 4450 4368 5908 5540 4000 4000 6635 8528 6635 6635 6635 3999 3998 3998 3997 3994 3992 3992 4716 ...
result:
ok 20000 lines
Test #42:
score: 0
Accepted
time: 73ms
memory: 26812kb
input:
5001 100000 10000 1 2 210 1 3 415 1 4 1274 1 5 989 1 6 1975 1 7 858 1 8 1684 1 9 1212 1 10 132 1 11 1950 1 12 1465 1 13 163 1 14 1689 1 15 602 1 16 718 1 17 402 1 18 461 1 19 1 1 20 1707 1 21 1777 1 22 715 1 23 426 1 24 1883 1 25 1174 1 26 16 1 27 161 1 28 1087 1 29 112 1 30 143 1 31 1317 1 32 1771 ...
output:
3999 4562 4671 5301 4848 6379 4848 4109 4538 4429 4429 3999 3997 5555 5554 8282 8282 5554 3996 3995 3995 3994 3994 3994 4795 4795 3993 3993 3993 3992 3992 3992 3991 3990 4192 4192 4192 4192 4192 4192 3990 4928 3990 4723 4723 4723 3990 3990 6056 3990 3990 7335 3990 3989 3989 3987 3986 3986 5168 5168 ...
result:
ok 100000 lines
Test #43:
score: 0
Accepted
time: 71ms
memory: 40464kb
input:
100000 20 10000 1 2 64 1 3 833 1 4 935 1 5 238 1 6 1902 1 7 321 1 8 1492 1 9 195 1 10 318 1 11 1579 1 12 897 1 13 840 1 14 896 1 15 1029 1 16 1747 1 17 1271 1 18 1977 1 19 1448 1 20 320 1 21 10 1 22 611 1 23 1765 1 24 275 1 25 818 1 26 1258 1 27 1724 1 28 172 1 29 1459 1 30 1792 1 31 547 1 32 558 1 ...
output:
4000 7977 7977 7977 7977 7977 4000 4000 4000 4000 11831 16066 8235 4000 4000 4000 4000 4000 4000 10747
result:
ok 20 lines
Test #44:
score: 0
Accepted
time: 66ms
memory: 44020kb
input:
100000 200 10000 1 2 1430 1 3 1072 1 4 1432 1 5 227 1 6 1304 1 7 1243 1 8 377 1 9 693 1 10 215 1 11 759 1 12 1287 1 13 1173 1 14 1679 1 15 883 1 16 1719 1 17 716 1 18 1489 1 19 785 1 20 70 1 21 1844 1 22 801 1 23 646 1 24 1601 1 25 925 1 26 585 1 27 187 1 28 1947 1 29 1052 1 30 165 1 31 1998 1 32 41...
output:
4000 4000 4000 6470 4000 7197 4000 4000 4000 8549 12069 8549 4000 4000 7704 11535 7704 7704 12142 8438 8438 13731 9293 13081 16766 13081 9293 4000 8528 8528 13865 9337 4000 4000 4000 11792 4000 4000 9725 15879 9725 4000 4000 10932 17338 10932 16773 16773 16724 17876 16736 10944 10944 4000 4000 4000 ...
result:
ok 200 lines
Test #45:
score: 0
Accepted
time: 63ms
memory: 40840kb
input:
100000 2000 10000 1 2 210 1 3 952 1 4 1579 1 5 1678 1 6 1852 1 7 519 1 8 1331 1 9 799 1 10 1625 1 11 1972 1 12 916 1 13 174 1 14 221 1 15 1695 1 16 274 1 17 603 1 18 396 1 19 1401 1 20 916 1 21 1627 1 22 1666 1 23 859 1 24 1943 1 25 439 1 26 204 1 27 1183 1 28 475 1 29 301 1 30 589 1 31 1621 1 32 18...
output:
7989 8377 7989 4000 4000 8967 4000 10886 12341 5455 5455 5455 12379 16835 16835 17381 17381 18622 18963 18963 19015 19015 18582 19122 19122 19122 19122 19727 19727 19727 19239 19187 19187 18459 18118 17738 17496 17214 17139 17139 16944 16478 16392 16249 16249 16098 17216 16098 15833 15718 15613 1768...
result:
ok 2000 lines
Test #46:
score: 0
Accepted
time: 94ms
memory: 42156kb
input:
100000 20000 10000 1 2 448 1 3 1449 1 4 1568 1 5 376 1 6 773 1 7 701 1 8 725 1 9 504 1 10 1910 1 11 170 1 12 1057 1 13 957 1 14 76 1 15 1475 1 16 1719 1 17 1922 1 18 1541 1 19 959 1 20 558 1 21 1817 1 22 547 1 23 777 1 24 50 1 25 1767 1 26 668 1 27 1854 1 28 68 1 29 163 1 30 1336 1 31 178 1 32 853 1...
output:
4692 4692 4692 4692 4000 5609 5609 5609 4000 4173 4173 4000 4000 4000 4000 6211 6211 6211 6211 4000 6529 6529 6529 4000 6809 6809 6809 9906 14221 17759 17759 17047 13020 9906 6809 11008 8199 12064 16027 17651 14022 17039 18448 18448 17039 15460 14022 16743 17482 17482 17798 17482 17482 18131 18676 1...
result:
ok 20000 lines
Test #47:
score: 0
Accepted
time: 200ms
memory: 42064kb
input:
100000 100000 10000 1 2 1360 1 3 316 1 4 1031 1 5 768 1 6 1164 1 7 111 1 8 192 1 9 1120 1 10 1394 1 11 1477 1 12 141 1 13 880 1 14 433 1 15 1500 1 16 1365 1 17 1785 1 18 571 1 19 1784 1 20 853 1 21 313 1 22 744 1 23 1410 1 24 1807 1 25 1073 1 26 498 1 27 964 1 28 1943 1 29 999 1 30 423 1 31 798 1 32...
output:
4000 4000 4000 4000 4479 4479 4000 5675 5675 5675 9824 15157 16514 17214 16514 15157 9824 8149 11776 14495 17805 15608 15086 19203 15086 7627 7627 12253 14489 14489 14489 14532 14489 13658 11422 15058 14890 14419 17275 14419 18328 14419 7156 7156 4000 10243 16084 17974 17976 17974 19483 17995 17593 ...
result:
ok 100000 lines
Subtask #4:
score: 0
Wrong Answer
Test #48:
score: 0
Wrong Answer
time: 12ms
memory: 63364kb
input:
1000 1000 10000 1 2 503 1 3 889 2 4 6 2 5 1468 3 6 102 3 7 464 4 8 658 4 9 1642 5 10 1956 5 11 420 6 12 1287 6 13 1051 7 14 48 7 15 678 8 16 1662 8 17 906 9 18 432 9 19 124 10 20 71 10 21 1624 11 22 268 11 23 1776 12 24 404 12 25 967 13 26 658 13 27 815 14 28 1196 14 29 1920 15 30 865 15 31 1227 16 ...
output:
24077 24129 24073 24255 24248 24175 24175 24175 23680 22461 22205 21721 21721 21710 21624 21372 21320 21300 21300 21300 21266 21204 21067 19936 19936 19936 19936 24987 24987 27150 27150 27395 27395 27395 29992 29992 29992 29992 29992 29992 29992 29992 29992 29992 29992 29992 29992 29992 29992 29992 ...
result:
wrong answer 24th lines differ - expected: '19844', found: '19936'
Subtask #5:
score: 0
Wrong Answer
Test #65:
score: 16.6667
Accepted
time: 869ms
memory: 116788kb
input:
100000 100000 20000000000000 36784 60773 140153248 61611 56014 4384507 39699 81699 3960320 64081 33880 136970044 38189 43550 67958946 16177 77482 151567728 90206 77109 108497900 42376 92541 75503161 10148 21587 195080992 11109 80580 11975495 8506 81405 144971319 85501 69547 59675956 72008 46890 3423...
output:
20075213641185 20075213641185 20075213641185 20075213641185 20075213641185 20075213641185 20075213641185 20075213641185 20075213641185 20075213641185 20075213641185 20075213641185 20075213641185 20075213641185 20075213641185 20075213641185 20075213641185 20075213641185 20075213641185 20075213641185 ...
result:
ok 100000 lines
Test #66:
score: -16.6667
Wrong Answer
time: 898ms
memory: 119960kb
input:
100000 100000 20000000000000 83246 45047 85765278 58645 15461 69329535 80366 26735 198967409 74006 76088 149781878 73707 62070 191884010 80303 46275 92792716 24142 22269 52567040 16571 49165 169517408 1913 33731 148017143 38712 36234 101256531 75509 45056 106023383 38787 16928 120431653 27021 40627 ...
output:
40071305542068 40071305542068 40071305542068 40071305542068 40071305542068 40071305542068 40071305542068 40071305542068 40071305542068 40071305542068 40071305542068 40071305542068 40071305542068 40071305542068 40071305542068 40071305542068 40071305542068 40071305542068 40071305542068 40071305542068 ...
result:
wrong answer 5199th lines differ - expected: '40070651761644', found: '40070666842791'
Subtask #6:
score: 0
Skipped
Dependency #1:
0%