QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#605538 | #2644. Cats or Dogs | hztmax0 | 8 | 4ms | 18684kb | C++17 | 4.1kb | 2024-10-02 17:48:34 | 2024-10-02 17:48:36 |
Judging History
answer
#include <iostream>
#include <vector>
#include <array>
#include "catdog.h"
using namespace std;
using Vec = array<int, 2>;
const int N = 1e5 + 5;
const Vec Evec = {0, 0};
int n, a[N];
vector<int> e[N];
int fa[N], siz[N], dep[N], wson[N];
int dfn[N], rmp[N], now, tp[N], bot[N];
int f[N][2], g[N][2];
void Dfs (int u) {
siz[u] = 1;
dep[u] = dep[fa[u]] + 1;
for (auto v : e[u]) {
if (v != fa[u]) {
fa[v] = u, Dfs(v);
siz[u] += siz[v];
if (siz[v] > siz[wson[u]]) {
wson[u] = v;
}
}
}
}
void Dfs2 (int u, int t) {
dfn[u] = ++now;
rmp[now] = u;
tp[u] = t, bot[t] = u;
if (wson[u]) {
Dfs2(wson[u], t);
}
for (auto v : e[u]) {
if (v != fa[u] && v != wson[u]) {
Dfs2(v, v);
}
}
}
struct Mat {
array<Vec, 2> a;
Vec& operator[] (int x) {
return a[x];
}
Mat () { a[0][0] = a[0][1] = a[1][0] = a[1][1] = 0; }
Mat (int p, int q, int r, int s) {
a[0][0] = p, a[0][1] = q, a[1][0] = r, a[1][1] = s;
}
Mat operator* (Mat b) {
Mat res(N, N, N, N);
for (int i = 0; i < 2; ++i) {
for (int j = 0; j < 2; ++j) {
for (int k = 0; k < 2; ++k) {
res[i][j] = min(res[i][j], a[i][k] + b[k][j]);
}
}
}
return res;
}
Vec operator* (Vec b) {
Vec res = {N, N};
for (int i = 0; i < 2; ++i) {
for (int j = 0; j < 2; ++j) {
res[i] = min(res[i], a[i][j] + b[j]);
}
}
return res;
}
} mat[N];
namespace Seg {
#define lc (k << 1)
#define rc ((k << 1) | 1)
const int T = N * 4;
Mat tr[T];
void Pushup (int k) {
tr[k] = tr[lc] * tr[rc];
}
void Update (int k, int x, Mat a, int L = 1, int R = n) {
if (L == R){
tr[k] = a;
return;
}
int mid = (L + R) >> 1;
if (x <= mid) {
Update(lc, x, a, L, mid);
}
else {
Update(rc, x, a, mid + 1, R);
}
Pushup(k);
}
Mat Query (int k, int l, int r, int L = 1, int R = n) {
if (l <= L && r >= R) {
return tr[k];
}
int mid = (L + R) >> 1;
if (l > mid) {
return Query(rc, l, r, mid + 1, R);
}
else if (r <= mid) {
return Query(lc, l, r, L, mid);
}
else {
return Query(lc, l, r, L, mid) * Query(rc, l, r, mid + 1, R);
}
}
#undef lc
#undef rc
}
void Calc (int u) {
Mat ret = Seg::Query(1, dfn[u], dfn[bot[u]]);
Vec rev = ret * Evec;
f[u][0] = rev[0], f[u][1] = rev[1];
}
void Build_mat (int u) {
int d0 = (a[u] == 1 ? N : 0), d1 = (a[u] == 2 ? N : 0);
mat[u] = Mat(g[u][0] + d0, g[u][0] + 1 + d0, g[u][1] + 1 + d1, g[u][1] + d1);
Seg::Update(1, dfn[u], mat[u]);
}
void DP (int u) {
for (auto v : e[u]) {
if (v != fa[u] && v != wson[u]) {
DP(v);
g[u][0] += min(f[v][0], f[v][1] + 1);
g[u][1] += min(f[v][1], f[v][0] + 1);
}
}
if (wson[u]) {
DP(wson[u]);
}
Build_mat(u);
if (tp[u] == u) {
Calc(u);
}
}
void Update_path (int u) {
while (u) {
Build_mat(u);
int v = tp[u], tf[2] = {f[v][0], f[v][1]};
Calc(v);
u = fa[v];
if (u) {
g[u][0] += min(f[v][0], f[v][1] + 1) - min(tf[0], tf[1] + 1);
g[u][1] += min(f[v][1], f[v][0] + 1) - min(tf[1], tf[0] + 1);
}
}
}
void initialize (int N, vector<int> A, vector<int> B) {
n = N;
for (int i = 0; i < n; ++i) {
e[A[i]].push_back(B[i]);
e[B[i]].push_back(A[i]);
}
Dfs(1), Dfs2(1, 1), DP(1);
}
int Get_ans () {
return min(f[1][0], f[1][1]);
}
int cat (int v) {
a[v] = 1, Update_path(v);
return Get_ans();
}
int dog (int v) {
a[v] = 2, Update_path(v);
return Get_ans();
}
int neighbor (int v) {
a[v] = 0, Update_path(v);
return Get_ans();
}
// void Test () {
// int N;
// cin >> N;
// vector<int> A(N), B(N);
// for (int i = 0; i < N - 1; ++i) {
// cin >> A[i] >> B[i];
// }
// initialize(N, A, B);
// int Q;
// cin >> Q;
// for (int T, v; Q--; ) {
// cin >> T >> v;
// cout << (T == 1 ? cat : (T == 2 ? dog : neighbor))(v) << '\n';
// }
// }
// int main () { Test(); }
详细
Subtask #1:
score: 8
Accepted
Test #1:
score: 8
Accepted
time: 4ms
memory: 16852kb
input:
2 2 1 75 1 2 1 1 3 1 3 2 1 1 2 2 3 1 3 2 2 2 3 2 1 1 3 1 1 2 2 1 3 2 2 2 3 2 1 2 3 1 1 1 3 2 3 1 1 2 3 2 2 1 2 2 3 2 3 1 2 1 1 2 3 1 1 1 3 2 3 1 1 2 3 2 2 1 3 1 1 1 1 2 3 1 3 2 2 1 1 2 3 1 2 1 3 2 2 2 3 1 2 1 3 2 2 2 3 2 2 2 3 1 3 2 1 1 3 1 2 2 1 1 3 1 1 1 3 2 2 2 3 2 3 1 2 2 2 1 3 1 2 1 3 2 1 2 3 1...
output:
0 0 0 0 0 1 0 0 0 0 0 0 0 1 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 0 1 0 0 0 0 0 0 0 1 0 1 0
result:
ok 75 lines
Test #2:
score: 8
Accepted
time: 4ms
memory: 16544kb
input:
9 5 3 4 9 5 4 4 1 5 7 7 6 4 8 2 3 32 2 9 2 5 1 1 2 2 1 4 1 3 3 3 2 3 3 1 2 7 3 4 1 4 3 2 3 7 1 6 3 4 2 7 2 8 3 7 3 9 3 5 1 4 3 6 2 1 1 7 3 4 3 8 1 2 3 2 3 3 3 7 1 9
output:
0 0 1 1 2 4 2 2 2 2 0 2 2 2 3 1 1 1 1 1 1 2 2 3 3 1 1 2 1 1 0 1
result:
ok 32 lines
Test #3:
score: 8
Accepted
time: 0ms
memory: 18616kb
input:
15 2 15 7 14 9 1 15 11 3 14 2 5 13 3 3 2 12 11 6 14 8 10 8 5 13 1 7 4 43 1 14 1 11 1 12 1 6 2 1 2 7 3 14 3 6 2 9 3 9 2 2 3 2 2 8 2 2 3 7 2 3 3 3 2 5 1 6 2 3 3 11 1 13 1 9 1 4 2 11 3 1 3 9 3 11 3 5 3 13 3 4 2 7 3 3 1 11 1 4 3 4 2 13 3 2 2 15 1 9 1 4 3 9 3 13
output:
0 0 0 0 1 2 2 1 1 1 1 1 1 1 1 1 1 1 2 2 2 4 5 5 5 3 3 3 3 2 2 2 2 2 3 2 2 2 2 3 4 3 3
result:
ok 43 lines
Test #4:
score: 8
Accepted
time: 3ms
memory: 14556kb
input:
9 9 2 5 7 1 7 2 1 9 3 1 4 6 7 6 8 100 2 6 2 8 2 7 1 9 2 2 3 6 2 5 1 1 2 6 3 8 1 4 3 9 2 8 3 8 3 1 2 9 3 5 1 8 3 9 3 4 2 5 2 3 3 6 2 4 3 2 3 5 3 7 3 3 1 1 2 9 2 7 2 3 3 9 2 5 2 2 3 7 2 9 3 1 3 5 1 5 3 5 3 2 2 6 1 7 3 8 3 9 3 7 3 3 3 6 2 5 1 9 3 9 1 9 1 8 3 9 2 1 1 2 3 5 1 7 3 8 2 9 3 2 3 7 2 7 3 9 1 ...
output:
0 0 0 1 1 1 1 3 3 3 3 2 2 2 1 1 1 2 2 1 1 1 1 1 1 1 1 1 1 2 4 4 4 4 4 3 3 1 1 1 1 1 1 3 2 2 0 0 0 0 1 0 1 2 1 1 2 2 2 2 3 1 0 0 0 1 1 1 4 4 4 2 2 2 1 0 0 1 1 1 0 0 0 1 0 0 0 1 1 1 1 1 0 0 0 0 0 0 0 0
result:
ok 100 lines
Test #5:
score: 8
Accepted
time: 0ms
memory: 16620kb
input:
11 4 11 1 7 10 11 7 4 5 3 1 8 7 2 1 9 5 8 6 5 91 2 8 1 11 3 8 2 7 2 8 2 6 1 5 1 9 2 10 3 10 2 1 3 6 2 10 3 7 1 3 1 7 3 7 3 10 3 5 3 1 3 8 1 1 2 8 1 6 3 3 1 7 3 7 2 7 3 8 2 5 3 9 2 10 1 2 3 5 2 8 3 10 2 9 1 3 3 6 1 6 3 7 1 7 3 2 2 10 3 9 3 8 1 2 1 8 1 4 3 10 3 8 3 7 2 5 2 7 3 3 3 7 2 8 3 1 3 2 2 2 2 ...
output:
0 1 0 1 1 1 3 4 5 4 4 3 4 4 4 4 4 3 3 2 0 0 2 2 2 2 2 4 2 4 4 5 6 4 6 5 6 6 6 6 3 3 3 4 3 1 1 1 1 0 0 0 3 6 5 2 2 2 2 2 2 2 3 2 2 2 2 1 1 1 1 1 1 1 3 3 2 1 1 1 0 0 0 0 1 2 2 2 2 2 2
result:
ok 91 lines
Test #6:
score: 8
Accepted
time: 0ms
memory: 18620kb
input:
15 11 1 8 1 9 11 8 12 14 12 13 15 7 13 4 15 3 4 5 9 15 2 4 12 15 10 6 11 100 1 1 2 11 2 7 3 7 3 1 1 9 2 5 1 6 2 12 2 13 2 1 3 13 3 1 3 9 2 14 1 9 2 7 2 13 3 14 3 5 2 1 3 9 1 3 1 10 2 9 3 11 3 3 3 1 2 2 3 12 1 5 1 15 1 4 3 10 3 7 3 9 2 1 1 14 3 13 1 10 3 15 3 10 1 8 2 12 3 5 3 8 2 15 3 1 1 5 3 5 3 12...
output:
0 1 2 1 0 1 2 3 3 3 3 3 3 1 1 3 3 3 3 2 2 1 2 3 3 3 2 2 2 2 3 4 4 4 4 2 4 4 3 3 3 3 3 6 6 4 4 4 4 4 1 1 1 3 3 2 3 3 3 3 3 3 3 3 4 4 4 6 6 4 6 4 4 3 3 4 4 4 3 2 2 1 2 3 3 2 3 5 5 6 6 7 6 6 7 6 7 6 6 6
result:
ok 100 lines
Test #7:
score: 8
Accepted
time: 0ms
memory: 18620kb
input:
15 7 1 9 11 10 1 9 13 15 11 10 4 10 6 6 13 4 2 5 15 12 9 14 11 3 11 8 11 100 1 12 1 15 1 8 1 13 1 10 3 13 1 11 1 1 1 13 3 8 2 4 1 6 3 12 3 6 1 14 3 13 3 10 3 1 1 13 1 8 2 6 3 6 1 9 1 6 2 1 3 13 1 2 3 8 3 14 3 1 1 12 1 5 3 4 3 12 1 10 3 10 3 9 3 6 1 3 1 9 3 11 2 13 2 10 2 1 3 15 2 15 3 10 1 6 2 10 3 ...
output:
0 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 2 2 2 2 2 2 0 0 0 0 0 0 0 0 0 2 2 2 2 4 4 5 6 5 3 3 3 3 3 3 3 3 3 3 4 2 4 5 5 5 5 5 5 5 4 2 2 3 3 5 6 6 6 6 6 6 5 5 4 5 3 2 2 2 2 1 1 1 1 1 2 2 3 3
result:
ok 100 lines
Test #8:
score: 8
Accepted
time: 0ms
memory: 16544kb
input:
15 4 7 13 2 8 15 5 11 14 4 5 9 15 2 14 12 6 14 11 10 11 8 3 13 12 9 1 12 100 1 10 2 11 1 7 2 5 1 2 1 14 1 15 3 5 3 10 1 9 3 9 1 1 2 3 1 13 1 5 3 5 2 4 2 6 3 15 2 12 1 10 3 1 3 4 2 4 3 7 3 3 3 4 1 8 2 7 3 14 3 12 2 14 2 1 2 12 2 9 3 14 2 15 3 11 3 9 3 13 2 9 1 14 3 15 3 8 2 4 3 2 1 2 3 1 3 2 3 10 3 1...
output:
0 1 2 2 3 3 3 3 2 2 2 2 3 3 3 3 5 6 6 7 8 7 5 7 6 5 4 4 5 2 2 2 2 2 2 2 4 3 3 3 3 6 4 4 4 4 4 4 4 3 0 1 1 1 1 1 1 1 1 1 2 1 4 5 2 2 4 4 2 3 5 5 5 5 5 3 3 3 2 3 3 4 3 3 4 5 5 5 3 5 5 4 4 4 2 2 2 2 3 3
result:
ok 100 lines
Test #9:
score: 8
Accepted
time: 0ms
memory: 18640kb
input:
15 11 1 11 9 14 5 14 7 12 6 9 7 10 14 13 5 6 2 4 13 4 3 3 6 6 8 15 3 100 1 3 2 13 2 4 1 14 1 15 3 14 1 11 2 9 2 5 3 4 1 10 3 11 1 7 3 7 1 2 3 3 3 13 3 9 1 1 1 11 1 8 2 9 1 13 3 11 1 12 3 12 1 11 3 1 2 3 3 9 1 4 3 13 2 7 3 8 3 4 3 5 3 3 1 9 2 3 3 2 1 12 1 6 3 10 2 13 3 9 3 6 3 13 1 4 2 8 3 3 1 13 3 4...
output:
0 1 1 2 2 1 2 2 2 2 3 2 3 2 2 2 2 2 2 2 2 3 3 3 3 3 3 3 6 5 5 5 6 6 4 4 2 2 4 3 4 4 3 3 3 3 3 5 5 3 3 3 3 3 3 3 4 4 4 3 3 2 2 2 2 2 2 2 2 3 3 3 4 4 4 7 4 4 4 4 4 4 3 2 3 5 5 5 5 5 5 5 5 4 3 3 3 3 3 2
result:
ok 100 lines
Test #10:
score: 8
Accepted
time: 3ms
memory: 14576kb
input:
15 14 12 4 1 8 7 9 5 3 7 2 12 1 13 2 10 9 12 7 9 7 4 6 10 11 3 15 13 100 1 5 1 13 2 10 2 3 3 3 2 14 1 2 1 9 3 9 3 5 3 2 3 14 2 9 3 13 1 15 3 9 2 11 1 4 3 4 1 7 2 13 2 14 3 11 3 10 3 14 1 3 3 13 2 9 3 9 3 7 1 6 1 10 3 15 2 15 2 5 1 2 3 6 3 3 3 2 2 13 1 6 2 14 2 2 3 13 3 6 3 2 1 12 2 4 3 4 2 11 3 10 2...
output:
0 0 1 2 1 1 2 2 2 2 1 1 1 0 1 1 1 1 1 2 4 4 3 3 2 2 0 1 0 0 0 0 0 1 2 2 2 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 3 5 5 4 2 2 1 1 1 1 1 2 2 1 2 2 5 4 4 4 5 5 6 6 4 4 4 4 1 1 1 1 1 1 1 1 2 3 5 3 4 3 4 2 2 2 2 2
result:
ok 100 lines
Test #11:
score: 8
Accepted
time: 4ms
memory: 14860kb
input:
15 13 11 11 8 12 8 12 5 5 6 6 14 7 14 7 9 4 9 4 3 10 3 15 10 15 1 2 1 64 1 9 1 11 2 10 1 14 3 11 2 12 2 2 1 5 2 8 2 7 3 14 3 7 1 15 2 11 2 14 3 10 1 3 3 2 2 2 3 3 3 9 2 9 3 2 3 11 1 2 3 2 1 4 1 6 2 1 2 10 1 11 3 1 1 2 2 7 3 8 3 14 3 9 3 4 1 8 3 2 3 5 1 13 3 15 3 10 3 6 3 11 2 9 3 13 3 9 2 9 1 11 3 7...
output:
0 0 1 1 1 2 2 2 2 4 4 2 4 4 6 4 4 3 4 4 4 4 3 3 3 3 3 3 4 6 7 6 6 6 6 6 6 4 4 4 4 4 3 3 1 1 1 1 1 1 1 1 2 2 4 4 3 1 3 3 3 3 3 5
result:
ok 64 lines
Test #12:
score: 8
Accepted
time: 0ms
memory: 16584kb
input:
7 3 4 1 4 5 1 7 5 7 2 6 2 1 2 2
output:
0
result:
ok single line: '0'
Test #13:
score: 8
Accepted
time: 2ms
memory: 16684kb
input:
2 1 2 47 1 2 3 2 1 2 1 1 3 2 2 2 3 1 1 1 3 2 3 1 1 1 3 1 1 1 3 1 2 1 3 1 1 2 2 1 3 2 1 2 3 2 1 2 3 2 1 2 3 1 2 1 3 1 3 2 1 2 1 1 3 2 1 2 3 1 3 2 2 1 1 2 3 1 3 2 1 1 2 2 3 1 2 1 3 2 2 2 3 2 3 1 2 1
output:
0 0 0 0 0 1 0 1 0 0 0 0 0 0 0 0 0 1 0 1 0 1 0 1 0 1 0 0 0 0 0 0 0 0 0 1 0 0 0 1 0 0 0 0 0 0 0
result:
ok 47 lines
Test #14:
score: 8
Accepted
time: 0ms
memory: 16616kb
input:
2 2 1 64 1 1 2 2 3 2 2 2 3 1 1 1 3 2 1 2 3 2 3 1 2 2 3 2 2 2 3 2 1 1 1 2 3 1 2 1 3 2 3 1 2 2 3 2 1 2 3 2 2 2 3 2 2 2 1 1 3 2 3 1 2 2 1 1 3 2 3 1 2 2 1 1 3 2 1 2 3 1 2 1 3 2 2 2 3 2 3 1 1 2 3 2 1 1 1 2 3 1 2 1 3 1 2 1 3 2 2 2 3 1 1 1 3 2 1 2 3 1 3 2 2 2 3 2 1 2 3 2
output:
0 1 0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 1 0 0 0 1 0 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
result:
ok 64 lines
Test #15:
score: 8
Accepted
time: 0ms
memory: 16596kb
input:
3 2 1 1 3 55 2 2 1 3 3 2 2 1 3 1 2 2 3 2 1 1 2 2 3 1 3 3 2 1 3 2 2 3 3 1 2 1 3 3 1 2 1 3 3 2 3 3 2 2 3 1 3 2 1 1 3 1 2 3 3 3 2 1 3 1 2 3 3 3 1 2 3 2 2 2 1 1 3 1 1 1 2 3 3 3 1 3 3 2 3 3 3 1 1 1 1 3 2 2 3 2 1 2 3 2 3 1 3 3 1 3 1 1 3 1
output:
0 1 0 1 0 1 0 0 1 1 0 0 0 0 0 0 0 1 2 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 2 1 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0
result:
ok 55 lines
Test #16:
score: 8
Accepted
time: 2ms
memory: 16596kb
input:
14 14 13 13 11 5 13 13 4 3 13 10 13 13 7 13 6 12 13 1 13 8 13 13 9 13 2 97 2 9 1 5 1 2 2 4 2 12 3 4 3 5 1 11 1 5 2 6 2 14 3 14 3 2 3 6 2 6 3 9 3 5 1 1 2 10 3 1 1 13 3 6 1 8 3 13 1 2 1 14 3 12 2 4 2 13 2 3 1 1 2 12 3 10 3 4 2 7 3 1 3 12 3 3 1 3 2 10 2 1 1 4 2 5 3 3 2 9 1 6 3 4 2 4 3 4 3 10 3 14 1 4 2...
output:
0 1 1 2 2 2 1 2 2 3 3 3 2 2 2 2 1 2 2 1 3 2 2 2 2 2 1 2 4 4 5 5 5 5 5 4 4 4 5 5 5 6 6 5 5 6 5 5 5 5 4 5 5 4 4 4 3 2 2 2 2 1 2 3 3 2 2 2 1 1 2 3 3 4 3 3 3 4 4 5 4 4 3 3 3 3 3 3 3 2 1 2 2 1 1 1 0
result:
ok 97 lines
Subtask #2:
score: 0
Wrong Answer
Dependency #1:
100%
Accepted
Test #17:
score: 30
Accepted
time: 4ms
memory: 14656kb
input:
740 717 38 630 627 569 28 124 227 518 170 590 737 104 464 108 665 489 99 713 3 374 54 21 280 250 436 400 128 558 687 286 521 327 687 101 675 516 713 141 91 30 613 419 225 218 505 274 545 254 567 609 525 3 231 528 509 612 690 262 105 275 68 192 23 383 631 365 127 372 662 248 182 143 495 130 415 249 3...
output:
0 0 0 0 1 1 1 2 3 3 3 3 3 4 4 4 5 5 5 6 6 7 7 8 8 9 10 11 11 11 12 12 12 13 13 14 14 15 15 15 15 15 15 16 16 17 17 17 18 19 19 19 19 20 20 20 20 20 21 22 22 23 23 22 22 22 22 22 24 23 24 25 26 26 26 26 26 27 27 28 28 30 31 32 32 32 33 33 34 34 34 35 36 35 35 36 37 37 38 38 38 39 39 39 40 41 41 42 42...
result:
ok 747 lines
Test #18:
score: 30
Accepted
time: 0ms
memory: 18664kb
input:
931 627 537 349 208 170 929 859 502 311 847 576 917 73 266 550 460 924 311 107 638 440 176 866 795 536 615 844 605 325 775 27 276 2 663 294 123 608 357 857 880 678 391 241 725 492 366 829 501 123 921 633 176 605 746 924 910 526 370 193 107 158 166 142 536 817 171 440 422 267 390 664 703 441 687 762 ...
output:
0 1 1 1 2 2 2 2 3 4 4 4 4 4 4 4 6 6 6 7 7 7 7 8 8 9 9 9 9 9 10 10 10 10 11 11 11 12 12 12 12 14 14 14 14 14 14 16 17 17 17 17 18 18 18 18 18 18 18 18 18 18 19 19 20 21 22 23 23 24 24 24 24 25 24 24 24 25 26 25 25 25 25 25 25 25 25 25 25 25 25 25 26 26 26 26 27 27 27 27 25 25 26 26 26 27 27 27 27 27 ...
result:
ok 730 lines
Test #19:
score: 30
Accepted
time: 2ms
memory: 18652kb
input:
784 391 610 341 483 415 48 156 42 337 734 339 95 110 4 388 420 408 656 284 447 552 112 781 108 761 603 188 121 267 633 595 169 129 470 112 194 275 195 197 174 477 245 118 766 158 324 670 562 10 429 634 450 649 465 316 424 149 52 25 612 240 639 508 535 348 78 337 120 689 450 538 178 234 240 206 516 7...
output:
0 0 0 0 1 1 1 1 1 1 1 2 2 2 2 2 2 3 4 4 5 7 7 7 9 10 11 12 13 13 13 13 13 13 13 13 14 15 15 16 17 18 18 20 20 20 20 20 21 20 20 20 20 21 21 22 23 23 24 25 24 24 24 24 24 25 26 26 26 27 27 27 27 28 28 28 28 29 29 30 30 31 33 33 34 36 36 36 37 38 38 38 41 41 41 41 42 43 43 43 43 44 44 45 45 45 45 45 4...
result:
ok 426 lines
Test #20:
score: 30
Accepted
time: 0ms
memory: 16684kb
input:
271 194 12 60 142 221 59 149 143 196 56 33 211 109 166 78 264 111 27 121 246 78 256 234 243 156 152 144 129 166 102 175 244 36 168 220 138 244 117 266 15 263 258 213 59 60 180 177 155 44 71 47 64 118 22 54 116 43 72 167 227 169 138 225 214 182 63 100 7 149 28 219 175 25 57 117 192 226 12 10 6 86 131...
output:
0 1 1 1 1 1 2 2 2 2 3 3 3 4 5 6 6 6 6 7
result:
ok 20 lines
Test #21:
score: 30
Accepted
time: 0ms
memory: 16612kb
input:
273 191 151 104 115 271 19 262 261 75 226 154 100 38 50 20 70 82 255 117 152 249 223 119 87 103 186 126 145 52 142 231 190 157 87 194 1 192 60 201 12 106 266 103 116 171 176 167 187 243 143 72 63 148 262 250 112 73 224 252 90 217 42 257 123 168 145 93 110 17 187 67 90 171 255 271 64 74 12 224 75 62 ...
output:
0 1 1 1 2 3 3 3 3 4 4 4 4 5 6 7 7 7 7 7 7 8 9 9 9 8 9 9 9 9 9 10 10 10 10 10 11 11 11 11 13 13 14 14 15 15 15 15 15 16 17 17 18 19 19 19 17 18 18 18 18 18 20 20 20 20 20 20 20 20 21 20 19 19 19 20 18 18 18 20 22 22 24 24 25 26 26 26 26 28 28 28 29 29 31 31 31 31 31 31 31 33 34 35 35 35 35 35 35 35 3...
result:
ok 387 lines
Test #22:
score: 30
Accepted
time: 0ms
memory: 16704kb
input:
337 281 1 334 256 301 20 260 129 24 120 45 73 123 95 138 276 275 271 71 202 182 85 320 159 72 223 332 299 287 165 63 328 282 197 104 252 253 182 29 212 65 201 133 65 115 306 46 10 237 269 182 69 32 252 240 304 257 71 326 214 84 282 322 253 164 298 22 127 66 303 165 307 143 188 137 319 280 82 274 282...
output:
0 1 1 1 1 2 3 3 3 3 3 4 4 4 4 5 5 5 5 5 5 6 6 7 7 7 8 9 9 9 9 9 9 9 9 9 9 11 11 11 14 15 15 17 17 17 17 16 16 16 16 16 16 16 16 17 17 17 17 18 18 18 18 18 18 18 19 19 19 19 19 20 20 20 21 21 21 21 22 24 25 25 26 25 25 25 24 27 27 28 28 30 30 31 32 33 33 31 31 32 32 32 32 32 32 33 33 34 34 34 34 34 3...
result:
ok 406 lines
Test #23:
score: 30
Accepted
time: 0ms
memory: 16948kb
input:
836 13 417 571 248 553 631 647 660 177 257 405 507 451 127 210 228 578 580 711 475 100 289 352 347 112 384 90 276 169 198 49 530 244 102 454 593 106 7 358 663 656 542 294 517 702 422 49 710 421 218 776 370 428 498 37 636 487 574 272 597 699 749 313 515 791 484 185 75 346 445 473 19 659 512 453 673 1...
output:
0 1 1 2 2 2 2 3 4 4 4 4 6 7 7 8 8 8 9 9 9 10 10 12 13 13 13 13 13 14 15 15 15 15 15 15 15 16 16 17 17 17 17 17 18 18 18 18 19 20 20 21 21 21 21 21 21 21 21 21 21 21 21 22 22 22 22 21 21 21 21 21 21 21 21 20 20 21 21 22 22 22 24 24 25 25 25 25 26 26 26 26 27 27 28 28 28 28 29 29 29 30 30 30 30 30 30 ...
result:
ok 962 lines
Test #24:
score: 30
Accepted
time: 0ms
memory: 18684kb
input:
778 522 567 760 407 315 542 368 92 255 760 232 666 468 222 139 155 554 201 561 180 402 136 718 419 605 678 54 674 722 746 478 441 702 620 567 147 647 104 264 74 477 541 212 629 241 93 703 47 564 587 610 167 556 75 110 589 701 128 513 32 135 221 124 424 120 300 670 122 624 418 360 434 87 123 46 628 6...
output:
0 0 1 1 2 2 2 2 3 3 3 3 3 5 5 5 5 5 6 6 7 7 7 7 7 7 8 9 9 9 9 9 9 9 9 9 11 12 11 14 15 15 15 15 15 16 18 18 18 20 20 20 20 20 20 21 21 23 22 22 22 21 21 21 22 22 22 22 23 23 23 23 24 24 25 25 26 27 27 27 27 28 28 29 29 29 29 30 30 30 30 31 32 32 33 34 35 35 35 35 36 37 37 36 36 36 36 37 38 40 40 39 ...
result:
ok 838 lines
Test #25:
score: 30
Accepted
time: 0ms
memory: 16876kb
input:
409 172 390 258 268 312 267 379 199 379 282 322 36 89 52 364 32 294 321 25 348 305 54 188 343 131 293 323 220 383 201 202 333 5 231 168 141 145 215 308 115 407 175 201 298 352 91 162 127 255 331 3 127 16 118 403 96 294 301 132 50 122 119 247 301 118 174 309 58 73 1 208 116 171 156 137 5 340 86 77 19...
output:
0 1 1 2 2 2 2 2 3 3 3 4 5 5 6 6 6 6 6 6 6 6 5 5 4 4 4 4 4 4 4 5 5 5 5 5 5 5 6 6 6 6 6 7 7 7 8 9 9 10 11 11 12 13 13 13 13 13 14 14 14 14 15 16 18 19 19 18 19 20 21 21 21 21 21 22 23 23 24 24 24 24 26 26 26 27 27 28 29 30 30 31 31 31 31 30 31 31 32 34 34 34 36 37 39 39 39 39 39 39 40 41 41 41 43 43 4...
result:
ok 753 lines
Test #26:
score: 0
Wrong Answer
time: 0ms
memory: 16648kb
input:
435 392 219 251 271 361 365 282 190 343 388 272 224 355 240 333 29 115 127 148 42 70 195 266 9 20 120 226 321 277 184 107 12 46 228 378 342 97 94 244 58 220 416 45 365 435 63 140 357 399 273 203 264 317 266 318 307 400 312 141 106 295 326 8 43 33 101 125 118 329 290 353 12 163 341 347 160 33 269 238...
output:
0 1 1 1 1 1 1 1 1 1 2 3 4 4 4 4 5 7 8 9 10 10 10 10 10 10 10 11 11 11 11 11 11 12 12 14 14 15 15 15 15 15 16 16 17 17 18 18 18 18 19 18 20 22 22 22 22 22 22 22 22 23 24 24 24 24 24 24 24 24 24 24 25 25 23 23 23 23 22 23 24 24 25 25 25 25 27 28 27 28 29 29 28 28 29 29 30 31 31 31 32 32 35 32 32 31 31...
result:
wrong answer 124th lines differ - expected: '38', found: '37'
Subtask #3:
score: 0
Skipped
Dependency #1:
100%
Accepted
Dependency #2:
0%