QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#59798 | #1061. 染色 | oc | 100 ✓ | 26ms | 7516kb | C++14 | 6.6kb | 2022-11-01 15:07:55 | 2022-11-01 15:07:56 |
Judging History
answer
#include <cstring>
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <cctype>
#include <vector>
#include <queue>
#define fail(x) x?(puts("0"), exit(0)):void()
using namespace std;
typedef long long i64;
inline int read(int f = 1, int x = 0, char ch = ' ') {
while (!isdigit(ch = getchar()))
if (ch == '-')
f = -1;
while (isdigit(ch))
x = x * 10 + ch - '0', ch = getchar();
return f * x;
}
const int P = 1e9 + 9, N = 1e5 + 5;
i64 qpow(i64 a, int b) {
i64 c = 1;
for (; b; b >>= 1, a = a * a % P)
if (b & 1)
c = c * a % P;
return c;
}
int n, c, m, p[N], a[N], b[N];
i64 g[5][N], ans;
struct T {
int old, now, t[N];
i64 f[N], S, K, B;
i64 G(i64 x) {
return (K * x + B) % P;
}
void add(i64 v) {
++now, (S += v * c) %= P, (B += v) %= P;
}
void set(i64 v) {
++now, S = v * c % P, K = 1, B = 0, f[0] = v, old = now;
}
void mul(i64 v) {
if (v)
++now, S = S * v % P, K = K * v % P, B = B * v % P;
else
set(0);
}
void set(int p, i64 v) {
++now, (S += P - G(t[p] > old ? f[p] : f[0])) %= P, t[p] = now, (S += v) %= P, f[p] = (v + P - B) * qpow(K,
P - 2) % P;
}
i64 ask(int p) {
return G(t[p] > old ? f[p] : f[0]);
}
i64 ask() {
return S;
}
} t;
int main() {
n = read(), c = read(), t.set(0);
for (int i = 1; i <= n; ++i)
a[i] = read();
for (int i = 1; i <= n; ++i)
b[i] = read();
for (int i = 1; i <= n; ++i)
if (a[i] || b[i])
p[++m] = i, fail(a[i] && a[i] == b[i]), fail(a[i] && a[i] == a[i + 1]), fail(b[i] && b[i] == b[i + 1]);
if (!m)
return printf("%lld\n", c * (c - 1ll) % P * qpow(((c - 1ll) * (c - 2) + 1) % P, n - 1) % P), 0;
g[1][1] = g[3][1] = g[4][1] = 1;
for (int i = 1; i < n; ++i)
g[0][i + 1] = (g[1][i] + 2ll * (c - 2) * g[3][i] + (c - 2ll) * (c - 3) % P * g[4][i]) % P,
g[1][i + 1] = (g[0][i] + 2ll * (c - 2) * g[2][i] + (c - 2ll) * (c - 3) % P * g[4][i]) % P,
g[2][i + 1] = (g[1][i] + (c - 2ll) * g[2][i] + (2 * c - 5ll) * g[3][i] % P + (c - 3ll) *
(c - 3) % P * g[4][i]) % P,
g[3][i + 1] = (g[0][i] + (2 * c - 5ll) * g[2][i] + (c - 2ll) * g[3][i] % P + (c - 3ll) *
(c - 3) % P * g[4][i]) % P,
g[4][i + 1] = (g[0][i] + g[1][i] + 2 * (c - 3ll) * g[2][i] + 2 * (c - 3ll) * g[3][i] + ((c - 3ll) *
(c - 4) + 1) % P * g[4][i]) % P;
if (p[1] == 1)
if (a[1] && b[1])
t.set(b[1], 1);
else if (a[1])
t.set(1), t.set(a[1], 0);
else
t.set(1), t.set(b[1], 0);
else {
int u = p[1], w = (g[0][u - 1] + g[1][u - 1] + 2ll * (c - 2) * (g[2][u - 1] + g[3][u - 1]) + (c - 2ll) *
(c - 3) % P * g[4][u - 1]) % P;
if (a[u] && b[u])
t.set(b[u], w);
else if (a[u])
t.set(w), t.set(a[u], 0);
else
t.set(w), t.set(b[u], 0);
}
for (int i = 2; i <= m; ++i) {
i64 s = t.ask(), fu;
int w = p[i] - p[i - 1], u, v;
if (a[p[i]]) {
u = a[p[i]], fu = t.ask(u);
if (a[p[i - 1]]) {
v = a[p[i - 1]];
if (!b[p[i]]) {
if (u == v)
t.mul((g[0][w] - g[2][w] + P) % P), t.add(s * g[2][w] % P);
else
t.mul((g[2][w] - g[4][w] + P) % P), t.add((fu * g[3][w] + (s - fu + P)*g[4][w]) % P), t.set(v,
(fu * g[1][w] + (s - fu + P)*g[3][w]) % P);
} else {
int j = b[p[i]];
i64 fj = t.ask(j);
t.set(0);
if (u == v)
t.set(j, (fj * g[0][w] + (s - fj + P)*g[2][w]) % P);
else if (j == v)
t.set(j, (fu * g[1][w] + (s - fu + P)*g[3][w]) % P);
else
t.set(j, (fj * g[2][w] + fu * g[3][w] + (s - fj - fu + 2 * P)*g[4][w] % P) % P);
}
} else {
v = b[p[i - 1]];
if (!b[p[i]]) {
if (u == v)
t.mul((g[1][w] - g[3][w] + P) % P), t.add(s * g[3][w] % P);
else
t.mul((g[3][w] - g[4][w] + P) % P), t.add((fu * g[2][w] + (s - fu + P)*g[4][w]) % P), t.set(v,
(fu * g[0][w] + (s - fu + P)*g[2][w]) % P);
} else {
int j = b[p[i]];
i64 fj = t.ask(j);
t.set(0);
if (u == v)
t.set(j, (fj * g[1][w] + (s - fj + P)*g[3][w]) % P);
else if (j == v)
t.set(j, (fu * g[0][w] + (s - fu + P)*g[2][w]) % P);
else
t.set(j, (fu * g[2][w] + fj * g[3][w] + (s - fj - fu + 2 * P)*g[4][w] % P) % P);
}
}
} else {
u = b[p[i]], fu = t.ask(u);
if (a[p[i - 1]]) {
v = a[p[i - 1]];
if (u == v)
t.mul((g[1][w] - g[3][w] + P) % P), t.add(s * g[3][w] % P);
else
t.mul((g[3][w] - g[4][w] + P) % P), t.add((fu * g[2][w] + (s - fu + P)*g[4][w]) % P), t.set(v,
(fu * g[0][w] + (s - fu + P)*g[2][w]) % P);
} else {
v = b[p[i - 1]];
if (u == v)
t.mul((g[0][w] - g[2][w] + P) % P), t.add(s * g[2][w] % P);
else
t.mul((g[2][w] - g[4][w] + P) % P), t.add((fu * g[3][w] + (s - fu + P)*g[4][w]) % P), t.set(v,
(fu * g[1][w] + (s - fu + P)*g[3][w]) % P);
}
}
t.set(u, 0);
}
if (p[m] == n)
ans = t.ask();
else {
int u = n - p[m], w = (g[0][u] + g[1][u] + 2ll * (c - 2) * (g[2][u] + g[3][u]) + (c - 2ll) *
(c - 3) % P * g[4][u]) % P;
ans = t.ask() * w % P;
}
printf("%lld\n", ans);
return 0;
}
詳細信息
Subtask #1:
score: 44
Accepted
Test #1:
score: 44
Accepted
time: 1ms
memory: 2188kb
input:
10000 9973 2926 0 0 0 2176 0 0 0 0 0 0 0 0 0 0 0 0 5892 0 0 107 0 0 0 0 0 0 0 6953 0 0 0 0 0 2120 4802 0 0 0 0 0 0 0 0 0 0 0 6476 0 0 847 0 0 0 0 0 0 0 0 0 3336 0 0 0 0 0 0 0 0 0 0 0 0 5279 0 0 0 0 0 0 0 0 0 0 0 0 0 0 8435 0 0 0 0 0 0 0 0 0 2960 0 1565 0 0 0 742 0 1897 0 0 0 0 0 0 0 0 0 665 0 0 0 62...
output:
517694800
result:
ok single line: '517694800'
Test #2:
score: 0
Accepted
time: 3ms
memory: 2184kb
input:
10000 9967 3971 4199 4265 2901 0 0 7989 0 0 0 0 0 0 0 0 6112 0 0 0 0 0 0 0 0 2780 0 0 0 0 0 0 0 0 1818 0 0 0 0 0 0 0 0 0 0 4248 9857 0 0 0 0 4221 0 0 0 0 0 0 0 0 583 0 0 0 8748 4101 0 0 4735 0 0 0 0 0 1439 2549 0 0 0 0 0 0 0 7561 0 0 7522 0 0 0 0 8292 0 0 0 0 0 1149 0 0 0 5840 0 0 0 0 0 0 0 0 0 0 59...
output:
660134576
result:
ok single line: '660134576'
Test #3:
score: 0
Accepted
time: 0ms
memory: 2168kb
input:
10000 9949 2583 0 0 0 0 0 0 290 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 6489 0 0 0 7942 0 752 0 4993 0 0 0 0 0 0 0 0 0 0 0 0 4801 0 3582 0 0 0 0 9263 0 0 0 1086 0 0 0 0 0 0 0 0 0 0 0 0 0 8738 0 0 0 0 0 0 0 0 0 0 0 0 729 0 0 0 8085 0 7422 0 0 0 0 9462 0 0 0 0 0 0 0 6328 37 0 0 0 0 0 0 0 9...
output:
379398650
result:
ok single line: '379398650'
Test #4:
score: 0
Accepted
time: 1ms
memory: 2128kb
input:
10000 9941 1321 0 0 0 0 0 2682 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 6517 0 0 0 0 0 5016 0 0 0 0 8111 0 0 0 0 6278 0 0 0 0 0 0 0 0 0 0 0 0 6113 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 7472 0 9178 0 0 0 0 0 0 0 0 1742 0 7710 0 0 0 0 0 0 6760 200 0 0 0 0 8773 0 0 0 0 0 0 0 0 0 0 0 1300 0 0 0 0 0 2903 0 ...
output:
336132186
result:
ok single line: '336132186'
Test #5:
score: 0
Accepted
time: 1ms
memory: 2164kb
input:
10000 9931 2153 0 0 0 0 0 4461 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 4225 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 6072 0 0 0 0 0 8259 0 0 0 0 0 0 0 0 0 0 0 0 9341 0 0 0 9417 0 7681 3178 9725 0 0 0 0 0 0 0 0 0 5016 0 0 9282 0 0 0 8054 0 0 0 0 2156 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1943 0 0 5978 2492 0 0 0 97...
output:
779579773
result:
ok single line: '779579773'
Test #6:
score: 0
Accepted
time: 1ms
memory: 2144kb
input:
10000 9929 5447 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 5069 0 9494 0 0 0 0 9413 0 0 7771 0 0 0 0 0 0 0 0 189 9434 0 0 0 0 0 0 0 0 0 0 0 2606 0 0 0 0 0 0 0 0 0 0 0 0 3575 0 803 7312 8185 0 0 0 0 0 0 7496 0 0 0 0 0 0 0 0 0 6976 1013 0 0 0 0 3623 7520 0 0 0 4603 0 6479 0 0 0 0 0 0 0 0 0 0 0 0 9152 0...
output:
463819841
result:
ok single line: '463819841'
Test #7:
score: 0
Accepted
time: 1ms
memory: 2136kb
input:
10000 9923 904 1819 0 0 0 0 0 0 0 0 0 0 0 0 3348 0 0 0 0 8856 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 3855 0 0 0 0 0 0 0 5462 2713 0 0 0 0 0 0 0 0 5869 0 0 0 0 0 3992 0 0 0 0 0 0 0 0 0 0 3664 0 0 0 0 0 4234 0 0 0 0 0 0 1005 0 0 0 6784 0 2397 0 0 0 3119 0 0 0 5067 0 9095 4324 5097 0 0 0 0 0 0 0 0 0 0 0 1...
output:
37692735
result:
ok single line: '37692735'
Test #8:
score: 0
Accepted
time: 3ms
memory: 2132kb
input:
10000 9907 862 0 0 0 0 0 0 0 0 0 0 2363 4649 0 0 0 0 0 139 0 0 0 0 0 0 0 0 0 0 0 0 7768 8937 0 0 0 0 4055 0 0 0 0 1274 0 0 0 0 0 0 0 0 0 0 0 0 0 8418 0 0 0 0 0 0 0 0 0 0 0 0 9264 0 0 0 0 0 0 3391 0 925 0 0 0 0 0 0 0 0 0 0 0 0 0 9184 0 0 0 2485 0 2516 0 1621 0 0 0 704 0 0 0 0 0 0 0 2976 0 0 0 0 0 0 0...
output:
351922656
result:
ok single line: '351922656'
Test #9:
score: 0
Accepted
time: 3ms
memory: 2160kb
input:
10000 9901 9545 0 0 0 0 0 1147 9738 0 0 0 0 0 0 151 0 0 7629 0 0 0 0 1497 0 0 0 0 0 0 0 0 0 0 4547 0 0 0 0 0 8062 0 0 0 0 0 0 0 0 0 0 7209 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 9296 0 0 7832 0 0 0 7929 4254 0 0 0 0 9378 0 0 0 4234 0 0 0 0 0 0 0 0 0 0 2673 0 0 0 4862 0 0 0 0 0 0 0 0 0 799...
output:
683001523
result:
ok single line: '683001523'
Test #10:
score: 0
Accepted
time: 3ms
memory: 2160kb
input:
10000 9887 3001 0 0 0 0 122 0 0 0 0 0 0 0 0 0 0 0 0 0 9843 0 0 0 1723 0 6717 0 0 0 0 0 0 0 0 0 1493 0 0 0 0 0 0 0 0 2208 0 0 4879 0 0 0 7191 82 0 0 0 0 0 0 0 0 0 6192 0 0 0 0 9867 0 0 0 0 0 0 5657 0 0 0 0 0 0 0 0 0 1229 4256 0 0 188 0 0 0 0 0 0 0 6766 7290 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 6193 0 0 0 83...
output:
906121765
result:
ok single line: '906121765'
Test #11:
score: 0
Accepted
time: 3ms
memory: 2188kb
input:
10000 9883 8140 0 0 0 0 0 0 0 0 0 0 1329 0 0 0 4768 0 4925 108 0 0 0 0 0 0 0 0 9604 0 5870 4255 0 0 0 0 0 0 0 0 0 0 0 1807 0 0 0 0 5089 0 0 0 248 1892 0 0 0 0 0 0 3940 0 0 0 0 617 0 5924 0 0 0 0 0 0 0 0 6136 0 0 0 0 0 0 2211 4740 0 0 0 0 0 0 0 0 0 1770 0 0 0 0 0 0 5321 0 0 0 1131 0 0 2026 0 8214 173...
output:
861710884
result:
ok single line: '861710884'
Subtask #2:
score: 32
Accepted
Dependency #1:
100%
Accepted
Test #12:
score: 32
Accepted
time: 3ms
memory: 2180kb
input:
10000 9973 1553 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 4736 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 5331 2364 0 0 0 9824 0 0 0 6056 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 6868 0 0 7045 0 0 0 0 0 0 0 0 0 0 0 0 0 1531 0 0 4240 0 0 0 5287 0 0 0 0 0 0 7852 0 0 0 945...
output:
962033160
result:
ok single line: '962033160'
Test #13:
score: 0
Accepted
time: 0ms
memory: 1760kb
input:
10000 9967 0 0 0 0 0 0 0 0 0 0 0 9703 6206 0 171 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 9330 2459 0 0 0 2135 3538 0 0 0 0 0 0 0 0 7649 0 0 1867 0 0 0 0 0 0 0 0 0 0 0 0 1116 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 6494 2360 0 8811 0 1883 0 0 0 0 0 0 8462 0 0 0 0 0 0 3651 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2167 0 0 0 7371 ...
output:
0
result:
ok single line: '0'
Test #14:
score: 0
Accepted
time: 3ms
memory: 2172kb
input:
10000 9949 9132 0 0 0 0 0 0 0 0 817 0 0 0 0 0 0 9919 0 0 0 0 0 9585 6939 0 0 0 0 0 0 0 0 1298 0 7603 0 0 0 0 0 0 0 9070 2311 0 0 0 0 0 0 0 0 0 0 2235 0 8165 0 0 0 0 0 9930 0 0 0 0 0 8638 0 0 0 0 0 0 0 0 0 0 0 2260 6115 0 0 0 1098 0 4510 9753 0 0 1051 0 0 0 0 0 0 0 0 0 0 0 0 0 0 7216 0 0 0 1322 0 744...
output:
447371303
result:
ok single line: '447371303'
Test #15:
score: 0
Accepted
time: 3ms
memory: 2248kb
input:
10000 9941 7366 0 5716 0 0 0 3313 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 5032 0 0 0 9798 5273 0 0 0 0 0 0 0 0 0 0 0 0 0 0 7219 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 7601 0 5829 0 0 0 0 0 0 8965 0 1976 0 0 3206 0 0 0 0 671 0 0 6007 0 0 0 0 0 1387 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 532 0...
output:
261688908
result:
ok single line: '261688908'
Test #16:
score: 0
Accepted
time: 3ms
memory: 2144kb
input:
10000 9931 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 781 7289 3296 0 0 0 0 0 0 0 9404 0 0 5023 0 0 0 0 0 0 0 8172 0 0 5000 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 6920 0 0 0 0 5838 0 0 0 0 0 0 0 0 0 5885 0 9544 0 0 0 0 7872 0 0 0 0 0 1679 0 0 0 0 0 0 0 0 0 0 0 106 0 0 0 0 0 0 8737 0 5810 0 0 9649 0 0 0 0 48...
output:
874520150
result:
ok single line: '874520150'
Test #17:
score: 0
Accepted
time: 0ms
memory: 2168kb
input:
10000 9929 493 0 0 6598 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 6957 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 7714 0 9750 4820 0 0 0 8986 0 0 0 2028 8552 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2597 0 0 0 0 0 0 0 0 0 0 0 0 0 4825 0 0 0 0 2170 0 1920 0 0 0 0 4666 0 0 0 0 0 0 ...
output:
603051728
result:
ok single line: '603051728'
Test #18:
score: 0
Accepted
time: 1ms
memory: 2248kb
input:
10000 9923 4913 0 0 9854 0 0 1005 0 8129 0 0 0 0 0 0 0 0 0 0 7603 0 0 0 905 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 8808 0 0 0 0 6992 0 7080 3659 0 0 0 0 5751 0 0 0 0 0 0 0 0 1909 0 0 0 0 2734 0 0 0 0 0 0 0 0 3275 0 0 0 0 0 0 0 0 8357 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 272 0 0 0 0 0 0 3...
output:
629438343
result:
ok single line: '629438343'
Test #19:
score: 0
Accepted
time: 0ms
memory: 2144kb
input:
10000 9907 0 0 0 0 0 0 0 0 5990 0 0 0 0 0 0 0 0 0 0 0 5447 0 0 0 0 0 0 7249 0 0 0 0 1765 0 4833 0 0 0 0 4903 0 0 0 0 0 0 0 0 0 8088 0 3322 0 0 0 0 0 0 7429 0 0 0 0 0 0 0 0 0 0 0 0 0 0 267 0 0 1356 0 0 1503 0 0 7970 0 0 0 6280 0 0 0 0 0 0 0 0 0 0 0 2887 0 0 0 5546 0 0 495 0 0 0 0 0 0 0 0 7033 0 0 0 0...
output:
941054716
result:
ok single line: '941054716'
Subtask #3:
score: 12
Accepted
Dependency #1:
100%
Accepted
Dependency #2:
100%
Accepted
Test #20:
score: 12
Accepted
time: 1ms
memory: 2132kb
input:
10000 9973 3686 0 0 0 3249 0 0 5133 0 0 0 0 2398 0 0 0 0 0 0 0 0 0 9880 0 0 0 0 0 0 0 0 9308 0 0 0 0 0 0 0 0 3993 0 0 0 0 0 0 0 0 6815 0 0 0 0 0 0 0 0 0 0 0 4954 5602 0 0 1729 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 3673 0 5350 0 0 0 0 0 0 0 0 0 0 0 0 0 0 7890 0 0 0 0 0 0 4035 0 0 0 0 0 0 0 0 0 ...
output:
520486781
result:
ok single line: '520486781'
Test #21:
score: 0
Accepted
time: 3ms
memory: 2172kb
input:
10000 9967 0 0 0 0 0 3540 935 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1314 0 9498 0 0 0 0 0 0 726 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 6172 0 0 379 0 0 1547 1662 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 801 0 0 0 2046 0 0 0 0 0 0 0 0 3809 0 0 0 0 0 459 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0...
output:
284497295
result:
ok single line: '284497295'
Test #22:
score: 0
Accepted
time: 3ms
memory: 2136kb
input:
10000 9949 9744 8940 0 0 0 0 0 0 0 0 4050 0 0 0 0 0 4227 0 0 0 0 0 0 0 0 0 4661 0 0 8476 0 0 0 0 0 0 0 4126 0 0 0 0 0 0 0 0 1578 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 6673 0 6720 0 0 0 0 0 0 0 0 0 0 0 5794 0 0 0 0 0 0 0 0 3066 0 6066 0 0 0 0 261 0 0 0 0 0 3419 0 0 0 8772 0 0 0 0 0 3478...
output:
903227414
result:
ok single line: '903227414'
Subtask #4:
score: 8
Accepted
Dependency #1:
100%
Accepted
Dependency #2:
100%
Accepted
Dependency #3:
100%
Accepted
Test #23:
score: 8
Accepted
time: 3ms
memory: 2148kb
input:
10000 9973 0 8619 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 3627 0 0 5840 3918 0 0 0 0 0 1319 0 0 0 0 0 0 0 0 8317 0 0 0 0 0 0 3524 1297 0 0 0 4673 864 0 0 0 0 5895 0 0 0 0 0 0 0 0 0 0 0 0 4390 0 0 6610 5986 421 0 0 9554 0 0 0 0 0 0 0 0 0 959 9253 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 4154 0 0 0 0 0 0 0...
output:
68617449
result:
ok single line: '68617449'
Test #24:
score: 0
Accepted
time: 3ms
memory: 2248kb
input:
10000 9967 0 0 0 0 3774 6437 0 0 0 7697 0 0 1002 0 0 0 0 0 0 0 0 0 0 0 0 0 0 7923 0 0 0 0 0 0 0 0 0 0 0 0 0 8332 0 8498 0 0 0 0 0 5784 0 0 0 0 0 0 0 9633 0 0 0 2936 0 0 0 0 0 0 0 0 6963 0 0 0 0 0 5986 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 6017 0 3087 0 3972 0 0 0 0 0 0 7016 0 2393 0 0 6953 0 0 0 0 0 0 0 0...
output:
828095256
result:
ok single line: '828095256'
Subtask #5:
score: 4
Accepted
Dependency #1:
100%
Accepted
Dependency #2:
100%
Accepted
Dependency #3:
100%
Accepted
Dependency #4:
100%
Accepted
Test #25:
score: 4
Accepted
time: 26ms
memory: 7516kb
input:
100000 99817 0 0 0 0 0 0 0 0 32114 0 94022 0 74011 0 0 0 0 0 0 72729 43943 0 0 53641 0 0 93458 0 0 83410 0 0 0 0 36768 0 0 48557 0 0 0 56366 0 0 0 31003 0 0 0 0 0 0 0 0 0 4222 0 0 50438 0 0 0 0 0 0 0 0 0 64001 0 0 0 0 0 0 0 0 0 0 0 5186 0 0 14559 0 0 0 0 0 0 61305 0 55342 0 60870 65953 0 0 0 0 30398...
output:
82362512
result:
ok single line: '82362512'