#pragma GCC optimize("Ofast")
//#pragma GCC target("avx,avx2")
#include "beechtree.h"
#include <bits/stdc++.h>
#define all(x) (x).begin(),(x).end()
using namespace std;
using ll = long long;
using ld = long double;
//#define int ll
#define sz(x) ((int)(x).size())
using pii = pair<int,int>;
using tii = tuple<int,int,int>;
const int nmax = 2e5 + 5;
const ll mod = 998244853;
struct Mint {
ll val;
Mint(ll x = 0): val((x % mod + mod) % mod) {;}
Mint operator +(const Mint& x) const { return Mint(val + x.val); }
Mint operator -(const Mint& x) const { return Mint(val - x.val); }
Mint operator *(const Mint& x) const { return Mint(val * x.val); }
Mint operator +=(const Mint& x) { return *this = Mint(val + x.val); }
Mint operator -=(const Mint& x) { return *this = Mint(val - x.val); }
Mint operator *=(const Mint& x) { return *this = Mint(val * x.val); }
Mint operator ^(const int& _b) const {
Mint accum = 1, a = *this;
int b = _b;
while(b) {
accum = (b & 1? accum * a : accum);
a *= a;
b >>= 1;
}
return accum;
}
Mint operator /(const Mint& x) { return Mint((ll)val * (x ^ (mod - 2)).val); }
Mint operator /=(const Mint& x) { return *this = Mint((ll)val * (x ^ (mod - 2)).val); }
};
Mint p[2][nmax * 2];
#define hash bjsefdjhsdsfhoi
struct hash {
Mint v[2];
int len;
hash(Mint a, Mint b, int c) { v[0] = a; v[1] = b; len = c; }
hash(Mint a) { v[0] = a; v[1] = a; len = 1; }
hash() { v[0] = 0; v[1] = 0; len = 0; }
hash operator +(const hash& x) const {
return hash(v[0] * p[0][x.len] + x.v[0], v[1] * p[1][x.len] + x.v[1], len + x.len);
}
hash operator -(const hash& x) const {
return hash(v[0] - p[0][len - x.len] * x.v[0], v[1] - p[1][len - x.len] * x.v[1], len - x.len);
}
hash operator += (const hash& x) { return *this = *this + x; }
hash operator -= (const hash& x) { return *this = *this - x; }
bool operator !=(const hash& x) const {
return v[0].val != x.v[0].val || v[1].val != x.v[1].val || len != x.len;
}
ll operator()() const { return (ll)v[0].val * mod + v[1].val; }
bool operator < (const hash& x) const { return (*this)() < x(); }
bool operator == (const hash& x) const { return (*this)() == x(); }
};
vector<pii> g[nmax];
vector<pii> invg[nmax];
vector<int> P, C;
bool isanc(unordered_set<int>& A, unordered_set<int>& B) {
if(sz(A) < sz(B)) return 0;
for(auto &x : B)
if(!A.count(x)) return 0;
return 1;
}
vector<int> sol;
int area[nmax], pin[nmax], pout[nmax], inp;
hash eulerH[2 * nmax], dH[nmax];
pii euler[2 * nmax];
int poz;
void init(int node) {
sort(all(g[node]), [&](auto a, auto b) { return a.second < b.second; });
euler[++poz] = pii{node, 0};
eulerH[poz] = eulerH[poz - 1] + hash(2 * C[node] + 0);
pin[node] = poz + 1;
area[node] = 1;
for(auto [x, c] : g[node])
dH[x] = dH[node] + hash(c), init(x), area[node] += area[x];
pout[node] = poz;
euler[++poz] = pii{node, 1};
eulerH[poz] = eulerH[poz - 1] + hash(2 * C[node] + 1);
}
vector<int> difference(int node, int other) {
vector<int> ass_list;
auto getL = [&](int l, int r) {
return eulerH[r + pin[node]] - eulerH[l + pin[node] - 1];
};
auto getR = [&](int l, int r) {
return eulerH[r + pin[other]] - eulerH[l + pin[other] - 1];
};
auto visit = [&](auto&& self, int nod, int& r) -> void {
r++;
ass_list.emplace_back(nod);
for(auto [x, c] : g[nod]) self(self, x, r);
r++;
};
int l0 = 0, r0 = 0, END0 = pout[node] - pin[node] + 1, l1 = 0, r1 = 0, END1 = pout[other] - pin[other] + 1;
while(l0 < END0 && l1 < END1) {
r0 = l0 - 1, r1 = l1 - 1;
for(int lim = 1 << 18; lim > 0; lim >>= 1) {
if(r0 + lim < END0 && r1 + lim < END1 && getL(l0, r0 + lim)() == getR(l1, r1 + lim)()) r0 += lim, r1 += lim;
}
if(r0 == END0 - 1 || r1 == END1 - 1);
else {
auto [nxt0, t0] = euler[pin[node] + r0 + 1];
auto [nxt1, t1] = euler[pin[other] + r1 + 1];
if(t1 == 0 && C[nxt1] < C[nxt0]) return {-1};
if(t0 == 1) return {-1};
visit(visit, nxt0, r0);
}
l0 = r0 + 1;
l1 = r1 + 1;
}
if(l0 == END0 && l1 < END1) return {-1};
while(l0 < END0) {
auto [nxt0, t0] = euler[pin[node] + l0];
visit(visit, nxt0, l0);
}
return ass_list;
}
#define erset set
bool coaielemele;
struct PartDiff {
map<int, erset<hash>> onlevel;
map<hash, int> inverse;
int feasable = 1;
void add(int dim, int prevdim, erset<hash> ths) {
if(!feasable) return;
bool coaiee = coaielemele;
if(onlevel.count(dim)) {
for(auto x : ths) {
if(inverse.count(x) == 0) {feasable = 0; return; }
if(inverse[x] > dim) {feasable = 0; return; }
}
}
else {
auto it = onlevel.upper_bound(dim);
int bigger = -1;
if(it == onlevel.end()); else bigger = it -> first;
it = onlevel.upper_bound(prevdim);
while(!ths.empty() && it != onlevel.end() && it -> first < dim) {
for(auto x : it -> second) {
if(ths.count(x)) { ths.erase(x); }
else { feasable = 0; return; }
}
it = next(it);
}
for(auto x : ths) {
if(inverse.count(x) == 0) { if(bigger == -1) { ; } else { feasable = 0; return; } }
else {
if(inverse[x] > dim) {
if(inverse[x] == bigger) { onlevel[bigger].erase(x); } // o sa il pun, dar n-are ce cauta aici
else { feasable = 0; return; } // prost
}
else { assert(inverse[x] < dim);
if(inverse[x] > prevdim) { continue; } // nu vreau sa il pun
else { feasable = 0; return; } // prost
}
}
onlevel[dim].emplace(x);
inverse[x] = dim;
}
}
}
void add(PartDiff& x) {
if(!feasable) return;
if(!x.feasable) { feasable = 0; return; }
if(sz(x.inverse) > sz(inverse)) swap(x, *this);
int prv = -1;
for(auto [h, v] : x.onlevel) {
add(h, prv, v);
prv = h;
}
x.onlevel.clear();
x.inverse.clear();
return;
}
};
void print(int node) {
}
PartDiff dfs(int node) {
PartDiff mine;
int heavyson = -1;
coaielemele = 0;
for(auto &[x, c] : g[node]) {
auto T = dfs(x);
mine.add(T);
if(heavyson == -1 || area[x] > area[heavyson]) heavyson = x;
}
coaielemele = 0;
if(sz(g[node]) != sz(invg[node])) { mine.feasable = sol[node] = 0; return mine; }
if(mine.feasable == 0) { sol[node] = 0; return mine; }
if(heavyson == -1) {
erset<hash> pl; pl.emplace(hash());
mine.add(1, -1, pl);
}
else {
auto sons = difference(node, heavyson);
//vector<int> sons;
//for(auto [a, b] : g[node]) sons.emplace_back(a);
if(sz(sons) && sons[0] == -1) { mine.feasable = sol[node] = 0; return mine; }
erset<hash> pl;
for(auto x : sons)
pl.emplace(dH[x] - dH[node]);
mine.add(area[node], area[heavyson], pl);
}
sol[node] = mine.feasable = mine.feasable && (sz(mine.inverse) == area[node]);
return mine;
}
std::vector<int> beechtree(int N, int M, std::vector<int> P_, std::vector<int> C_) {
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
p[0][0] = p[1][0] = 1;
p[0][1] = rng() % (mod - 1000) + 503;
#ifdef DLOCAL
p[0][1] = 100000;
#endif
p[1][1] = rng() % (mod - 1200) + 505;
for(int i = 2; i < nmax; i++)
p[0][i] = p[0][i - 1] * p[0][1],
p[1][i] = p[1][i - 1] * p[1][1];
P = P_;
C = C_;
for(int i = 1; i < N; i++) {
g[P[i]].emplace_back(i, C[i]);
invg[P[i]].emplace_back(C[i], -1);
}
for(int i = 0; i < N; i++) sort(all(invg[i])), invg[i].erase(unique(all(invg[i])), end(invg[i]));
sol.assign(N, 0);
init(0);
dfs(0);
return sol;
}
/**
Töte es durch genaue Untersuchung\Töte es kann es nur noch schlimmer machen\Es lässt es irgendwie atmen
--
*/
Compilation message
beechtree.cpp: In member function 'void PartDiff::add(int, int, std::set<bjsefdjhsdsfhoi>)':
beechtree.cpp:160:12: warning: unused variable 'coaiee' [-Wunused-variable]
160 | bool coaiee = coaielemele;
| ^~~~~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
13 ms |
31120 KB |
Output is correct |
2 |
Correct |
12 ms |
31068 KB |
Output is correct |
3 |
Correct |
12 ms |
31080 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
10 ms |
31068 KB |
Output is correct |
2 |
Correct |
10 ms |
31068 KB |
Output is correct |
3 |
Correct |
13 ms |
31072 KB |
Output is correct |
4 |
Correct |
10 ms |
31068 KB |
Output is correct |
5 |
Correct |
12 ms |
31068 KB |
Output is correct |
6 |
Correct |
11 ms |
30916 KB |
Output is correct |
7 |
Correct |
13 ms |
31160 KB |
Output is correct |
8 |
Correct |
12 ms |
31124 KB |
Output is correct |
9 |
Correct |
13 ms |
31132 KB |
Output is correct |
10 |
Correct |
12 ms |
31068 KB |
Output is correct |
11 |
Correct |
13 ms |
31068 KB |
Output is correct |
12 |
Correct |
12 ms |
31068 KB |
Output is correct |
13 |
Correct |
11 ms |
31068 KB |
Output is correct |
14 |
Correct |
12 ms |
31068 KB |
Output is correct |
15 |
Correct |
10 ms |
31064 KB |
Output is correct |
16 |
Correct |
15 ms |
31072 KB |
Output is correct |
17 |
Correct |
12 ms |
31064 KB |
Output is correct |
18 |
Correct |
11 ms |
30968 KB |
Output is correct |
19 |
Correct |
16 ms |
30204 KB |
Output is correct |
20 |
Correct |
21 ms |
30044 KB |
Output is correct |
21 |
Correct |
15 ms |
30044 KB |
Output is correct |
22 |
Correct |
15 ms |
30036 KB |
Output is correct |
23 |
Correct |
22 ms |
30140 KB |
Output is correct |
24 |
Correct |
12 ms |
30044 KB |
Output is correct |
25 |
Correct |
19 ms |
30144 KB |
Output is correct |
26 |
Correct |
15 ms |
30044 KB |
Output is correct |
27 |
Correct |
15 ms |
30044 KB |
Output is correct |
28 |
Correct |
16 ms |
30056 KB |
Output is correct |
29 |
Correct |
20 ms |
30044 KB |
Output is correct |
30 |
Correct |
19 ms |
30044 KB |
Output is correct |
31 |
Correct |
15 ms |
30040 KB |
Output is correct |
32 |
Correct |
19 ms |
30044 KB |
Output is correct |
33 |
Correct |
14 ms |
30044 KB |
Output is correct |
34 |
Correct |
17 ms |
30044 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
10 ms |
31068 KB |
Output is correct |
2 |
Correct |
10 ms |
31068 KB |
Output is correct |
3 |
Correct |
13 ms |
31072 KB |
Output is correct |
4 |
Correct |
10 ms |
31068 KB |
Output is correct |
5 |
Correct |
12 ms |
31068 KB |
Output is correct |
6 |
Correct |
11 ms |
30916 KB |
Output is correct |
7 |
Correct |
175 ms |
141976 KB |
Output is correct |
8 |
Correct |
177 ms |
142120 KB |
Output is correct |
9 |
Correct |
12 ms |
32600 KB |
Output is correct |
10 |
Correct |
14 ms |
31080 KB |
Output is correct |
11 |
Correct |
10 ms |
31068 KB |
Output is correct |
12 |
Correct |
11 ms |
31064 KB |
Output is correct |
13 |
Correct |
16 ms |
34028 KB |
Output is correct |
14 |
Correct |
13 ms |
33808 KB |
Output is correct |
15 |
Correct |
11 ms |
32088 KB |
Output is correct |
16 |
Correct |
10 ms |
32092 KB |
Output is correct |
17 |
Correct |
721 ms |
188244 KB |
Output is correct |
18 |
Correct |
488 ms |
172224 KB |
Output is correct |
19 |
Correct |
231 ms |
149744 KB |
Output is correct |
20 |
Correct |
166 ms |
142024 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
11 ms |
31064 KB |
Output is correct |
2 |
Correct |
13 ms |
31068 KB |
Output is correct |
3 |
Correct |
11 ms |
31144 KB |
Output is correct |
4 |
Correct |
11 ms |
31068 KB |
Output is correct |
5 |
Correct |
13 ms |
31068 KB |
Output is correct |
6 |
Correct |
11 ms |
31064 KB |
Output is correct |
7 |
Correct |
10 ms |
31068 KB |
Output is correct |
8 |
Correct |
14 ms |
31068 KB |
Output is correct |
9 |
Correct |
10 ms |
31116 KB |
Output is correct |
10 |
Correct |
11 ms |
31128 KB |
Output is correct |
11 |
Correct |
12 ms |
31064 KB |
Output is correct |
12 |
Correct |
12 ms |
31064 KB |
Output is correct |
13 |
Correct |
13 ms |
31068 KB |
Output is correct |
14 |
Correct |
16 ms |
31324 KB |
Output is correct |
15 |
Correct |
118 ms |
39248 KB |
Output is correct |
16 |
Correct |
134 ms |
38812 KB |
Output is correct |
17 |
Correct |
152 ms |
39032 KB |
Output is correct |
18 |
Correct |
285 ms |
65984 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
10 ms |
31068 KB |
Output is correct |
2 |
Correct |
10 ms |
31068 KB |
Output is correct |
3 |
Correct |
13 ms |
31160 KB |
Output is correct |
4 |
Correct |
12 ms |
31124 KB |
Output is correct |
5 |
Correct |
175 ms |
141976 KB |
Output is correct |
6 |
Correct |
177 ms |
142120 KB |
Output is correct |
7 |
Correct |
12 ms |
31068 KB |
Output is correct |
8 |
Correct |
14 ms |
31068 KB |
Output is correct |
9 |
Correct |
11 ms |
31320 KB |
Output is correct |
10 |
Correct |
14 ms |
31324 KB |
Output is correct |
11 |
Correct |
145 ms |
63308 KB |
Output is correct |
12 |
Correct |
181 ms |
50988 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
13 ms |
31120 KB |
Output is correct |
2 |
Correct |
12 ms |
31068 KB |
Output is correct |
3 |
Correct |
12 ms |
31080 KB |
Output is correct |
4 |
Correct |
10 ms |
31068 KB |
Output is correct |
5 |
Correct |
10 ms |
31068 KB |
Output is correct |
6 |
Correct |
13 ms |
31072 KB |
Output is correct |
7 |
Correct |
10 ms |
31068 KB |
Output is correct |
8 |
Correct |
12 ms |
31068 KB |
Output is correct |
9 |
Correct |
11 ms |
30916 KB |
Output is correct |
10 |
Correct |
13 ms |
31160 KB |
Output is correct |
11 |
Correct |
12 ms |
31124 KB |
Output is correct |
12 |
Correct |
13 ms |
31132 KB |
Output is correct |
13 |
Correct |
12 ms |
31068 KB |
Output is correct |
14 |
Correct |
13 ms |
31068 KB |
Output is correct |
15 |
Correct |
12 ms |
31068 KB |
Output is correct |
16 |
Correct |
11 ms |
31068 KB |
Output is correct |
17 |
Correct |
12 ms |
31068 KB |
Output is correct |
18 |
Correct |
10 ms |
31064 KB |
Output is correct |
19 |
Correct |
15 ms |
31072 KB |
Output is correct |
20 |
Correct |
12 ms |
31064 KB |
Output is correct |
21 |
Correct |
11 ms |
30968 KB |
Output is correct |
22 |
Correct |
16 ms |
30204 KB |
Output is correct |
23 |
Correct |
21 ms |
30044 KB |
Output is correct |
24 |
Correct |
15 ms |
30044 KB |
Output is correct |
25 |
Correct |
15 ms |
30036 KB |
Output is correct |
26 |
Correct |
22 ms |
30140 KB |
Output is correct |
27 |
Correct |
12 ms |
30044 KB |
Output is correct |
28 |
Correct |
19 ms |
30144 KB |
Output is correct |
29 |
Correct |
15 ms |
30044 KB |
Output is correct |
30 |
Correct |
15 ms |
30044 KB |
Output is correct |
31 |
Correct |
16 ms |
30056 KB |
Output is correct |
32 |
Correct |
20 ms |
30044 KB |
Output is correct |
33 |
Correct |
19 ms |
30044 KB |
Output is correct |
34 |
Correct |
15 ms |
30040 KB |
Output is correct |
35 |
Correct |
19 ms |
30044 KB |
Output is correct |
36 |
Correct |
14 ms |
30044 KB |
Output is correct |
37 |
Correct |
17 ms |
30044 KB |
Output is correct |
38 |
Correct |
12 ms |
32600 KB |
Output is correct |
39 |
Correct |
14 ms |
31080 KB |
Output is correct |
40 |
Correct |
10 ms |
31068 KB |
Output is correct |
41 |
Correct |
11 ms |
31064 KB |
Output is correct |
42 |
Correct |
11 ms |
31064 KB |
Output is correct |
43 |
Correct |
13 ms |
31068 KB |
Output is correct |
44 |
Correct |
11 ms |
31144 KB |
Output is correct |
45 |
Correct |
11 ms |
31068 KB |
Output is correct |
46 |
Correct |
13 ms |
31068 KB |
Output is correct |
47 |
Correct |
11 ms |
31064 KB |
Output is correct |
48 |
Correct |
10 ms |
31068 KB |
Output is correct |
49 |
Correct |
14 ms |
31068 KB |
Output is correct |
50 |
Correct |
10 ms |
31116 KB |
Output is correct |
51 |
Correct |
11 ms |
31128 KB |
Output is correct |
52 |
Correct |
12 ms |
31068 KB |
Output is correct |
53 |
Correct |
14 ms |
31068 KB |
Output is correct |
54 |
Correct |
11 ms |
31068 KB |
Output is correct |
55 |
Correct |
15 ms |
31176 KB |
Output is correct |
56 |
Correct |
11 ms |
31068 KB |
Output is correct |
57 |
Correct |
13 ms |
31112 KB |
Output is correct |
58 |
Correct |
10 ms |
31068 KB |
Output is correct |
59 |
Correct |
13 ms |
31064 KB |
Output is correct |
60 |
Correct |
12 ms |
31152 KB |
Output is correct |
61 |
Correct |
11 ms |
31068 KB |
Output is correct |
62 |
Correct |
12 ms |
31176 KB |
Output is correct |
63 |
Correct |
10 ms |
31068 KB |
Output is correct |
64 |
Correct |
12 ms |
31168 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
10 ms |
31068 KB |
Output is correct |
2 |
Correct |
10 ms |
31068 KB |
Output is correct |
3 |
Correct |
13 ms |
31160 KB |
Output is correct |
4 |
Correct |
12 ms |
31124 KB |
Output is correct |
5 |
Correct |
13 ms |
31132 KB |
Output is correct |
6 |
Correct |
12 ms |
31068 KB |
Output is correct |
7 |
Correct |
13 ms |
31068 KB |
Output is correct |
8 |
Correct |
12 ms |
31068 KB |
Output is correct |
9 |
Correct |
11 ms |
31068 KB |
Output is correct |
10 |
Correct |
12 ms |
31068 KB |
Output is correct |
11 |
Correct |
10 ms |
31064 KB |
Output is correct |
12 |
Correct |
15 ms |
31072 KB |
Output is correct |
13 |
Correct |
12 ms |
31064 KB |
Output is correct |
14 |
Correct |
11 ms |
30968 KB |
Output is correct |
15 |
Correct |
16 ms |
30204 KB |
Output is correct |
16 |
Correct |
21 ms |
30044 KB |
Output is correct |
17 |
Correct |
15 ms |
30044 KB |
Output is correct |
18 |
Correct |
15 ms |
30036 KB |
Output is correct |
19 |
Correct |
22 ms |
30140 KB |
Output is correct |
20 |
Correct |
12 ms |
30044 KB |
Output is correct |
21 |
Correct |
19 ms |
30144 KB |
Output is correct |
22 |
Correct |
15 ms |
30044 KB |
Output is correct |
23 |
Correct |
15 ms |
30044 KB |
Output is correct |
24 |
Correct |
16 ms |
30056 KB |
Output is correct |
25 |
Correct |
14 ms |
32604 KB |
Output is correct |
26 |
Correct |
14 ms |
32348 KB |
Output is correct |
27 |
Correct |
12 ms |
32348 KB |
Output is correct |
28 |
Correct |
12 ms |
32092 KB |
Output is correct |
29 |
Correct |
18 ms |
32584 KB |
Output is correct |
30 |
Correct |
15 ms |
31576 KB |
Output is correct |
31 |
Correct |
16 ms |
31580 KB |
Output is correct |
32 |
Correct |
15 ms |
32572 KB |
Output is correct |
33 |
Correct |
12 ms |
31324 KB |
Output is correct |
34 |
Correct |
21 ms |
31684 KB |
Output is correct |
35 |
Correct |
13 ms |
31324 KB |
Output is correct |
36 |
Correct |
16 ms |
31128 KB |
Output is correct |
37 |
Correct |
13 ms |
31832 KB |
Output is correct |
38 |
Correct |
16 ms |
31424 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
13 ms |
31120 KB |
Output is correct |
2 |
Correct |
12 ms |
31068 KB |
Output is correct |
3 |
Correct |
12 ms |
31080 KB |
Output is correct |
4 |
Correct |
10 ms |
31068 KB |
Output is correct |
5 |
Correct |
10 ms |
31068 KB |
Output is correct |
6 |
Correct |
13 ms |
31072 KB |
Output is correct |
7 |
Correct |
10 ms |
31068 KB |
Output is correct |
8 |
Correct |
12 ms |
31068 KB |
Output is correct |
9 |
Correct |
11 ms |
30916 KB |
Output is correct |
10 |
Correct |
13 ms |
31160 KB |
Output is correct |
11 |
Correct |
12 ms |
31124 KB |
Output is correct |
12 |
Correct |
13 ms |
31132 KB |
Output is correct |
13 |
Correct |
12 ms |
31068 KB |
Output is correct |
14 |
Correct |
13 ms |
31068 KB |
Output is correct |
15 |
Correct |
12 ms |
31068 KB |
Output is correct |
16 |
Correct |
11 ms |
31068 KB |
Output is correct |
17 |
Correct |
12 ms |
31068 KB |
Output is correct |
18 |
Correct |
10 ms |
31064 KB |
Output is correct |
19 |
Correct |
15 ms |
31072 KB |
Output is correct |
20 |
Correct |
12 ms |
31064 KB |
Output is correct |
21 |
Correct |
11 ms |
30968 KB |
Output is correct |
22 |
Correct |
16 ms |
30204 KB |
Output is correct |
23 |
Correct |
21 ms |
30044 KB |
Output is correct |
24 |
Correct |
15 ms |
30044 KB |
Output is correct |
25 |
Correct |
15 ms |
30036 KB |
Output is correct |
26 |
Correct |
22 ms |
30140 KB |
Output is correct |
27 |
Correct |
12 ms |
30044 KB |
Output is correct |
28 |
Correct |
19 ms |
30144 KB |
Output is correct |
29 |
Correct |
15 ms |
30044 KB |
Output is correct |
30 |
Correct |
15 ms |
30044 KB |
Output is correct |
31 |
Correct |
16 ms |
30056 KB |
Output is correct |
32 |
Correct |
20 ms |
30044 KB |
Output is correct |
33 |
Correct |
19 ms |
30044 KB |
Output is correct |
34 |
Correct |
15 ms |
30040 KB |
Output is correct |
35 |
Correct |
19 ms |
30044 KB |
Output is correct |
36 |
Correct |
14 ms |
30044 KB |
Output is correct |
37 |
Correct |
17 ms |
30044 KB |
Output is correct |
38 |
Correct |
12 ms |
32600 KB |
Output is correct |
39 |
Correct |
14 ms |
31080 KB |
Output is correct |
40 |
Correct |
10 ms |
31068 KB |
Output is correct |
41 |
Correct |
11 ms |
31064 KB |
Output is correct |
42 |
Correct |
16 ms |
34028 KB |
Output is correct |
43 |
Correct |
13 ms |
33808 KB |
Output is correct |
44 |
Correct |
11 ms |
32088 KB |
Output is correct |
45 |
Correct |
10 ms |
32092 KB |
Output is correct |
46 |
Correct |
11 ms |
31064 KB |
Output is correct |
47 |
Correct |
13 ms |
31068 KB |
Output is correct |
48 |
Correct |
11 ms |
31144 KB |
Output is correct |
49 |
Correct |
11 ms |
31068 KB |
Output is correct |
50 |
Correct |
13 ms |
31068 KB |
Output is correct |
51 |
Correct |
11 ms |
31064 KB |
Output is correct |
52 |
Correct |
10 ms |
31068 KB |
Output is correct |
53 |
Correct |
14 ms |
31068 KB |
Output is correct |
54 |
Correct |
10 ms |
31116 KB |
Output is correct |
55 |
Correct |
11 ms |
31128 KB |
Output is correct |
56 |
Correct |
12 ms |
31064 KB |
Output is correct |
57 |
Correct |
12 ms |
31064 KB |
Output is correct |
58 |
Correct |
13 ms |
31068 KB |
Output is correct |
59 |
Correct |
16 ms |
31324 KB |
Output is correct |
60 |
Correct |
12 ms |
31068 KB |
Output is correct |
61 |
Correct |
14 ms |
31068 KB |
Output is correct |
62 |
Correct |
11 ms |
31320 KB |
Output is correct |
63 |
Correct |
14 ms |
31324 KB |
Output is correct |
64 |
Correct |
11 ms |
31068 KB |
Output is correct |
65 |
Correct |
15 ms |
31176 KB |
Output is correct |
66 |
Correct |
11 ms |
31068 KB |
Output is correct |
67 |
Correct |
13 ms |
31112 KB |
Output is correct |
68 |
Correct |
10 ms |
31068 KB |
Output is correct |
69 |
Correct |
13 ms |
31064 KB |
Output is correct |
70 |
Correct |
12 ms |
31152 KB |
Output is correct |
71 |
Correct |
11 ms |
31068 KB |
Output is correct |
72 |
Correct |
12 ms |
31176 KB |
Output is correct |
73 |
Correct |
10 ms |
31068 KB |
Output is correct |
74 |
Correct |
12 ms |
31168 KB |
Output is correct |
75 |
Correct |
14 ms |
32604 KB |
Output is correct |
76 |
Correct |
14 ms |
32348 KB |
Output is correct |
77 |
Correct |
12 ms |
32348 KB |
Output is correct |
78 |
Correct |
12 ms |
32092 KB |
Output is correct |
79 |
Correct |
18 ms |
32584 KB |
Output is correct |
80 |
Correct |
15 ms |
31576 KB |
Output is correct |
81 |
Correct |
16 ms |
31580 KB |
Output is correct |
82 |
Correct |
15 ms |
32572 KB |
Output is correct |
83 |
Correct |
12 ms |
31324 KB |
Output is correct |
84 |
Correct |
21 ms |
31684 KB |
Output is correct |
85 |
Correct |
13 ms |
31324 KB |
Output is correct |
86 |
Correct |
16 ms |
31128 KB |
Output is correct |
87 |
Correct |
13 ms |
31832 KB |
Output is correct |
88 |
Correct |
16 ms |
31424 KB |
Output is correct |
89 |
Correct |
15 ms |
32088 KB |
Output is correct |
90 |
Correct |
16 ms |
31580 KB |
Output is correct |
91 |
Correct |
18 ms |
31672 KB |
Output is correct |
92 |
Correct |
14 ms |
31324 KB |
Output is correct |
93 |
Correct |
14 ms |
31328 KB |
Output is correct |
94 |
Correct |
19 ms |
31580 KB |
Output is correct |
95 |
Correct |
14 ms |
31324 KB |
Output is correct |
96 |
Correct |
13 ms |
31320 KB |
Output is correct |
97 |
Correct |
13 ms |
31836 KB |
Output is correct |
98 |
Correct |
14 ms |
31580 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
10 ms |
31068 KB |
Output is correct |
2 |
Correct |
10 ms |
31068 KB |
Output is correct |
3 |
Correct |
13 ms |
31160 KB |
Output is correct |
4 |
Correct |
12 ms |
31124 KB |
Output is correct |
5 |
Correct |
13 ms |
31132 KB |
Output is correct |
6 |
Correct |
12 ms |
31068 KB |
Output is correct |
7 |
Correct |
13 ms |
31068 KB |
Output is correct |
8 |
Correct |
12 ms |
31068 KB |
Output is correct |
9 |
Correct |
11 ms |
31068 KB |
Output is correct |
10 |
Correct |
12 ms |
31068 KB |
Output is correct |
11 |
Correct |
10 ms |
31064 KB |
Output is correct |
12 |
Correct |
15 ms |
31072 KB |
Output is correct |
13 |
Correct |
12 ms |
31064 KB |
Output is correct |
14 |
Correct |
11 ms |
30968 KB |
Output is correct |
15 |
Correct |
16 ms |
30204 KB |
Output is correct |
16 |
Correct |
21 ms |
30044 KB |
Output is correct |
17 |
Correct |
15 ms |
30044 KB |
Output is correct |
18 |
Correct |
15 ms |
30036 KB |
Output is correct |
19 |
Correct |
22 ms |
30140 KB |
Output is correct |
20 |
Correct |
12 ms |
30044 KB |
Output is correct |
21 |
Correct |
19 ms |
30144 KB |
Output is correct |
22 |
Correct |
15 ms |
30044 KB |
Output is correct |
23 |
Correct |
15 ms |
30044 KB |
Output is correct |
24 |
Correct |
16 ms |
30056 KB |
Output is correct |
25 |
Correct |
14 ms |
32604 KB |
Output is correct |
26 |
Correct |
14 ms |
32348 KB |
Output is correct |
27 |
Correct |
12 ms |
32348 KB |
Output is correct |
28 |
Correct |
12 ms |
32092 KB |
Output is correct |
29 |
Correct |
18 ms |
32584 KB |
Output is correct |
30 |
Correct |
15 ms |
31576 KB |
Output is correct |
31 |
Correct |
16 ms |
31580 KB |
Output is correct |
32 |
Correct |
15 ms |
32572 KB |
Output is correct |
33 |
Correct |
12 ms |
31324 KB |
Output is correct |
34 |
Correct |
21 ms |
31684 KB |
Output is correct |
35 |
Correct |
13 ms |
31324 KB |
Output is correct |
36 |
Correct |
16 ms |
31128 KB |
Output is correct |
37 |
Correct |
13 ms |
31832 KB |
Output is correct |
38 |
Correct |
16 ms |
31424 KB |
Output is correct |
39 |
Correct |
741 ms |
188244 KB |
Output is correct |
40 |
Correct |
450 ms |
169300 KB |
Output is correct |
41 |
Correct |
355 ms |
163792 KB |
Output is correct |
42 |
Correct |
168 ms |
141908 KB |
Output is correct |
43 |
Correct |
774 ms |
154708 KB |
Output is correct |
44 |
Correct |
508 ms |
73932 KB |
Output is correct |
45 |
Correct |
1675 ms |
85192 KB |
Output is correct |
46 |
Correct |
878 ms |
55460 KB |
Output is correct |
47 |
Correct |
583 ms |
52640 KB |
Output is correct |
48 |
Correct |
356 ms |
52308 KB |
Output is correct |
49 |
Correct |
232 ms |
53588 KB |
Output is correct |
50 |
Correct |
1608 ms |
87388 KB |
Output is correct |
51 |
Correct |
1016 ms |
55632 KB |
Output is correct |
52 |
Correct |
634 ms |
50256 KB |
Output is correct |
53 |
Correct |
327 ms |
50004 KB |
Output is correct |
54 |
Correct |
202 ms |
49060 KB |
Output is correct |
55 |
Correct |
326 ms |
113464 KB |
Output is correct |
56 |
Correct |
307 ms |
99152 KB |
Output is correct |
57 |
Correct |
218 ms |
54804 KB |
Output is correct |
58 |
Correct |
177 ms |
50768 KB |
Output is correct |
59 |
Correct |
172 ms |
50336 KB |
Output is correct |
60 |
Correct |
156 ms |
50004 KB |
Output is correct |
61 |
Correct |
171 ms |
50136 KB |
Output is correct |
62 |
Correct |
175 ms |
50004 KB |
Output is correct |
63 |
Correct |
444 ms |
108224 KB |
Output is correct |
64 |
Correct |
376 ms |
77492 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
13 ms |
31120 KB |
Output is correct |
2 |
Correct |
12 ms |
31068 KB |
Output is correct |
3 |
Correct |
12 ms |
31080 KB |
Output is correct |
4 |
Correct |
10 ms |
31068 KB |
Output is correct |
5 |
Correct |
10 ms |
31068 KB |
Output is correct |
6 |
Correct |
13 ms |
31072 KB |
Output is correct |
7 |
Correct |
10 ms |
31068 KB |
Output is correct |
8 |
Correct |
12 ms |
31068 KB |
Output is correct |
9 |
Correct |
11 ms |
30916 KB |
Output is correct |
10 |
Correct |
13 ms |
31160 KB |
Output is correct |
11 |
Correct |
12 ms |
31124 KB |
Output is correct |
12 |
Correct |
13 ms |
31132 KB |
Output is correct |
13 |
Correct |
12 ms |
31068 KB |
Output is correct |
14 |
Correct |
13 ms |
31068 KB |
Output is correct |
15 |
Correct |
12 ms |
31068 KB |
Output is correct |
16 |
Correct |
11 ms |
31068 KB |
Output is correct |
17 |
Correct |
12 ms |
31068 KB |
Output is correct |
18 |
Correct |
10 ms |
31064 KB |
Output is correct |
19 |
Correct |
15 ms |
31072 KB |
Output is correct |
20 |
Correct |
12 ms |
31064 KB |
Output is correct |
21 |
Correct |
11 ms |
30968 KB |
Output is correct |
22 |
Correct |
16 ms |
30204 KB |
Output is correct |
23 |
Correct |
21 ms |
30044 KB |
Output is correct |
24 |
Correct |
15 ms |
30044 KB |
Output is correct |
25 |
Correct |
15 ms |
30036 KB |
Output is correct |
26 |
Correct |
22 ms |
30140 KB |
Output is correct |
27 |
Correct |
12 ms |
30044 KB |
Output is correct |
28 |
Correct |
19 ms |
30144 KB |
Output is correct |
29 |
Correct |
15 ms |
30044 KB |
Output is correct |
30 |
Correct |
15 ms |
30044 KB |
Output is correct |
31 |
Correct |
16 ms |
30056 KB |
Output is correct |
32 |
Correct |
20 ms |
30044 KB |
Output is correct |
33 |
Correct |
19 ms |
30044 KB |
Output is correct |
34 |
Correct |
15 ms |
30040 KB |
Output is correct |
35 |
Correct |
19 ms |
30044 KB |
Output is correct |
36 |
Correct |
14 ms |
30044 KB |
Output is correct |
37 |
Correct |
17 ms |
30044 KB |
Output is correct |
38 |
Correct |
175 ms |
141976 KB |
Output is correct |
39 |
Correct |
177 ms |
142120 KB |
Output is correct |
40 |
Correct |
12 ms |
32600 KB |
Output is correct |
41 |
Correct |
14 ms |
31080 KB |
Output is correct |
42 |
Correct |
10 ms |
31068 KB |
Output is correct |
43 |
Correct |
11 ms |
31064 KB |
Output is correct |
44 |
Correct |
16 ms |
34028 KB |
Output is correct |
45 |
Correct |
13 ms |
33808 KB |
Output is correct |
46 |
Correct |
11 ms |
32088 KB |
Output is correct |
47 |
Correct |
10 ms |
32092 KB |
Output is correct |
48 |
Correct |
721 ms |
188244 KB |
Output is correct |
49 |
Correct |
488 ms |
172224 KB |
Output is correct |
50 |
Correct |
231 ms |
149744 KB |
Output is correct |
51 |
Correct |
166 ms |
142024 KB |
Output is correct |
52 |
Correct |
11 ms |
31064 KB |
Output is correct |
53 |
Correct |
13 ms |
31068 KB |
Output is correct |
54 |
Correct |
11 ms |
31144 KB |
Output is correct |
55 |
Correct |
11 ms |
31068 KB |
Output is correct |
56 |
Correct |
13 ms |
31068 KB |
Output is correct |
57 |
Correct |
11 ms |
31064 KB |
Output is correct |
58 |
Correct |
10 ms |
31068 KB |
Output is correct |
59 |
Correct |
14 ms |
31068 KB |
Output is correct |
60 |
Correct |
10 ms |
31116 KB |
Output is correct |
61 |
Correct |
11 ms |
31128 KB |
Output is correct |
62 |
Correct |
12 ms |
31064 KB |
Output is correct |
63 |
Correct |
12 ms |
31064 KB |
Output is correct |
64 |
Correct |
13 ms |
31068 KB |
Output is correct |
65 |
Correct |
16 ms |
31324 KB |
Output is correct |
66 |
Correct |
118 ms |
39248 KB |
Output is correct |
67 |
Correct |
134 ms |
38812 KB |
Output is correct |
68 |
Correct |
152 ms |
39032 KB |
Output is correct |
69 |
Correct |
285 ms |
65984 KB |
Output is correct |
70 |
Correct |
12 ms |
31068 KB |
Output is correct |
71 |
Correct |
14 ms |
31068 KB |
Output is correct |
72 |
Correct |
11 ms |
31320 KB |
Output is correct |
73 |
Correct |
14 ms |
31324 KB |
Output is correct |
74 |
Correct |
145 ms |
63308 KB |
Output is correct |
75 |
Correct |
181 ms |
50988 KB |
Output is correct |
76 |
Correct |
11 ms |
31068 KB |
Output is correct |
77 |
Correct |
15 ms |
31176 KB |
Output is correct |
78 |
Correct |
11 ms |
31068 KB |
Output is correct |
79 |
Correct |
13 ms |
31112 KB |
Output is correct |
80 |
Correct |
10 ms |
31068 KB |
Output is correct |
81 |
Correct |
13 ms |
31064 KB |
Output is correct |
82 |
Correct |
12 ms |
31152 KB |
Output is correct |
83 |
Correct |
11 ms |
31068 KB |
Output is correct |
84 |
Correct |
12 ms |
31176 KB |
Output is correct |
85 |
Correct |
10 ms |
31068 KB |
Output is correct |
86 |
Correct |
12 ms |
31168 KB |
Output is correct |
87 |
Correct |
14 ms |
32604 KB |
Output is correct |
88 |
Correct |
14 ms |
32348 KB |
Output is correct |
89 |
Correct |
12 ms |
32348 KB |
Output is correct |
90 |
Correct |
12 ms |
32092 KB |
Output is correct |
91 |
Correct |
18 ms |
32584 KB |
Output is correct |
92 |
Correct |
15 ms |
31576 KB |
Output is correct |
93 |
Correct |
16 ms |
31580 KB |
Output is correct |
94 |
Correct |
15 ms |
32572 KB |
Output is correct |
95 |
Correct |
12 ms |
31324 KB |
Output is correct |
96 |
Correct |
21 ms |
31684 KB |
Output is correct |
97 |
Correct |
13 ms |
31324 KB |
Output is correct |
98 |
Correct |
16 ms |
31128 KB |
Output is correct |
99 |
Correct |
13 ms |
31832 KB |
Output is correct |
100 |
Correct |
16 ms |
31424 KB |
Output is correct |
101 |
Correct |
15 ms |
32088 KB |
Output is correct |
102 |
Correct |
16 ms |
31580 KB |
Output is correct |
103 |
Correct |
18 ms |
31672 KB |
Output is correct |
104 |
Correct |
14 ms |
31324 KB |
Output is correct |
105 |
Correct |
14 ms |
31328 KB |
Output is correct |
106 |
Correct |
19 ms |
31580 KB |
Output is correct |
107 |
Correct |
14 ms |
31324 KB |
Output is correct |
108 |
Correct |
13 ms |
31320 KB |
Output is correct |
109 |
Correct |
13 ms |
31836 KB |
Output is correct |
110 |
Correct |
14 ms |
31580 KB |
Output is correct |
111 |
Correct |
741 ms |
188244 KB |
Output is correct |
112 |
Correct |
450 ms |
169300 KB |
Output is correct |
113 |
Correct |
355 ms |
163792 KB |
Output is correct |
114 |
Correct |
168 ms |
141908 KB |
Output is correct |
115 |
Correct |
774 ms |
154708 KB |
Output is correct |
116 |
Correct |
508 ms |
73932 KB |
Output is correct |
117 |
Correct |
1675 ms |
85192 KB |
Output is correct |
118 |
Correct |
878 ms |
55460 KB |
Output is correct |
119 |
Correct |
583 ms |
52640 KB |
Output is correct |
120 |
Correct |
356 ms |
52308 KB |
Output is correct |
121 |
Correct |
232 ms |
53588 KB |
Output is correct |
122 |
Correct |
1608 ms |
87388 KB |
Output is correct |
123 |
Correct |
1016 ms |
55632 KB |
Output is correct |
124 |
Correct |
634 ms |
50256 KB |
Output is correct |
125 |
Correct |
327 ms |
50004 KB |
Output is correct |
126 |
Correct |
202 ms |
49060 KB |
Output is correct |
127 |
Correct |
326 ms |
113464 KB |
Output is correct |
128 |
Correct |
307 ms |
99152 KB |
Output is correct |
129 |
Correct |
218 ms |
54804 KB |
Output is correct |
130 |
Correct |
177 ms |
50768 KB |
Output is correct |
131 |
Correct |
172 ms |
50336 KB |
Output is correct |
132 |
Correct |
156 ms |
50004 KB |
Output is correct |
133 |
Correct |
171 ms |
50136 KB |
Output is correct |
134 |
Correct |
175 ms |
50004 KB |
Output is correct |
135 |
Correct |
444 ms |
108224 KB |
Output is correct |
136 |
Correct |
376 ms |
77492 KB |
Output is correct |
137 |
Correct |
716 ms |
145316 KB |
Output is correct |
138 |
Correct |
423 ms |
79756 KB |
Output is correct |
139 |
Correct |
1193 ms |
93192 KB |
Output is correct |
140 |
Correct |
643 ms |
56696 KB |
Output is correct |
141 |
Correct |
463 ms |
53928 KB |
Output is correct |
142 |
Correct |
256 ms |
53584 KB |
Output is correct |
143 |
Correct |
190 ms |
55632 KB |
Output is correct |
144 |
Correct |
1075 ms |
92680 KB |
Output is correct |
145 |
Correct |
757 ms |
55380 KB |
Output is correct |
146 |
Correct |
551 ms |
51244 KB |
Output is correct |
147 |
Correct |
390 ms |
50772 KB |
Output is correct |
148 |
Correct |
183 ms |
49748 KB |
Output is correct |
149 |
Correct |
249 ms |
93776 KB |
Output is correct |
150 |
Correct |
240 ms |
94036 KB |
Output is correct |
151 |
Correct |
226 ms |
56400 KB |
Output is correct |
152 |
Correct |
180 ms |
52052 KB |
Output is correct |
153 |
Correct |
202 ms |
51024 KB |
Output is correct |
154 |
Correct |
162 ms |
51284 KB |
Output is correct |
155 |
Correct |
135 ms |
50920 KB |
Output is correct |
156 |
Correct |
145 ms |
51028 KB |
Output is correct |
157 |
Correct |
462 ms |
109304 KB |
Output is correct |
158 |
Correct |
337 ms |
78576 KB |
Output is correct |