QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#411611 | #8647. JOI Tour | oscaryang | 6 | 196ms | 72920kb | C++20 | 5.2kb | 2024-05-15 16:36:34 | 2024-05-15 16:36:35 |
Judging History
answer
#include "joitour.h"
#include<bits/stdc++.h>
#define ll long long
#define vc vector
#define pb emplace_back
#define pii pair<int, int>
#define mkp make_pair
#define rep(i, a, b) for(int i = (a); i <= (b); ++i)
#define lep(i, a, b) for(int i = (a); i >= (b); --i)
using namespace std;
mt19937 gen(time(0));
const int N = 2e5 + 5;
int n, a[N];
ll c0, c2, sum, sum0, sum2, f[N], g[N];
int le[N], ri[N], fa[N], dep[N], sz[N], top[N], son[N], dfn[N], idf[N], DFN;
vc <int> G[N];
struct bit {
int tre[N];
inline int lb (int x) { return x & - x; }
inline void add (int p, int v) { while (p <= n) tre[p] += v, p += lb (p); }
inline int ask (int p) { int res = 0; while (p) res += tre[p], p -= lb (p); return res; }
inline ll sz (int x) { return x ? ask (ri[x]) - ask (le[x] - 1) : 0; }
inline void clear () { rep (i, 0, n) tre[i] = 0; }
} C0, C2, S0, S2;
namespace sgt {
ll t0[N << 2], t2[N << 2], cnt[N << 2], ad0[N << 2], ad2[N << 2];
#define mid (l + r >> 1)
#define ls (k << 1)
#define rs (k << 1 | 1)
inline void psu (int k) {
t0[k] = t0[ls] + t0[rs];
t2[k] = t2[ls] + t2[rs];
cnt[k] = cnt[ls] + cnt[rs];
}
inline void ps (int k, int a0, int a2) {
t0[k] += a0 * cnt[k]; ad0[k] += a0;
t2[k] += a2 * cnt[k]; ad2[k] += a2;
}
inline void psd (int k) {
if (ad0[k] || ad2[k])
ps (ls, ad0[k], ad2[k]), ps (rs, ad0[k], ad2[k]);
ad0[k] = ad2[k] = 0;
}
inline void ins (int k, int l, int r, int p, ll v0, ll v2, ll v) {
// if (p == dfn[2]) cerr << "sgt " << v0 << " " << v2 << " " << v << endl;
if (l == r) return t0[k] += v * v0, t2[k] += v * v2, cnt[k] += v, void (); psd (k);
return (p <= mid ? ins (ls, l, mid, p, v0, v2, v) : ins (rs, mid + 1, r, p, v0, v2, v)), psu (k);
}
inline void modify (int k, int l, int r, int L, int R, ll v0, ll v2) {
if (L > R || L > r || R < l) return ;
if (L <= l && R >= r) return ps (k, v0, v2); psd (k);
modify (ls, l, mid, L, R, v0, v2); modify (rs, mid + 1, r, L, R, v0, v2); psd (k);
}
inline ll ask0 (int k, int l, int r, int L, int R) {
if (L > R || L > r || R < l) return 0;
if (L <= l && R >= r) return t0[k]; psd (k);
return ask0 (ls, l, mid, L, R) + ask0 (rs, mid + 1, r, L, R);
}
inline ll ask2 (int k, int l, int r, int L, int R) {
if (L > R || L > r || R < l) return 0;
if (L <= l && R >= r) return t2[k]; psd (k);
return ask2 (ls, l, mid, L, R) + ask2 (rs, mid + 1, r, L, R);
}
#undef mid
#undef ls
#undef rs
}
using namespace sgt;
inline void add0 (int x, int v) {
c0 += v; sum0 += v * S0.ask (dfn[x]); C0.add (dfn[x], v);
for (; x; x = fa[x]) {
sum += v * ask2 (1, 1, n, dfn[top[x]], dfn[x]);
modify (1, 1, n, dfn[top[x]], dfn[x], v, 0);
if (a[fa[x = top[x]]] == 1) sum -= g[x];
f[fa[x]] -= g[x]; g[x] = C0.sz (x) * C2.sz (x); f[fa[x]] += g[x];
if (a[fa[x]] == 1) sum += g[x];
}
}
inline void add2 (int x, int v) {
c2 += v; sum2 += v * S2.ask (dfn[x]); C2.add (dfn[x], v);
for (; x; x = fa[x]) {
sum += v * ask0 (1, 1, n, dfn[top[x]], dfn[x]);
modify (1, 1, n, dfn[top[x]], dfn[x], 0, v);
if (a[fa[x = top[x]]] == 1) sum -= g[x];
f[fa[x]] -= g[x]; g[x] = C0.sz (x) * C2.sz (x); f[fa[x]] += g[x];
if (a[fa[x]] == 1) sum += g[x];
}
}
inline void add1 (int x, int v) {
S0.add (le[x], v); S0.add (ri[x] + 1, - v);
S2.add (le[x], v); S2.add (ri[x] + 1, - v);
sum += v * ( C0.sz (x) * C2.sz (x) + C0.sz (son[x]) * C2.sz (son[x]) + f[x] );
sum0 += v * C0.sz (x);
sum2 += v * C2.sz (x);
// if (x == 2) cerr << v << " " << C0.sz (x) << " " << C2.sz (x) << endl;
ins (1, 1, n, dfn[x], C0.sz (x), C2.sz (x), v);
// cerr << "debug " << ask0 (1, 1, n, dfn[2], dfn[2]) << endl;
if (son[x]) ins (1, 1, n, dfn[x] + 1, C0.sz (son[x]), C2.sz (son[x]), v);
}
inline void dfs1 (int x) {
sz[x] = 1;
for (auto y : G[x]) if (y != fa[x]) {
fa[y] = x; dep[y] = dep[x] + 1; dfs1 (y); sz[x] += sz[y];
son[x] = sz[y] > sz[son[x]] ? y : son[x];
}
}
inline void dfs2 (int x, int t) {
top[x] = t; dfn[x] = le[x] = ++ DFN; idf[DFN] = x;
if (son[x]) dfs2 (son[x], t);
for (auto y : G[x]) if (y != fa[x] && y != son[x]) dfs2 (y, y);
ri[x] = DFN;
}
inline void dfs (int x) {
for (auto y : G[x]) if (y != fa[x]) {
dfs (y);
if (y != son[x]) f[x] += (g[y] = C0.sz (y) * C2.sz (y));
}
if (a[x] == 1) add1 (x, 1);
}
void init(int N, std::vector<int> F, std::vector<int> U, std::vector<int> V, int Q) {
n = N;
rep (i, 1, n) a[i] = F[i - 1];
auto add = [&] (int x, int y) { G[x].pb (y); G[y].pb (x); } ;
rep (i, 0, n - 2) add (U[i] + 1, V[i] + 1);
dep[1] = 1; dfs1 (1); dfs2 (1, 1);
rep (i, 1, n)
if (a[i] == 0) ++ c0, C0.add (dfn[i], 1);
else if (a[i] == 2) ++ c2, C2.add (dfn[i], 1);
dfs (1);
// cerr << "init finished " << sum << endl;
}
void change(int X, int Y) {
// cerr << "debug " << ask0 (1, 1, n, dfn[2], dfn[2]) << endl;
int x = ++ X;
if (a[x] == 0) add0 (x, - 1);
if (a[x] == 1) add1 (x, - 1);
if (a[x] == 2) add2 (x, - 1);
a[x] = Y;
if (a[x] == 0) add0 (x, 1);
if (a[x] == 1) add1 (x, 1);
if (a[x] == 2) add2 (x, 1);
}
long long num_tours() {
// cerr << c0 << " " << c2 << " " << sum0 << " " << sum2 << " " << sum << endl;
return c0 * sum2 + c2 * sum0 - sum;
}
Details
Tip: Click on the bar to expand more detailed information
Subtask #1:
score: 0
Wrong Answer
Test #1:
score: 0
Wrong Answer
time: 5ms
memory: 18644kb
input:
400 1 1 0 2 2 0 2 1 1 1 1 0 1 2 2 2 2 0 0 2 0 2 0 2 1 1 2 2 1 2 1 0 1 2 2 2 0 0 0 2 1 2 2 0 0 0 1 2 1 1 0 1 1 2 1 2 2 2 1 1 0 1 1 1 2 2 1 1 0 0 1 1 0 0 1 1 1 2 2 2 1 1 2 1 1 1 0 2 0 2 1 0 1 1 2 0 0 2 1 0 2 2 1 0 0 0 0 1 1 1 0 1 2 1 1 1 2 0 2 2 0 2 0 1 0 1 1 1 1 0 1 1 0 0 0 2 2 0 2 2 2 1 1 0 1 2 0 1 ...
output:
597892 604453 604236 600488 597994 594415 593637 586022 582362 581710 586811 587911 591333 592070 589195 587713 591638 595664 591752 591557 593779 592109 587398 583081 582206 580761 576441 577751 579635 578443 577990 577004 577636 583958 591593 594535 591305 590293 583567 582543 581005 585820 587518...
result:
wrong answer
Subtask #2:
score: 0
Skipped
Dependency #1:
0%
Subtask #3:
score: 6
Accepted
Test #11:
score: 6
Accepted
time: 163ms
memory: 67144kb
input:
200000 0 2 2 0 2 2 0 1 1 0 2 2 0 1 2 2 0 1 0 2 1 1 0 1 0 2 0 2 0 0 0 1 0 0 2 0 2 1 0 0 1 1 1 0 0 2 1 2 2 1 0 2 2 2 0 2 2 1 2 0 1 0 0 1 2 0 0 2 1 1 1 0 1 1 1 2 1 0 1 1 0 1 2 2 2 0 1 0 1 1 0 2 0 1 0 2 0 0 2 2 2 2 2 0 0 2 1 2 2 1 2 0 1 1 1 1 1 0 2 0 2 0 1 1 1 0 1 0 2 1 2 0 1 1 0 2 1 2 2 2 0 0 2 2 2 0 1...
output:
77241161705660
result:
ok
Test #12:
score: 0
Accepted
time: 177ms
memory: 68248kb
input:
200000 2 1 2 0 2 1 2 1 2 1 1 1 2 1 2 1 2 1 1 1 1 2 0 1 2 1 1 2 1 2 2 2 1 2 2 2 1 2 2 1 1 1 2 2 1 1 2 2 1 2 1 1 2 2 1 2 2 2 1 2 2 2 1 2 1 1 2 2 2 1 1 2 2 1 1 2 1 2 1 1 2 1 2 2 2 1 1 1 2 2 2 2 1 1 1 2 1 1 2 1 1 2 1 2 2 2 2 1 1 2 1 2 2 1 1 1 2 1 1 1 2 0 2 1 2 2 1 1 2 2 2 2 1 1 1 1 2 1 1 2 2 2 1 1 1 1 2...
output:
14535453821146
result:
ok
Test #13:
score: 0
Accepted
time: 130ms
memory: 66892kb
input:
200000 2 2 0 2 2 0 0 0 0 0 2 2 2 2 0 2 2 2 2 1 0 2 0 2 2 0 0 2 2 0 0 2 2 1 0 2 0 2 0 0 2 1 0 0 0 2 0 0 0 2 2 0 2 0 2 2 0 0 0 0 2 0 0 2 0 2 0 2 0 2 2 2 2 2 0 2 2 2 2 0 0 0 0 0 2 0 2 2 0 2 0 0 2 0 0 2 2 2 0 2 0 2 2 0 2 2 2 0 0 2 0 1 0 2 0 2 2 0 2 2 2 0 2 2 0 2 0 2 0 2 0 0 0 0 2 0 0 2 0 0 0 2 0 0 0 2 0...
output:
15024455356747
result:
ok
Test #14:
score: 0
Accepted
time: 196ms
memory: 72920kb
input:
200000 1 0 0 1 2 0 0 0 1 1 0 1 1 0 1 0 0 0 0 0 0 1 1 0 1 0 0 0 0 1 0 0 1 1 1 0 0 1 1 1 2 0 0 0 1 1 0 0 1 0 1 0 1 0 1 0 0 0 1 1 1 0 1 1 0 1 0 1 0 0 0 0 0 1 2 1 0 1 1 1 1 0 1 2 1 0 1 0 1 0 1 0 0 1 1 0 0 1 1 0 1 0 0 0 1 1 0 1 0 1 0 1 0 0 1 1 0 0 0 0 0 1 1 1 0 0 0 0 1 1 1 0 1 1 0 1 0 1 0 1 0 1 2 1 0 0 1...
output:
14979709993295
result:
ok
Test #15:
score: 0
Accepted
time: 111ms
memory: 56116kb
input:
200000 0 1 2 1 2 1 0 1 0 0 2 0 0 1 0 0 2 0 0 0 2 1 0 1 0 0 2 2 2 1 0 2 1 1 2 1 2 1 2 0 2 1 0 2 0 2 2 2 2 0 2 1 2 1 1 1 0 1 2 2 1 1 0 0 0 1 1 1 0 0 1 1 1 2 0 2 2 0 2 2 2 2 0 2 2 0 1 0 1 0 1 0 2 1 1 2 0 0 2 1 1 0 0 2 2 1 2 2 2 1 1 0 1 2 0 0 1 1 1 1 1 1 0 0 2 1 1 0 0 0 0 0 2 1 1 2 2 1 1 0 2 0 1 1 1 2 2...
output:
457084700208
result:
ok
Test #16:
score: 0
Accepted
time: 116ms
memory: 56468kb
input:
200000 0 0 1 0 1 1 1 1 0 2 2 1 2 1 2 0 0 0 2 0 0 1 0 1 1 0 1 0 2 0 0 1 1 1 1 2 1 1 1 0 2 0 0 2 2 2 0 2 1 0 0 2 0 0 2 1 0 2 1 2 0 2 2 1 0 1 0 0 2 1 2 2 2 0 1 2 2 2 2 0 1 0 2 2 1 0 0 1 2 1 0 2 1 2 0 0 2 0 2 2 2 2 1 0 0 2 0 2 0 2 2 2 1 1 1 1 1 0 1 1 0 0 2 2 1 0 2 0 2 1 2 2 2 2 2 0 0 1 0 1 0 1 2 1 0 0 2...
output:
490004211265
result:
ok
Test #17:
score: 0
Accepted
time: 156ms
memory: 55816kb
input:
200000 1 1 1 1 0 2 1 0 1 0 2 0 2 0 2 2 2 0 2 1 1 2 0 0 0 0 0 2 2 2 0 2 1 2 0 1 0 2 2 1 2 1 0 0 2 1 0 2 1 1 0 1 2 2 0 0 2 0 2 2 1 2 1 2 0 0 1 1 0 1 2 1 2 0 2 2 0 2 0 2 1 0 2 2 2 0 1 0 0 0 2 2 2 2 0 0 0 0 1 2 2 1 1 2 2 1 2 1 2 0 0 1 2 1 0 1 0 0 0 2 1 1 1 0 0 1 2 1 1 1 0 1 1 0 2 1 1 0 1 1 2 2 1 2 1 1 0...
output:
149609988117
result:
ok
Test #18:
score: 0
Accepted
time: 159ms
memory: 56028kb
input:
200000 0 1 2 1 2 2 2 2 0 1 1 2 0 0 0 0 1 1 0 2 0 2 1 1 1 2 2 0 2 2 0 1 1 1 2 0 0 1 2 1 2 1 0 1 2 1 1 2 0 1 1 0 0 1 0 1 0 1 0 0 1 2 2 2 2 1 2 0 0 2 1 2 1 2 1 0 2 2 0 2 1 1 1 1 2 2 1 0 2 2 2 2 1 0 2 2 0 0 1 0 1 2 1 1 2 0 2 1 1 2 2 2 1 0 2 2 1 1 1 0 0 1 1 0 0 0 0 1 1 0 1 0 1 1 2 0 0 2 1 1 0 2 2 1 1 0 1...
output:
490004211265
result:
ok
Test #19:
score: 0
Accepted
time: 162ms
memory: 55884kb
input:
200000 2 1 1 1 2 0 0 1 2 0 1 1 1 2 0 0 2 1 2 0 0 0 2 1 0 1 1 1 2 2 2 2 2 1 0 2 2 2 1 2 0 1 2 0 0 2 2 0 0 0 0 1 2 0 1 0 0 1 1 2 2 0 0 1 2 2 1 0 1 2 2 2 0 0 0 1 2 1 1 2 2 1 2 1 0 0 0 2 1 1 2 2 2 1 0 1 2 2 1 1 1 1 2 1 1 2 2 1 2 1 2 1 0 2 2 2 2 0 0 1 2 2 2 0 1 0 2 2 0 0 0 2 2 0 2 0 0 1 0 0 2 0 1 0 1 1 2...
output:
1812572240374
result:
ok
Test #20:
score: 0
Accepted
time: 161ms
memory: 56396kb
input:
200000 1 0 0 2 0 2 0 0 2 1 2 1 0 0 0 1 1 2 1 2 0 2 0 0 2 0 2 0 2 1 1 1 2 2 0 0 2 2 2 1 1 2 2 0 2 0 0 0 0 0 1 1 0 0 0 1 2 0 1 2 1 2 0 1 2 0 0 0 2 2 2 1 2 2 0 1 2 1 1 0 0 1 1 2 0 1 0 0 2 0 2 2 0 2 2 2 0 1 0 1 0 0 2 0 1 2 1 1 1 0 1 1 1 0 0 2 2 1 0 2 0 1 2 2 1 1 1 1 1 1 0 0 1 0 2 1 2 0 0 1 2 0 2 2 2 0 0...
output:
7322589985203
result:
ok
Test #21:
score: 0
Accepted
time: 171ms
memory: 63912kb
input:
200000 2 2 2 1 1 0 1 0 0 1 1 0 0 1 0 0 0 2 0 0 2 0 0 1 1 2 1 0 2 1 1 1 2 2 1 0 0 2 2 0 0 1 2 0 0 1 2 2 0 1 1 1 1 1 0 2 2 2 1 0 2 1 0 1 0 2 1 0 0 0 1 0 2 1 2 0 0 0 0 2 2 2 2 0 0 1 0 1 1 0 1 2 2 2 2 2 2 2 1 0 0 2 1 0 2 0 2 2 0 0 2 1 2 0 2 2 0 2 0 0 1 0 2 1 1 2 2 1 1 2 1 2 0 0 2 2 0 0 0 2 0 0 1 2 1 0 1...
output:
33075374608087
result:
ok
Test #22:
score: 0
Accepted
time: 179ms
memory: 64576kb
input:
200000 2 1 1 2 2 2 2 1 2 1 2 0 1 2 1 1 2 2 1 2 2 2 2 2 1 2 1 1 1 1 2 1 2 1 1 2 2 1 2 1 2 1 2 1 1 1 1 1 1 2 1 1 1 1 1 1 1 0 1 1 2 1 1 2 2 1 1 1 1 1 1 2 2 0 1 1 2 1 2 1 2 2 2 1 1 2 1 0 1 2 2 2 1 2 1 1 1 1 0 1 1 2 1 0 2 2 1 1 2 2 2 0 1 2 1 2 2 2 1 1 2 1 2 2 2 1 2 2 2 1 1 1 2 2 1 2 2 2 2 2 2 1 2 2 1 1 1...
output:
6216545751865
result:
ok
Test #23:
score: 0
Accepted
time: 130ms
memory: 62512kb
input:
200000 2 0 2 0 0 2 0 2 0 2 2 2 0 2 2 2 0 2 2 0 2 2 2 2 0 2 0 0 0 2 2 2 2 0 2 2 0 0 0 2 2 0 0 0 2 0 2 0 0 2 2 0 2 2 0 0 0 2 2 0 0 2 0 0 0 0 2 2 0 2 0 0 2 2 2 0 0 0 0 0 0 0 2 2 2 2 2 1 0 0 2 1 2 0 2 2 0 0 0 0 0 0 0 2 0 0 0 0 0 0 2 0 0 2 0 0 2 0 0 0 2 2 2 2 0 2 0 0 0 2 2 0 2 2 0 0 0 2 2 0 0 2 2 2 2 2 2...
output:
6090130973914
result:
ok
Test #24:
score: 0
Accepted
time: 171ms
memory: 61644kb
input:
200000 1 1 0 0 1 2 0 2 0 0 0 1 0 0 0 1 1 0 1 0 1 1 0 1 1 0 0 0 0 1 0 0 0 1 0 0 0 1 1 1 0 1 0 1 1 1 0 1 0 1 1 1 1 0 0 0 0 1 0 1 1 0 0 0 0 0 1 0 1 1 0 0 1 1 1 0 1 0 1 0 1 0 1 0 1 1 1 0 0 1 0 1 0 2 0 0 1 1 0 1 1 0 0 1 0 0 0 1 0 1 0 0 0 0 1 1 0 0 2 0 1 2 1 0 0 0 2 0 0 0 2 0 0 1 1 1 2 1 1 1 0 1 0 1 1 2 1...
output:
6392103279027
result:
ok
Test #25:
score: 0
Accepted
time: 178ms
memory: 72144kb
input:
200000 0 0 0 2 1 1 1 0 0 1 1 2 0 2 1 2 2 0 0 2 0 2 2 1 0 2 1 2 2 2 2 0 1 1 1 1 1 1 1 1 1 2 2 1 0 2 0 1 0 1 2 0 0 2 0 2 0 0 1 0 2 2 0 0 1 0 2 1 1 0 1 0 2 0 2 0 1 2 2 1 1 0 1 2 0 1 2 1 2 0 0 0 1 0 1 2 2 0 1 1 0 0 0 1 1 2 0 0 2 2 0 0 2 2 2 2 1 0 0 1 1 1 2 2 2 2 0 0 0 1 1 1 0 1 1 2 1 1 1 0 0 2 1 0 2 0 1...
output:
98889219873489
result:
ok
Test #26:
score: 0
Accepted
time: 1ms
memory: 16264kb
input:
3 0 0 1 1 2 0 2 0
output:
0
result:
ok
Test #27:
score: 0
Accepted
time: 2ms
memory: 18576kb
input:
4 0 0 1 1 0 2 1 2 2 3 0
output:
0
result:
ok
Test #28:
score: 0
Accepted
time: 2ms
memory: 12120kb
input:
5 2 0 2 2 0 0 2 0 1 0 3 2 4 0
output:
0
result:
ok
Test #29:
score: 0
Accepted
time: 0ms
memory: 16264kb
input:
6 1 0 2 2 0 1 1 3 4 5 0 4 0 1 2 5 0
output:
4
result:
ok
Test #30:
score: 0
Accepted
time: 171ms
memory: 55876kb
input:
200000 0 0 0 2 0 0 1 0 2 2 2 1 2 0 1 0 0 0 0 1 0 2 0 2 1 0 2 2 2 2 2 0 0 2 2 0 1 1 0 1 1 0 1 2 2 2 0 1 2 1 2 2 1 0 2 2 2 1 2 2 2 0 1 2 2 2 2 2 1 1 0 0 1 0 2 0 2 1 1 2 2 0 2 1 2 0 2 2 1 2 2 2 0 2 2 2 0 2 0 1 1 1 2 0 1 2 2 1 2 0 2 0 0 2 1 1 2 2 0 2 0 2 0 1 0 0 0 0 2 0 1 2 0 1 2 2 2 0 1 0 0 2 2 2 1 0 0...
output:
827878641518
result:
ok
Test #31:
score: 0
Accepted
time: 167ms
memory: 55600kb
input:
200000 1 1 2 2 1 1 2 2 2 2 2 1 2 2 2 2 2 1 2 1 2 2 1 2 1 2 2 2 2 2 1 2 1 1 1 2 2 2 1 0 1 2 2 2 2 1 2 2 1 2 1 1 2 2 1 2 1 2 1 1 2 1 2 2 2 1 2 1 1 1 2 2 2 1 1 2 1 2 1 1 2 1 1 1 0 2 1 1 1 2 1 2 2 2 1 2 1 1 1 2 1 1 2 2 1 2 1 2 1 1 1 2 0 2 1 1 2 2 2 1 2 2 2 2 2 1 2 1 1 2 2 1 1 1 2 1 2 1 2 2 1 1 1 1 1 1 1...
output:
148910253102
result:
ok
Test #32:
score: 0
Accepted
time: 128ms
memory: 55836kb
input:
200000 2 0 2 2 0 2 0 0 0 2 2 0 2 0 0 0 0 2 0 2 0 0 0 2 0 0 0 0 2 0 0 2 0 2 1 0 0 0 2 2 0 2 2 0 0 2 2 0 1 2 2 2 1 0 0 2 0 2 2 0 2 2 0 0 2 2 0 2 0 2 2 0 2 2 0 2 2 0 2 0 0 0 0 2 2 2 0 0 0 2 2 2 2 0 0 0 2 2 0 2 0 2 1 2 2 0 0 2 2 0 2 0 1 2 2 0 2 0 0 2 2 0 0 0 1 0 0 0 0 0 2 0 0 2 0 0 0 0 2 2 0 2 2 0 2 2 2...
output:
181252557212
result:
ok
Test #33:
score: 0
Accepted
time: 174ms
memory: 54964kb
input:
200000 1 0 2 1 2 1 0 0 0 1 1 1 1 0 0 1 1 0 1 0 1 1 0 1 0 1 0 0 0 1 0 1 2 0 0 1 0 0 1 0 1 0 0 0 0 0 0 1 1 0 1 1 0 1 1 0 1 1 0 1 1 0 1 1 0 0 1 0 0 0 0 1 1 1 0 0 1 0 0 1 0 0 1 0 0 0 2 1 1 0 0 0 1 1 0 0 0 0 0 0 1 0 0 1 0 0 0 1 0 1 0 1 1 0 0 0 0 1 1 0 0 0 1 0 0 1 0 1 0 0 1 0 1 1 0 0 1 0 1 1 1 0 1 1 0 0 0...
output:
155843324547
result:
ok
Test #34:
score: 0
Accepted
time: 129ms
memory: 56056kb
input:
200000 0 2 2 0 2 2 0 1 1 0 2 2 0 1 2 2 0 1 0 2 1 1 0 1 0 2 0 2 0 0 0 1 0 0 2 0 2 1 0 0 1 1 1 0 0 2 1 2 2 1 0 2 2 2 0 2 2 1 2 0 1 0 0 1 2 0 0 2 1 1 1 0 1 1 1 2 1 0 1 1 0 1 2 2 2 0 1 0 1 1 0 2 0 1 0 2 0 0 2 2 2 2 2 0 0 2 1 2 2 1 2 0 1 1 1 1 1 0 2 0 2 0 1 1 1 0 1 0 2 1 2 0 1 1 0 2 1 2 2 2 0 0 2 2 2 0 1...
output:
0
result:
ok
Test #35:
score: 0
Accepted
time: 127ms
memory: 54072kb
input:
200000 2 1 2 0 2 1 2 1 2 1 1 1 2 1 2 1 2 1 1 1 1 2 0 1 2 1 1 2 1 2 2 2 1 2 2 2 1 2 2 1 1 1 2 2 1 1 2 2 1 2 1 1 2 2 1 2 2 2 1 2 2 2 1 2 1 1 2 2 2 1 1 2 2 1 1 2 1 2 1 1 2 1 2 2 2 1 1 1 2 2 2 2 1 1 1 2 1 1 2 1 1 2 1 2 2 2 2 1 1 2 1 2 2 1 1 1 2 1 1 1 2 0 2 1 2 2 1 1 2 2 2 2 1 1 1 1 2 1 1 2 2 2 1 1 1 1 2...
output:
0
result:
ok
Test #36:
score: 0
Accepted
time: 92ms
memory: 55292kb
input:
200000 2 2 0 2 2 0 0 0 0 0 2 2 2 2 0 2 2 2 2 1 0 2 0 2 2 0 0 2 2 0 0 2 2 1 0 2 0 2 0 0 2 1 0 0 0 2 0 0 0 2 2 0 2 0 2 2 0 0 0 0 2 0 0 2 0 2 0 2 0 2 2 2 2 2 0 2 2 2 2 0 0 0 0 0 2 0 2 2 0 2 0 0 2 0 0 2 2 2 0 2 0 2 2 0 2 2 2 0 0 2 0 1 0 2 0 2 2 0 2 2 2 0 2 2 0 2 0 2 0 2 0 0 0 0 2 0 0 2 0 0 0 2 0 0 0 2 0...
output:
0
result:
ok
Test #37:
score: 0
Accepted
time: 135ms
memory: 53020kb
input:
200000 1 0 0 1 2 0 0 0 1 1 0 1 1 0 1 0 0 0 0 0 0 1 1 0 1 0 0 0 0 1 0 0 1 1 1 0 0 1 1 1 2 0 0 0 1 1 0 0 1 0 1 0 1 0 1 0 0 0 1 1 1 0 1 1 0 1 0 1 0 0 0 0 0 1 2 1 0 1 1 1 1 0 1 2 1 0 1 0 1 0 1 0 0 1 1 0 0 1 1 0 1 0 0 0 1 1 0 1 0 1 0 1 0 0 1 1 0 0 0 0 0 1 1 1 0 0 0 0 1 1 1 0 1 1 0 1 0 1 0 1 0 1 2 1 0 0 1...
output:
598441952
result:
ok
Subtask #4:
score: 0
Wrong Answer
Test #38:
score: 16
Accepted
time: 1ms
memory: 10140kb
input:
3 1 1 1 0 1 1 2 100 2 0 0 0 0 2 2 1 0 1 0 0 0 1 0 0 1 0 2 2 0 1 0 0 0 1 1 1 0 0 2 0 2 1 2 2 0 2 2 1 2 2 2 0 0 1 2 1 0 2 0 1 2 0 2 1 0 0 2 0 2 1 2 2 0 2 2 0 0 0 2 1 2 0 2 2 1 2 0 1 1 1 2 1 0 0 0 2 0 1 0 0 1 2 1 0 1 2 1 0 0 1 2 2 2 1 2 2 0 2 1 2 2 1 0 0 0 2 0 1 1 1 2 0 0 0 1 2 0 2 0 0 1 0 0 1 0 2 2 1 ...
output:
0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 1 0 0 1 0 0 0 1 0 0 0 0 0 0 0 0 0 1 0 1 0 0 0 1 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 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 0 0 0
result:
ok
Test #39:
score: -16
Wrong Answer
time: 0ms
memory: 12168kb
input:
4 2 2 2 0 0 1 1 2 2 3 100 0 0 3 2 1 1 3 1 0 2 2 0 1 0 3 0 0 1 1 2 0 0 3 2 3 1 1 0 3 2 3 0 3 1 1 2 3 2 0 1 2 2 2 1 1 0 1 1 1 0 3 0 0 2 1 2 0 0 3 1 1 0 2 0 3 0 2 2 3 2 0 2 0 1 3 1 2 1 3 0 1 2 2 2 3 2 2 1 1 1 3 1 1 2 2 0 0 2 1 1 0 1 3 0 2 2 0 2 0 0 1 0 3 1 2 1 0 2 2 2 0 0 0 1 3 0 2 1 1 2 3 1 3 2 1 1 2 ...
output:
0 0 0 2 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 -2 -1 0 -1 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -1 -2 -4 -4 -4 -4 -4 -4 -4 -3 -4 -4 -4 -3 -3 -4 -4 -4 -4 -4 -4 -4 -4 -4 -3 -6 -6 -6 -6 -6 -6 -6 -6 -6 -6 -5 -6 -5 -6 -6 -6 -6 -6 -6 -6 -6 -6 -5 -6 -6 -6 -6 -6 -6 -6 -6 -6 -6 -6 -6
result:
wrong answer
Subtask #5:
score: 0
Wrong Answer
Test #60:
score: 0
Wrong Answer
time: 3ms
memory: 14204kb
input:
3 2 0 0 0 1 0 2 100 0 1 2 2 2 1 1 1 0 0 2 2 1 2 0 2 0 1 0 0 0 1 0 2 2 1 1 0 2 2 2 0 0 0 0 2 1 1 1 2 2 2 2 1 0 0 2 2 0 1 1 0 0 0 2 0 1 1 1 0 2 1 2 0 0 2 0 1 2 2 1 1 0 0 0 1 2 1 0 0 2 0 0 1 2 1 2 0 0 2 2 2 0 1 2 0 0 0 0 1 2 1 0 2 0 1 0 2 2 2 1 0 1 1 1 2 1 0 1 2 1 0 0 0 1 1 0 1 1 0 2 0 1 2 1 0 0 2 0 0 ...
output:
0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 0 -1 2 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 0 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1
result:
wrong answer
Subtask #6:
score: 0
Skipped
Dependency #2:
0%
Subtask #7:
score: 0
Skipped
Dependency #1:
0%