QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#443785 | #8647. JOI Tour | arbuzick# | 6 | 148ms | 54516kb | C++20 | 6.0kb | 2024-06-15 16:30:44 | 2024-06-15 16:44:53 |
Judging History
answer
#include "joitour.h"
#include <bits/stdc++.h>
using namespace std;
constexpr int R = 1 << 18;
struct Node {
array<int, 3> cnt;
array<long long, 3> sum_cnt;
array<long long, 3> sum_heavy;
Node() {
cnt.fill(0);
sum_cnt.fill(0);
sum_heavy.fill(0);
}
Node operator+(Node b) {
Node ans;
for (int i = 0; i < 3; ++i) {
ans.cnt[i] = cnt[i] + b.cnt[i];
ans.sum_cnt[i] = sum_cnt[i] + b.sum_cnt[i];
ans.sum_heavy[i] = sum_heavy[i] + b.sum_heavy[i];
// if (cnt[1]) {
// ans.sum_cnt[i] += sum_cnt[i];
// ans.sum_heavy[i] += sum_heavy[i];
// }
// if (b.cnt[1]) {
// ans.sum_cnt[i] += b.sum_cnt[i];
// ans.sum_heavy[i] += b.sum_heavy[i];
// }
}
return ans;
}
// void add(Node b) {
// for (int i = 0; i < 3; ++i) {
// cnt[i] += b.cnt[i];
// sum_cnt[i] += b.sum_cnt[i];
// sum_heavy[i] += b.sum_heavy[i];
// }
// }
};
constexpr int maxn = 2e5 + 5;
vector<int> g[maxn];
int pr[maxn], sz[maxn];
void dfs(int v) {
sz[v] = 1;
for (auto u : g[v]) {
if (u != pr[v]) {
pr[u] = v;
dfs(u);
sz[v] += sz[u];
}
}
for (int i = 0; i < (int)g[v].size(); ++i) {
if (g[v][i] == pr[v]) {
swap(g[v][i], g[v].back());
}
}
if (v != 0) {
g[v].pop_back();
}
for (int i = 0; i < (int)g[v].size(); ++i) {
if (sz[g[v][i]] > sz[g[v][0]]) {
swap(g[v][i], g[v][0]);
}
}
}
int tp[maxn];
int cnt_all[3];
int cnt[maxn][3], cnt_heavy[maxn][3];
int t = 0;
int tin[maxn], tout[maxn];
int ord[maxn];
void calc_cnt(int v) {
tin[v] = t++;
ord[tin[v]] = v;
cnt_all[tp[v]]++;
cnt[v][tp[v]]++;
cnt_heavy[v][tp[v]]++;
for (auto u : g[v]) {
calc_cnt(u);
for (int i = 0; i < 3; ++i) {
cnt[v][i] += cnt[u][i];
}
}
if (!g[v].empty()) {
for (int i = 0; i < 3; ++i) {
cnt_heavy[v][i] += cnt[g[v][0]][i];
}
}
tout[v] = t;
}
long long sum[maxn];
long long cnt_sum[3];
long long ans = 0;
Node vals[maxn];
void init(int n, vector<int> f, vector<int> u, vector<int> v, int q) {
for (int i = 0; i < n; ++i) {
tp[i] = f[i];
}
for (int i = 0; i < n - 1; ++i) {
g[u[i]].push_back(v[i]);
g[v[i]].push_back(u[i]);
}
dfs(0);
calc_cnt(0);
ans = cnt_all[0] * 1LL * cnt_all[1] * 1LL * cnt_all[2];
for (int i = 0; i < n; ++i) {
if (tp[i] == 1) {
for (auto j : g[i]) {
ans -= cnt[j][0] * 1LL * cnt[j][2];
}
for (int j = 0; j < 3; ++j) {
cnt_sum[j] += cnt[i][j];
}
ans -= (cnt_all[0] - cnt[i][0]) * 1LL * (cnt_all[2] - cnt[i][2]);
}
for (auto j : g[i]) {
if (j != g[i][0]) {
sum[i] += cnt[j][0] * 1LL * cnt[j][2];
}
}
vals[i].cnt[tp[i]]++;
for (int j = 0; j < 3; ++j) {
vals[i].sum_cnt[j] = cnt[i][j];
vals[i].sum_heavy[j] = cnt_heavy[i][j];
}
}
}
void add_to_root(int v, int vl, int tp) {
vals[v].cnt[vl] += tp;
vals[v].sum_cnt[vl] += tp;
vals[v].sum_heavy[vl] += tp;
int prv = v, nw = pr[v];
while (prv != 0) {
vals[nw].sum_cnt[vl] += tp;
if (prv == g[nw][0]) {
vals[nw].sum_heavy[vl] += tp;
} else {
if (vl != 1) {
sum[nw] += tp * cnt[prv][vl ^ 2];
}
}
prv = nw;
nw = pr[nw];
}
}
pair<Node, long long> get_to_root(int v) {
int prv = v, nw = pr[v];
Node ans;
long long ret = 0;
while (prv != 0) {
if (tp[nw] == 1) {
ans = ans + vals[nw];
ret += vals[prv].cnt[tp[v] ^ 2];
}
prv = nw;
nw = pr[nw];
}
return make_pair(ans, ret);
}
Node get_segm(int l, int r) {
Node ans;
for (int i = l; i < r; ++i) {
if (tp[ord[i]] == 1) {
ans = ans + vals[ord[i]];
}
}
return ans;
}
void change(int x, int y) {
if (tp[x] == y) {
return;
}
ans -= cnt_all[0] * 1LL * cnt_all[1] * 1LL * cnt_all[2];
cnt_all[tp[x]]--;
ans += cnt_all[0] * 1LL * cnt_all[1] * 1LL * cnt_all[2];
// cout << "? " << ans << endl;
if (tp[x] == 0 || tp[x] == 2) {
auto [node, ret] = get_to_root(x);
ans += ret;
auto node2 = get_segm(tin[0], tout[0]);
ans += (node2.cnt[1] - node.cnt[1]) * 1LL * cnt_all[tp[x] ^ 2] - (node2.sum_cnt[tp[x] ^ 2] - node.sum_cnt[tp[x] ^ 2]);
} else {
ans += sum[x];
if (!g[x].empty()) {
ans += vals[x].sum_heavy[0] * 1LL * vals[x].sum_heavy[2];
}
ans += (cnt_all[0] - vals[x].sum_cnt[0]) * 1LL * (cnt_all[2] - vals[x].sum_cnt[2]);
}
add_to_root(x, tp[x], -1);
tp[x] = y;
ans -= cnt_all[0] * 1LL * cnt_all[1] * 1LL * cnt_all[2];
cnt_all[tp[x]]++;
ans += cnt_all[0] * 1LL * cnt_all[1] * 1LL * cnt_all[2];
if (tp[x] == 0 || tp[x] == 2) {
auto [node, ret] = get_to_root(x);
ans -= ret;
auto node2 = get_segm(tin[0], tout[0]);
ans -= (node2.cnt[1] - node.cnt[1]) * 1LL * cnt_all[tp[x] ^ 2] - (node2.sum_cnt[tp[x] ^ 2] - node.sum_cnt[tp[x] ^ 2]);
} else {
// cout << "?" << cnt_all[0] << ' ' << vals[x].sum_cnt[0] << ' ' << cnt_all[2] << ' ' << vals[x].sum_cnt[2] << endl;
ans -= sum[x];
ans -= vals[x].sum_heavy[0] * 1LL * vals[x].sum_heavy[2];
ans -= (cnt_all[0] - vals[x].sum_cnt[0]) * 1LL * (cnt_all[2] - vals[x].sum_cnt[2]);
}
add_to_root(x, tp[x], 1);
}
long long num_tours() {
// cout << "!" << ans << "!" << endl;
return ans;
}
詳細信息
Subtask #1:
score: 0
Wrong Answer
Test #1:
score: 0
Wrong Answer
time: 6ms
memory: 24200kb
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 606394 604500 601955 597676 592298 591756 582200 577811 576962 583802 583325 586467 587504 584676 583377 589202 595062 589250 590693 593487 589853 584436 579767 577266 575940 569737 569560 569897 568797 567940 566605 569137 576209 586044 587553 582680 581202 572250 572592 572526 576119 577673...
result:
wrong answer
Subtask #2:
score: 0
Skipped
Dependency #1:
0%
Subtask #3:
score: 6
Accepted
Test #11:
score: 6
Accepted
time: 132ms
memory: 51564kb
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: 136ms
memory: 51116kb
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: 146ms
memory: 48400kb
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: 148ms
memory: 52104kb
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: 92ms
memory: 42332kb
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: 87ms
memory: 42300kb
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: 111ms
memory: 42432kb
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: 110ms
memory: 42252kb
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: 123ms
memory: 42516kb
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: 118ms
memory: 42724kb
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: 130ms
memory: 46864kb
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: 134ms
memory: 46916kb
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: 126ms
memory: 46800kb
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: 111ms
memory: 46088kb
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: 146ms
memory: 54516kb
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: 5ms
memory: 23956kb
input:
3 0 0 1 1 2 0 2 0
output:
0
result:
ok
Test #27:
score: 0
Accepted
time: 0ms
memory: 23412kb
input:
4 0 0 1 1 0 2 1 2 2 3 0
output:
0
result:
ok
Test #28:
score: 0
Accepted
time: 0ms
memory: 22668kb
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: 24280kb
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: 126ms
memory: 42692kb
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: 139ms
memory: 42364kb
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: 131ms
memory: 42468kb
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: 136ms
memory: 42240kb
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: 92ms
memory: 43040kb
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: 83ms
memory: 42948kb
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: 85ms
memory: 43164kb
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: 95ms
memory: 43064kb
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: 0
Wrong Answer
time: 0ms
memory: 23244kb
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 -1 0 -1 -1 0 -1 -1 -1 0 -1 -1 -1 -1 -1 -1 -1 -1 -1 0 -1 0 -1 -1 -1 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 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -1 -2 -1 -2 -2 -2
result:
wrong answer
Subtask #5:
score: 0
Wrong Answer
Test #60:
score: 0
Wrong Answer
time: 0ms
memory: 23672kb
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 -1 0 -1 0 0 0 0 0 0 0 0 0 0 0 0 0 -1 0 0 0 0 0 0 0 0 0 1 0 1 0 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 -2 -1 -2 -1 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -3 -2 -3 -3 -3 -3 -3 -3 -3 -3 -3 -3 -3 -3 -3 -3
result:
wrong answer
Subtask #6:
score: 0
Skipped
Dependency #2:
0%
Subtask #7:
score: 0
Skipped
Dependency #1:
0%