QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#291059 | #2864. 切树游戏 | MoRanSky | 100 ✓ | 232ms | 181556kb | C++23 | 6.1kb | 2023-12-26 04:39:58 | 2023-12-26 04:39:59 |
Judging History
answer
// Skyqwq
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define mp make_pair
#define pb push_back
typedef long long LL;
typedef pair<int, int> PII;
template <typename T> void inline read(T &x) {
x = 0; int f = 1; char s = getchar();
while (s < '0' || s > '9') { if (s == '-') { f = -1; } s = getchar(); }
while (s >= '0' && s <= '9') x = x * 10 + (s ^ 48), s = getchar();
x *= f;
}
template <typename T> bool inline chkMin(T &x, T y) { return y < x ? x = y, 1 : 0; }
template <typename T> bool inline chkMax(T &x, T y) { return y > x ? x = y, 1 : 0; }
const int N = 3e4 + 5, M = 128, P = 10007;
int n, m, w[N], A[M];
vector<int> g[N];
int mod(int x) {
return x >= P ? x - P : x;
}
void add(int &x, int y) {
x += y;
if (x >= P) x -= P;
}
int inv2 = (P + 1) / 2;
void inline XOR(int a[], int o) {
for (int w = 1; w < m; w <<= 1)
for (int i = 0; i < m; i += (w << 1))
for (int j = 0; j < w; j++) {
int u = a[i + j], v = a[i + j + w];
a[i + j] = (u + v + P) * o % P;
a[i + j + w] = (u - v + P) * o % P;
}
}
struct E{
int w[M];
E inline operator + (const E &b) const {
E c; memset(c.w, 0, sizeof c.w);
for (int i = 0; i < m; i++)
c.w[i] = mod(w[i] + b.w[i]);
return c;
}
E inline operator - (const E &b) const {
E c; memset(c.w, 0, sizeof c.w);
for (int i = 0; i < m; i++)
c.w[i] = mod(w[i] - b.w[i] + P);
return c;
}
E inline operator * (const E &b) const {
E c; memset(c.w, 0, sizeof c.w);
for (int i = 0; i < m; i++)
c.w[i] = w[i] * b.w[i] % P;
return c;
}
void inline out() {
for (int i = 0; i < m; i++) cerr << w[i] << " ";
cout << endl;
}
E bh() {
E v;
for (int i = 0; i < m; i++) v.w[i] = w[i];
XOR(v.w, inv2);
return v;
}
void inline bhout() {
for (int i = 0; i < m; i++) A[i] = w[i];
XOR(A, inv2);
for (int i = 0; i < m; i++) cerr << A[i] << " ";
cerr << endl;
}
} dw, W[N], res, la[N], rel;
int fa[N], sz[N], son[N], d[N];
struct Mat{
E pr, sf, sm, ans;
Mat operator * (const Mat &b) const {
Mat c;
c.sm = sm * b.sm;
c.ans = ans + b.ans;
c.ans = c.ans + sf * b.pr;
c.pr = pr + sm * b.pr;
c.sf = b.sf + b.sm * sf;
return c;
}
};
void dfs1(int u) {
sz[u] = 1;
for (int v: g[u]) {
if (v == fa[u]) continue;
fa[v] = u;
d[v] = d[u] + 1;
dfs1(v);
sz[u] += sz[v];
if (sz[v] > sz[son[u]]) son[u] = v;
}
}
int len, b[N], val[N], rt[N], ps[N];
struct T{
int l, r, f;
Mat v, s;
} t[N << 1];
int inline getM(int x, int y) {
int mn = 2e9, p = -1;
for (int i = x; i <= y; i++)
if (chkMin(mn, max(val[i - 1] - val[x - 1], val[y] - val[i]))) p = i;
return p;
}
#define ls t[p].l
#define rs t[p].r
void pu(int p) {
if (ls && rs) t[p].s = t[ls].s * t[p].v * t[rs].s;
else if (ls) t[p].s = t[ls].s * t[p].v;
else if (rs) {
t[p].s = t[p].v * t[rs].s;
}
else t[p].s = t[p].v;
// cerr << " pu " << p << " ... " << ls << " " << rs << endl;
// if (p == 1) {
// t[p].v.ans.out();
// puts("haha");
// }
}
void inline bd(int &p, int l, int r, int F) {
if (l > r) return;
int mid = getM(l, r);
p = b[mid];
// cerr << p << " father is " << F << endl;
t[p].f = F;
bd(ls, l, mid - 1, p), bd(rs, mid + 1, r, p);
pu(p);
}
struct Te{
int l, r;
E v;
} te[N << 1];
int idt;
struct Lson{
int sz, rt;
void inline bd(int x) {
sz = x;
}
#define Ls te[p].l
#define Rs te[p].r
void inline pu(int p) {
te[p].v = te[Ls].v * te[Rs].v;
}
void chg(int &p, int l, int r, int x, E u) {
if (!p) p = ++idt;
if (l == r) {
for (int i = 0; i < m; i++) te[p].v.w[i] = mod(u.w[i] + 1);
return;
}
int mid = (l + r) >> 1;
if (x <= mid) chg(Ls, l, mid, x, u);
else chg(Rs, mid + 1, r, x, u);
pu(p);
}
void chg(int x, E u) {
chg(rt, 0, sz - 1, x, u);
}
E qry() {
if (!sz) return dw;
return te[rt].v;
}
} To[N];
int num[N];
void inline remake(int u) {
E o = To[u].qry() * W[u];
// cerr << u << " remake\n";
// for (int i = 0; i < m; i++) cerr << o.w[i] << " ";
// cout<< endl;
t[u].v.sf = t[u].v.pr = t[u].v.ans = t[u].v.sm = o;
// cerr << u << " rm " << G[u][0] << " " << G[u][1] << "awa?\n";
}
void gx(int v) {
res = res - la[v];
la[v] = t[rt[v]].s.ans;
res = res + la[v];
}
void inline updF(int v) {
assert(fa[v]);
To[fa[v]].chg(num[v], t[rt[v]].s.pr);
}
void inline bd(int tp) {
int x = tp; vector<int> z;
while (x) z.pb(x), x = son[x];
for (int u: z) {
int now = 0;
for (int v: g[u]) {
if (v == fa[u] || v == son[u]) continue;
bd(v);
num[v] = now;
++now;
}
To[u].bd(now);
for (int v: g[u]) {
if (v == fa[u] || v == son[u]) continue;
updF(v);
}
remake(u);
}
len = 0;
for (int v: z) b[++len] = v, val[len] = sz[v] - sz[son[v]]; //, cerr <<" " << v << "--";
// cerr << endl;
for (int i = 1; i <= len; i++) val[i] += val[i - 1];
bd(rt[tp], 1, len, 0);
ps[rt[tp]] = tp;
//t[rt[tp]].s.sm.bhout();
//cerr << tp << " ldwl\n";
gx(tp);
}
void bh(int x) {
for (int i = 0; i < m; i++) W[x].w[i] = 0;
W[x].w[w[x]] = 1;
XOR(W[x].w, 1);
// for (int i = 0; i < m; i++) cerr << W[x].w[i] << " ";
// cout << w[x] << " " << " v \n";
}
void inline sop(int x) {
while (x) {
remake(x); int p = x, y = 0;
while (p) y = ps[p], pu(p), p = t[p].f;
assert(y);
gx(y);
if (!fa[y]) break;
updF(y), x = fa[y];
}
}
char op[10];
int main() {
// freopen("4.in", "r", stdin);
read(n), read(m);
for (int i = 0; i < m; i++) dw.w[i] = 1;
for (int i = 1; i <= n; i++) read(w[i]), bh(i);
for (int i = 1, u, v; i < n; i++) {
read(u), read(v), g[u].pb(v), g[v].pb(u);
}
dfs1(1);
bd(1);
rel = res;
XOR(rel.w, inv2);
// for (int i = 0; i < m; i++) cout << rel.w[i] << " ";
// cout << endl;
int q; read(q);
while (q--) {
scanf("%s", op);
if (op[0] == 'Q') {
int k; read(k);
rel = res;
XOR(rel.w, inv2);
printf("%d\n", rel.w[k]);
} else {
int x, y; read(x), read(y);
w[x] = y;
bh(x);
sop(x);
}
}
return 0;
}
詳細信息
Test #1:
score: 5
Accepted
time: 3ms
memory: 23992kb
input:
2000 64 22 28 32 54 9 33 24 58 9 22 40 21 2 38 61 15 2 34 37 37 60 58 23 50 30 46 17 31 48 53 15 11 29 5 63 35 22 3 1 42 43 36 21 20 23 56 7 46 43 32 1 2 17 9 16 3 6 56 37 6 11 31 47 55 11 63 27 54 43 39 59 13 12 52 39 9 36 58 29 47 25 38 56 12 5 38 58 34 26 52 40 12 26 44 20 7 43 10 45 6 21 53 41 5...
output:
3926 3921 3971 3534 3881 3912 3613 3791 4109 3763 3710 3590 3761 3988 3572 3703 4098 3703 3753 3588 3756 3889 3598 3723 3935 3722 3778 3536 3731 3977 3549 3755 3915 3931 3545 3709 3922 3789 3718 3566 3735 3900 3514 3785 3890 3748 3737 3611 3738 3957 3549 3692 3903 3779 3758 3576 3711 3900 3548 3803 ...
result:
ok 64 lines
Test #2:
score: 5
Accepted
time: 4ms
memory: 21096kb
input:
2000 64 46 28 7 47 40 55 35 2 53 26 60 21 51 62 25 61 39 30 22 46 32 54 0 0 39 3 35 46 27 1 28 22 54 4 51 12 63 14 10 31 27 38 62 47 54 21 59 14 19 22 15 10 23 28 47 26 3 26 63 62 52 60 49 4 16 56 53 24 56 40 27 50 63 21 51 5 29 20 26 3 60 7 4 37 42 47 9 13 43 33 0 40 24 5 6 63 38 10 5 57 40 4 29 42...
output:
1685 2295 2052 1595 2204 1517 1268 1785 1890 2004 1929 1515 2095 1472 1277 1767 1395 1735 1877 1586 1780 1495 1544 2026 1394 1703 1982 1482 1898 1400 1697 2014 1711 1974 1978 1734 1861 1450 1396 1753 1560 2059 2035 1567 1960 1438 1471 1852 1330 1862 1835 1446 1853 1586 1531 1989 1422 1728 1971 1261 ...
result:
ok 64 lines
Test #3:
score: 5
Accepted
time: 7ms
memory: 26076kb
input:
2000 64 11 29 7 63 56 9 58 15 51 6 40 8 17 23 27 6 17 16 36 8 60 24 26 10 37 22 60 26 3 54 53 30 38 60 62 23 7 53 36 13 42 29 3 40 28 48 30 51 11 7 37 56 62 47 7 30 26 11 29 6 55 13 25 2 20 36 47 36 27 37 61 63 37 62 31 19 32 57 7 28 34 28 37 29 40 42 55 60 12 0 14 61 63 13 8 60 13 4 45 41 14 25 14 ...
output:
7242 7897 7980 7060 7601 7957 8083 7432 7814 7226 7067 7726 7968 7392 7418 8062 6576 7069 6969 6532 6260 6823 6762 6205 7162 6498 6642 7068 6899 6290 6282 6876 7448 7758 7793 7050 7357 7852 7973 7349 7773 7279 7158 7831 7899 7405 7421 7977 6320 7082 7003 6482 6299 6875 6757 6316 7106 6415 6534 7007 ...
result:
ok 64 lines
Test #4:
score: 5
Accepted
time: 0ms
memory: 25608kb
input:
2000 64 53 27 44 42 14 35 59 31 44 30 20 30 17 36 18 2 6 34 60 0 32 38 1 13 13 11 8 19 54 59 36 35 22 1 30 20 0 16 48 9 48 23 43 2 27 9 38 38 59 36 41 8 0 54 16 12 11 15 57 7 52 46 51 30 25 55 54 56 43 61 4 18 61 45 45 11 59 34 38 18 14 10 5 9 60 13 63 1 56 12 49 7 16 44 24 18 51 39 31 40 12 63 35 2...
output:
3788 3854 4227 4205 3967 3772 4233 4196 3836 3774 4152 4049 3796 3715 4161 4229 5693 5529 5575 5589 5055 5095 5710 5660 5481 5443 5558 5617 5051 4950 5634 5713 4342 4123 3687 3656 4228 4171 3709 3798 4130 4134 3724 3711 4108 4230 3848 3744 5488 5652 5559 5353 5651 5651 5044 5074 5643 5568 5432 5491 ...
result:
ok 64 lines
Test #5:
score: 5
Accepted
time: 147ms
memory: 151968kb
input:
30000 8 4 0 1 0 4 3 4 3 7 1 3 2 5 4 1 1 0 4 7 5 5 0 3 4 4 5 2 4 2 5 0 3 3 7 0 3 5 3 3 1 1 2 3 4 2 2 6 6 3 2 6 4 0 6 4 7 6 2 2 7 6 2 4 4 7 4 3 1 6 7 1 6 7 1 5 5 5 0 6 7 0 5 5 6 7 2 1 7 2 3 0 3 5 7 6 5 1 7 6 2 4 5 1 3 2 3 2 7 7 3 5 4 6 0 4 3 1 2 3 3 0 7 2 3 4 4 0 3 2 3 2 3 3 2 3 4 7 0 4 5 2 0 4 5 0 4 ...
output:
4073 6368 6368 48 8870 3067 412 2285 7762 3338 9435 6225 831 8860 5590 422 5378 8494 6365 2383 8494 4008 5632 2374 4614 308 2449 2339 4973 1843 1843 7090 2149 6773 1649 700 6950 5776 2348 916 8754 5344 7957 6235 5152 3991 8762 832 3627 6487 6196 7373 4708 8751 8616 1880 1880 7078 2365 2546 7652 9491...
result:
ok 19993 lines
Test #6:
score: 5
Accepted
time: 139ms
memory: 150500kb
input:
30000 8 7 5 1 6 6 1 7 4 0 0 3 7 3 2 2 5 1 7 6 4 3 2 5 4 3 5 6 1 5 4 2 7 3 6 6 5 7 3 7 2 6 5 5 2 5 2 7 6 4 3 5 2 3 0 2 2 4 6 3 5 5 4 4 1 3 2 6 3 3 7 2 1 0 2 1 3 1 6 0 6 1 1 1 5 3 2 7 5 0 3 7 1 5 5 3 0 0 3 1 5 6 5 0 4 6 0 3 7 5 3 3 7 2 6 7 5 4 0 3 4 3 0 5 4 1 3 2 3 4 7 0 1 2 6 2 0 7 7 6 2 6 6 5 4 0 6 ...
output:
8110 4669 3774 3008 8679 7405 8768 1894 7405 1627 2886 4023 102 6275 102 7682 6488 1609 7623 9120 4202 7967 781 3301 3301 2451 5644 8396 932 8221 7084 2535 7419 873 5679 9037 9028 291 1515 2829 5839 349 3316 349 5539 4132 4132 5874 4132 8533 5250 6771 2977 1199 2654 2045 2217 7959 7959 1612 1939 515...
result:
ok 19993 lines
Test #7:
score: 5
Accepted
time: 137ms
memory: 151296kb
input:
30000 8 4 3 2 5 2 2 7 6 1 2 1 3 1 4 1 3 7 2 1 4 1 3 5 5 7 3 1 3 0 7 7 6 1 3 2 0 5 6 5 5 3 1 3 0 7 6 5 7 1 0 4 3 4 6 5 6 0 7 6 2 3 2 2 2 6 0 0 6 2 4 4 1 7 1 4 5 3 6 1 2 0 2 1 6 6 2 3 6 3 1 5 3 0 2 1 2 0 6 2 5 3 4 3 2 4 4 1 7 5 7 3 1 5 6 3 2 1 5 1 1 0 7 2 7 6 4 0 0 2 0 5 0 6 2 0 3 0 1 0 2 3 1 0 5 5 0 ...
output:
1761 5276 5276 7688 305 4400 4400 8495 6150 475 7960 4190 4250 9493 9629 8661 103 2544 1114 2389 2546 2447 3419 1172 2957 989 6740 6273 1908 1466 3518 1236 4657 1862 7861 6572 3151 3458 4141 8629 9066 619 5841 7983 5611 5575 581 7710 2622 3831 4965 2296 877 749 5338 1540 1540 5728 8390 6432 3562 159...
result:
ok 19993 lines
Test #8:
score: 5
Accepted
time: 148ms
memory: 150608kb
input:
30000 8 1 3 7 6 6 0 0 2 4 0 0 1 5 0 6 5 2 3 2 2 7 4 5 2 7 7 1 3 3 6 6 5 2 7 2 2 4 0 1 1 2 0 4 7 1 2 3 6 7 0 1 4 3 7 7 2 1 1 3 4 4 2 7 6 0 7 1 7 4 4 3 3 6 4 5 3 3 5 3 1 7 1 6 2 3 2 0 3 7 7 1 5 0 7 7 7 1 2 0 2 3 1 0 4 4 4 1 2 1 1 4 2 2 6 1 2 4 7 6 4 2 0 1 0 5 4 5 5 3 0 0 7 4 4 5 6 5 5 2 6 1 3 2 1 1 6 ...
output:
3162 6252 5044 3893 5518 2902 7749 1351 1162 1162 4488 4315 1088 8240 7170 4577 7475 1509 1509 836 7372 7805 8868 668 5414 3867 5149 764 764 8538 8538 1060 7229 6651 2206 4324 3964 4969 4969 529 31 3591 5287 8099 1927 7160 8099 2522 5716 988 7264 2237 3035 3828 1733 3241 4630 1421 1723 2363 781 2804...
result:
ok 19993 lines
Test #9:
score: 5
Accepted
time: 232ms
memory: 151136kb
input:
30000 128 24 14 81 59 101 60 92 42 72 73 116 57 34 110 115 120 94 105 123 98 85 46 48 42 30 83 81 35 102 105 86 17 104 91 5 88 66 103 11 123 3 50 46 55 81 45 0 9 88 4 22 33 74 89 108 116 49 7 117 24 83 70 96 73 51 91 69 74 81 110 47 40 64 60 117 21 103 85 113 109 79 55 17 28 126 47 90 58 5 26 87 14 ...
output:
1650 2556 3659 9223 6038 636 3917 2775 2698 4868 3929 4972 1726 2799 9857 1037 4123 1780 5484 3351 4030 3967 3112 2250 1411 3423 985 4574 1609 1914 1321 4735 2849 7729 2707 2536 6585 3154 2124 5287 3728 6181 2640 856 3166 1533 5680 7705 8309 1241 4729 5421 9852 1970 2989 3525 769 4493 4405 3881 2885...
result:
ok 19993 lines
Test #10:
score: 5
Accepted
time: 231ms
memory: 148948kb
input:
30000 128 35 77 54 36 41 126 18 8 28 20 37 115 21 27 43 47 45 81 29 115 117 98 18 121 71 91 124 51 70 76 10 62 82 9 112 2 56 113 112 23 106 54 108 23 105 119 60 100 84 51 54 49 90 107 104 15 31 45 118 28 60 68 53 16 47 21 62 9 60 71 95 84 51 73 79 75 14 22 108 3 19 78 74 32 126 22 62 71 43 124 0 30 ...
output:
3153 5958 5958 1718 3624 5860 2653 5495 3561 3350 1242 2540 4817 5217 4566 995 4755 325 2573 5179 2601 4137 5260 3340 1846 3337 3773 2228 3217 8590 5349 1542 4300 3655 4659 1057 1117 4600 4837 4515 4589 2745 2984 2015 3692 1133 3571 4731 5299 3251 3649 2592 2784 3919 1881 4151 4477 697 4255 4627 375...
result:
ok 19993 lines
Test #11:
score: 5
Accepted
time: 123ms
memory: 170456kb
input:
30000 4 1 3 0 0 1 0 3 0 0 2 0 1 2 3 0 1 0 0 1 0 1 2 0 0 0 0 3 2 3 2 3 2 1 2 2 3 2 0 3 3 2 1 1 1 1 0 1 1 0 3 2 0 0 3 2 1 0 1 0 0 3 0 3 3 1 2 2 2 2 2 0 3 3 1 1 2 2 1 3 2 2 2 0 2 1 3 2 2 2 3 0 0 3 2 0 2 1 1 1 1 0 1 0 3 3 1 2 0 3 2 3 2 2 0 2 1 1 0 3 3 3 3 3 0 1 3 0 1 2 1 3 0 2 1 1 1 1 2 0 3 0 2 1 1 3 3 ...
output:
1645 2593 3204 1645 1349 1655 1353 1654 1354 1354 1654 1354 1654 1654 2590 3190 2594 1357 1650 3190 1650 3190 3190 2594 1650 3280 3280 1267 1267 3280 1267 1560 3280 4302 9949 4302 4902 4302 4302 4302 9948 9878 4916 9878 9639 9639 9878 9878 4372 9639 4916 4390 9621 9864 4930 4930 4392 9619 4930 9864 ...
result:
ok 19993 lines
Test #12:
score: 5
Accepted
time: 118ms
memory: 170816kb
input:
30000 4 0 0 1 3 3 2 3 1 3 0 2 2 3 2 0 0 0 3 3 3 3 1 0 0 3 0 3 0 1 3 2 2 0 0 1 3 0 1 2 1 1 0 2 0 2 2 2 2 3 0 2 3 2 0 2 3 1 2 1 0 0 0 1 3 0 1 1 2 1 1 1 2 3 0 2 2 0 2 1 2 1 0 0 2 2 3 0 0 3 3 0 2 2 2 0 1 2 1 0 2 1 2 3 2 1 1 2 3 1 2 0 2 0 0 3 2 3 2 3 1 0 0 3 1 3 2 1 0 3 1 2 0 3 3 0 1 3 2 1 2 2 2 2 3 0 1 ...
output:
8055 9995 8062 9995 7119 7120 7120 7120 7120 5147 5147 7120 5147 9982 5150 5 5165 5165 5 7 8051 7 7100 8057 8057 5157 7 7124 8033 23 7124 7076 8081 5188 5188 9983 5188 5188 8082 8082 7076 9982 9982 9982 5188 5340 9830 5340 8000 7158 8000 8000 8000 5340 5340 5340 5340 7158 5340 8000 7158 8000 9830 71...
result:
ok 19993 lines
Test #13:
score: 5
Accepted
time: 133ms
memory: 171140kb
input:
30000 4 0 0 3 1 1 3 0 2 0 2 1 1 3 2 1 3 0 1 0 1 3 1 2 3 3 0 3 2 1 2 3 2 3 1 2 1 3 3 3 0 0 1 3 1 2 3 3 3 2 0 0 0 3 1 0 3 0 1 1 0 3 1 2 1 3 0 0 0 0 2 1 1 0 3 2 0 2 3 3 3 3 0 2 1 2 2 1 3 2 3 3 3 0 1 2 2 3 2 1 0 3 3 0 1 0 2 0 1 3 0 1 0 0 0 3 2 2 1 2 0 2 3 3 1 1 3 1 0 2 1 2 2 0 1 3 0 2 2 2 1 2 0 1 2 0 2 ...
output:
9383 4073 7824 7824 9383 4710 7824 9383 4710 4710 7824 4711 4073 9383 4710 9381 7824 1189 2740 2741 702 702 1188 702 1345 1196 694 695 1196 1196 1338 2747 2747 695 2747 708 1350 2735 2735 1075 1451 1087 828 2622 1087 1087 828 828 1087 1428 839 839 2627 1025 896 1366 2689 896 896 1366 2689 896 1025 1...
result:
ok 19993 lines
Test #14:
score: 5
Accepted
time: 89ms
memory: 176924kb
input:
30000 4 0 1 0 1 3 0 2 3 1 1 1 1 0 1 3 2 3 3 1 2 3 0 0 2 0 2 1 3 3 2 2 0 1 1 2 2 2 0 2 1 2 2 3 2 3 2 0 1 0 1 0 3 0 3 0 2 3 0 0 3 3 0 0 0 3 1 2 1 1 1 1 2 0 3 0 1 1 3 0 3 3 0 3 3 0 3 3 0 0 2 1 3 1 2 0 3 1 2 2 1 0 3 0 1 1 3 0 3 0 2 3 1 2 1 3 3 0 0 2 3 3 3 1 3 0 0 0 0 2 1 1 2 2 1 2 2 3 0 1 2 3 3 2 0 3 0 ...
output:
9331 5467 9331 4870 9331 5467 5467 8975 9331 9331 4870 8975 9331 9331 9331 4870 8975 9331 4871 4871 4871 9332 4870 9334 4888 4896 4896 8963 5456 8963 5456 9328 8963 4896 5456 4896 8963 4921 5445 4921 5445 5445 4921 4921 5445 5445 4921 8939 4921 9340 8939 8939 9340 9340 5445 8939 9340 4919 8939 9339 ...
result:
ok 19993 lines
Test #15:
score: 5
Accepted
time: 88ms
memory: 177024kb
input:
30000 4 1 1 3 1 0 0 2 1 3 0 3 0 2 1 0 2 2 1 1 2 0 0 2 2 3 1 0 3 1 2 0 0 0 3 1 3 1 2 3 0 0 3 0 0 0 0 2 2 3 0 0 3 2 1 3 2 1 0 0 0 0 3 2 1 3 2 1 1 2 2 0 3 3 1 0 3 3 1 0 0 3 3 2 0 2 0 1 3 1 2 0 1 1 0 1 2 2 3 0 3 0 0 2 1 0 3 3 0 1 2 0 2 1 1 1 0 1 3 1 3 2 2 0 2 1 3 3 3 3 3 1 0 0 2 2 0 0 2 1 1 1 0 0 1 1 2 ...
output:
7588 4800 4800 4746 6883 5506 6882 6882 6882 6475 6475 4747 6883 5505 6883 6883 4747 4747 5505 6880 5508 6880 6478 6478 5508 6478 6478 6478 4744 5507 4745 5507 4745 4746 4746 6881 5506 4746 4746 5506 6477 5506 5506 6477 4746 6881 6881 6882 4746 5506 5506 6542 6816 6817 4887 6817 6817 6818 6818 4857 ...
result:
ok 19993 lines
Test #16:
score: 5
Accepted
time: 207ms
memory: 181296kb
input:
30000 128 36 19 121 28 96 113 59 94 39 101 47 34 56 86 82 88 98 10 10 110 61 86 61 45 59 9 113 44 18 112 77 79 3 71 34 72 62 76 91 67 89 88 11 28 51 120 25 22 86 49 82 107 118 39 99 102 100 24 49 79 23 118 61 110 101 101 66 16 47 21 106 58 17 54 110 102 22 52 85 40 48 25 64 97 11 113 123 111 9 111 3...
output:
6927 4221 5985 1834 1277 7789 1995 4920 4003 1269 8066 6179 6349 4870 5927 9227 5485 466 2931 1921 1630 3834 6432 2368 2655 968 4674 2252 4874 375 6097 8578 2663 1679 6567 9161 2247 7589 6996 9034 7556 5424 4539 9399 9660 2947 4516 4365 3784 5260 2583 7078 2747 3237 1515 4779 2788 9157 4772 1074 777...
result:
ok 19993 lines
Test #17:
score: 5
Accepted
time: 209ms
memory: 181344kb
input:
30000 128 5 118 100 119 118 37 44 3 102 77 102 64 58 65 70 2 3 40 18 66 81 114 64 57 122 55 90 41 29 112 104 6 87 25 20 125 33 77 61 117 57 16 27 32 58 50 110 115 94 88 75 39 121 64 125 33 111 16 51 59 32 112 82 54 4 82 54 97 22 67 28 101 78 117 41 122 7 125 59 71 71 61 62 86 83 85 68 111 9 17 106 6...
output:
7870 3095 9783 9760 4450 1348 3731 9156 5651 8792 1535 6166 2058 1223 1945 6115 6135 553 3125 9942 3495 1098 1098 8184 2079 6103 8186 1396 477 1468 2009 7754 6191 7407 2216 3458 732 8057 2047 5731 5522 8638 3183 8290 1256 1053 9761 9879 1426 6003 876 1405 904 8720 4095 3390 8845 8720 1197 58 5958 76...
result:
ok 19993 lines
Test #18:
score: 5
Accepted
time: 137ms
memory: 179112kb
input:
30000 128 59 24 4 95 47 19 58 33 54 96 10 86 53 101 111 31 32 100 75 117 126 51 16 31 98 126 82 105 102 71 1 58 99 45 126 33 126 115 36 6 93 63 65 110 25 11 50 23 56 37 86 11 64 27 83 90 110 78 22 78 22 111 32 0 34 86 63 34 12 29 119 108 64 106 6 31 84 112 92 46 60 47 116 11 91 43 98 109 93 70 68 66...
output:
6537 7133 7255 5036 9521 699 8957 3364 2754 5036 8431 1605 8601 7272 9578 4927 7312 4640 679 8632 223 8977 6067 8370 4324 2735 2735 4652 1223 8135 1841 581 9531 8113 9546 3258 5816 6399 889 9731 2192 7647 8091 3317 6770 3317 8402 6384 3559 9541 736 5685 5840 8801 9366 946 2680 558 5276 832 2016 207 ...
result:
ok 19993 lines
Test #19:
score: 5
Accepted
time: 135ms
memory: 181556kb
input:
30000 128 124 118 118 36 60 31 38 60 118 51 55 55 103 110 7 38 49 69 106 57 0 15 111 79 26 50 84 40 119 28 92 124 78 51 97 33 76 29 87 44 49 117 82 118 4 28 38 92 40 86 6 74 125 54 79 125 66 110 102 66 96 106 6 14 12 75 55 122 21 39 90 83 50 86 90 120 41 34 124 45 17 112 97 114 31 29 118 1 49 76 82 ...
output:
9314 6169 1042 9055 8042 4156 9445 5594 7244 9877 4824 9055 8916 7073 5370 7544 8916 8759 7078 7062 7736 6695 8771 8570 6231 478 5826 6789 6571 7730 5826 4531 7108 6028 2820 9367 5092 6190 7981 7609 8835 8072 7778 821 4609 8752 7395 8191 7373 5722 6828 7476 4872 5586 7539 478 8226 8177 8372 6981 869...
result:
ok 19993 lines
Test #20:
score: 5
Accepted
time: 127ms
memory: 177992kb
input:
30000 128 121 86 26 36 67 117 72 19 14 69 76 94 31 76 50 106 89 84 104 122 98 28 82 55 68 38 22 46 94 108 95 92 78 41 71 8 65 70 44 69 36 54 12 125 49 64 48 48 19 93 46 113 54 4 39 50 125 23 43 124 71 79 60 79 20 29 3 11 81 29 33 92 88 83 54 90 32 78 117 60 20 2 90 31 66 58 46 119 79 40 80 2 43 58 1...
output:
9130 9061 7961 3919 3090 1571 6960 2315 1742 2682 4877 8157 2028 1960 1431 567 8868 9397 3023 9516 7945 2678 1431 5819 9608 8749 4182 7247 3879 9071 4090 7247 459 1734 7281 2678 1431 9608 7201 9268 3115 1955 5004 9449 8566 3103 3042 4228 969 1097 2716 4133 8031 7191 6842 6276 8954 64 9388 9458 9811 ...
result:
ok 19993 lines