#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 = 3e5 + 5;
const ll mod = 1e9 + 9;
struct Mint {
ll val;
Mint(__int128 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((__int128)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((__int128)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];
#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 subarb[nmax];
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 {
//cerr << nod << '\n';
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;
//cerr << node << ", " << other << '\n';
//for(int i = 0; i < END0; i++) cerr << getL(i, i).v[0].val << ' '; cerr << '\n';
//for(int i = 0; i < END1; i++) cerr << getR(i, i).v[0].val << ' '; cerr << '\n';
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];
//cerr << nxt0 << ' ' << t0 << '\t' << nxt1 << ' ' << t1 << '\t' << r0 << ", " << r1 << '\n';
if(t1 == 0 && C[nxt1] < C[nxt0]) return {-1};
if(t0 == 1) return {-1};
visit(visit, nxt0, r0);
}
l0 = r0 + 1;
l1 = r1 + 1;
}
//cerr << "<\\>\n";
if(l0 == END0 && l1 < END1) return {-1};
while(l0 < END0) {
auto [nxt0, t0] = euler[pin[node] + l0];
visit(visit, nxt0, l0);
}
//cerr << "<\\>\n";
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.onlevel, onlevel), swap(inverse, x.inverse);
int prv = -1;
for(auto [h, v] : x.onlevel) {
add(h, prv, v);
prv = h;
}
x.onlevel.clear();
x.inverse.clear();
return;
}
};
map<int, int> pula1, pula2;
void print_(int node) {
pula1[node];
for(auto [x, c] : g[node]) {
pula2[c];
print_(x);
}
return;
}
void print__(int node) {
for(auto [x, c] : g[node]) {
cout << pula1[node] << ' ' << pula1[x] << ' ' << pula2[c] << '\n';
print__(x);
}
return;
}
void print(int node) {
}
PartDiff dfs(int node) {
PartDiff mine;
int heavyson = -1;
coaielemele = 0;
if(node == 1201) {
coaielemele = 1;
print(node);
sort(all(g[node]), [&](auto a, auto b) { return sz(g[a.first]) < sz(g[b.first]); });
}
for(auto &[x, c] : g[node]) {
auto T = dfs(x);
if(node == 1201) coaielemele = 1;
//cout << x << " pula \n" << T.feasable << '\n';
mine.add(T); // asta teoretic e useless ca din superimpozabilitate toate vor fi deja acolo, e mai mult un fel de check :clown:
// oare checkul simplu poate fi facut mai putin cretin thinking thinking
//cout << x << " pula \n" << T.feasable << '\n';
if(heavyson == -1 || area[x] > area[heavyson]) heavyson = x;
//cout << node << ' ' << x << '\t' << mine.feasable << ' ' << T.feasable << '\n';
//if(node == 258) {
//for(auto [t, c] : g[x]) cerr << c << ' ';
//cerr << '\n';
//}
}
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);
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:167:12: warning: unused variable 'coaiee' [-Wunused-variable]
167 | bool coaiee = coaielemele;
| ^~~~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
21 ms |
47228 KB |
Output is correct |
2 |
Correct |
21 ms |
47196 KB |
Output is correct |
3 |
Correct |
31 ms |
47196 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
20 ms |
47200 KB |
Output is correct |
2 |
Correct |
20 ms |
47196 KB |
Output is correct |
3 |
Correct |
20 ms |
47188 KB |
Output is correct |
4 |
Correct |
20 ms |
47192 KB |
Output is correct |
5 |
Correct |
20 ms |
47196 KB |
Output is correct |
6 |
Correct |
31 ms |
47196 KB |
Output is correct |
7 |
Correct |
20 ms |
47260 KB |
Output is correct |
8 |
Correct |
20 ms |
47196 KB |
Output is correct |
9 |
Correct |
20 ms |
47424 KB |
Output is correct |
10 |
Correct |
31 ms |
47320 KB |
Output is correct |
11 |
Correct |
20 ms |
47196 KB |
Output is correct |
12 |
Correct |
20 ms |
47196 KB |
Output is correct |
13 |
Correct |
20 ms |
47416 KB |
Output is correct |
14 |
Correct |
31 ms |
47400 KB |
Output is correct |
15 |
Correct |
24 ms |
47192 KB |
Output is correct |
16 |
Correct |
31 ms |
47308 KB |
Output is correct |
17 |
Correct |
20 ms |
47192 KB |
Output is correct |
18 |
Correct |
25 ms |
47196 KB |
Output is correct |
19 |
Correct |
20 ms |
47268 KB |
Output is correct |
20 |
Correct |
20 ms |
47192 KB |
Output is correct |
21 |
Correct |
20 ms |
47196 KB |
Output is correct |
22 |
Correct |
20 ms |
47192 KB |
Output is correct |
23 |
Correct |
20 ms |
47192 KB |
Output is correct |
24 |
Correct |
21 ms |
47196 KB |
Output is correct |
25 |
Correct |
19 ms |
47196 KB |
Output is correct |
26 |
Correct |
31 ms |
47408 KB |
Output is correct |
27 |
Correct |
31 ms |
47196 KB |
Output is correct |
28 |
Correct |
20 ms |
47196 KB |
Output is correct |
29 |
Correct |
22 ms |
47396 KB |
Output is correct |
30 |
Correct |
20 ms |
47192 KB |
Output is correct |
31 |
Correct |
21 ms |
47196 KB |
Output is correct |
32 |
Correct |
20 ms |
47196 KB |
Output is correct |
33 |
Correct |
20 ms |
47196 KB |
Output is correct |
34 |
Correct |
20 ms |
47288 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
20 ms |
47200 KB |
Output is correct |
2 |
Correct |
20 ms |
47196 KB |
Output is correct |
3 |
Correct |
20 ms |
47188 KB |
Output is correct |
4 |
Correct |
20 ms |
47192 KB |
Output is correct |
5 |
Correct |
20 ms |
47196 KB |
Output is correct |
6 |
Correct |
31 ms |
47196 KB |
Output is correct |
7 |
Correct |
149 ms |
146004 KB |
Output is correct |
8 |
Correct |
141 ms |
146004 KB |
Output is correct |
9 |
Correct |
20 ms |
47444 KB |
Output is correct |
10 |
Correct |
21 ms |
47448 KB |
Output is correct |
11 |
Correct |
26 ms |
47444 KB |
Output is correct |
12 |
Correct |
21 ms |
47448 KB |
Output is correct |
13 |
Correct |
25 ms |
48732 KB |
Output is correct |
14 |
Correct |
28 ms |
48724 KB |
Output is correct |
15 |
Correct |
21 ms |
48220 KB |
Output is correct |
16 |
Correct |
21 ms |
48216 KB |
Output is correct |
17 |
Correct |
924 ms |
192084 KB |
Output is correct |
18 |
Correct |
613 ms |
176316 KB |
Output is correct |
19 |
Correct |
249 ms |
153680 KB |
Output is correct |
20 |
Correct |
143 ms |
146000 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
21 ms |
47196 KB |
Output is correct |
2 |
Correct |
20 ms |
47452 KB |
Output is correct |
3 |
Correct |
31 ms |
47184 KB |
Output is correct |
4 |
Correct |
24 ms |
47408 KB |
Output is correct |
5 |
Correct |
31 ms |
47196 KB |
Output is correct |
6 |
Correct |
20 ms |
47192 KB |
Output is correct |
7 |
Correct |
20 ms |
47196 KB |
Output is correct |
8 |
Correct |
21 ms |
47192 KB |
Output is correct |
9 |
Correct |
20 ms |
47452 KB |
Output is correct |
10 |
Correct |
20 ms |
47448 KB |
Output is correct |
11 |
Correct |
21 ms |
47424 KB |
Output is correct |
12 |
Correct |
26 ms |
47384 KB |
Output is correct |
13 |
Correct |
26 ms |
47448 KB |
Output is correct |
14 |
Correct |
22 ms |
47952 KB |
Output is correct |
15 |
Correct |
155 ms |
57024 KB |
Output is correct |
16 |
Correct |
160 ms |
56580 KB |
Output is correct |
17 |
Correct |
192 ms |
56788 KB |
Output is correct |
18 |
Correct |
279 ms |
83760 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
20 ms |
47200 KB |
Output is correct |
2 |
Correct |
20 ms |
47196 KB |
Output is correct |
3 |
Correct |
20 ms |
47260 KB |
Output is correct |
4 |
Correct |
20 ms |
47196 KB |
Output is correct |
5 |
Correct |
149 ms |
146004 KB |
Output is correct |
6 |
Correct |
141 ms |
146004 KB |
Output is correct |
7 |
Correct |
20 ms |
47452 KB |
Output is correct |
8 |
Correct |
20 ms |
47416 KB |
Output is correct |
9 |
Correct |
33 ms |
47688 KB |
Output is correct |
10 |
Correct |
22 ms |
47448 KB |
Output is correct |
11 |
Correct |
185 ms |
82104 KB |
Output is correct |
12 |
Correct |
219 ms |
70348 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
21 ms |
47228 KB |
Output is correct |
2 |
Correct |
21 ms |
47196 KB |
Output is correct |
3 |
Correct |
31 ms |
47196 KB |
Output is correct |
4 |
Correct |
20 ms |
47200 KB |
Output is correct |
5 |
Correct |
20 ms |
47196 KB |
Output is correct |
6 |
Correct |
20 ms |
47188 KB |
Output is correct |
7 |
Correct |
20 ms |
47192 KB |
Output is correct |
8 |
Correct |
20 ms |
47196 KB |
Output is correct |
9 |
Correct |
31 ms |
47196 KB |
Output is correct |
10 |
Correct |
20 ms |
47260 KB |
Output is correct |
11 |
Correct |
20 ms |
47196 KB |
Output is correct |
12 |
Correct |
20 ms |
47424 KB |
Output is correct |
13 |
Correct |
31 ms |
47320 KB |
Output is correct |
14 |
Correct |
20 ms |
47196 KB |
Output is correct |
15 |
Correct |
20 ms |
47196 KB |
Output is correct |
16 |
Correct |
20 ms |
47416 KB |
Output is correct |
17 |
Correct |
31 ms |
47400 KB |
Output is correct |
18 |
Correct |
24 ms |
47192 KB |
Output is correct |
19 |
Correct |
31 ms |
47308 KB |
Output is correct |
20 |
Correct |
20 ms |
47192 KB |
Output is correct |
21 |
Correct |
25 ms |
47196 KB |
Output is correct |
22 |
Correct |
20 ms |
47268 KB |
Output is correct |
23 |
Correct |
20 ms |
47192 KB |
Output is correct |
24 |
Correct |
20 ms |
47196 KB |
Output is correct |
25 |
Correct |
20 ms |
47192 KB |
Output is correct |
26 |
Correct |
20 ms |
47192 KB |
Output is correct |
27 |
Correct |
21 ms |
47196 KB |
Output is correct |
28 |
Correct |
19 ms |
47196 KB |
Output is correct |
29 |
Correct |
31 ms |
47408 KB |
Output is correct |
30 |
Correct |
31 ms |
47196 KB |
Output is correct |
31 |
Correct |
20 ms |
47196 KB |
Output is correct |
32 |
Correct |
22 ms |
47396 KB |
Output is correct |
33 |
Correct |
20 ms |
47192 KB |
Output is correct |
34 |
Correct |
21 ms |
47196 KB |
Output is correct |
35 |
Correct |
20 ms |
47196 KB |
Output is correct |
36 |
Correct |
20 ms |
47196 KB |
Output is correct |
37 |
Correct |
20 ms |
47288 KB |
Output is correct |
38 |
Correct |
20 ms |
47444 KB |
Output is correct |
39 |
Correct |
21 ms |
47448 KB |
Output is correct |
40 |
Correct |
26 ms |
47444 KB |
Output is correct |
41 |
Correct |
21 ms |
47448 KB |
Output is correct |
42 |
Correct |
21 ms |
47196 KB |
Output is correct |
43 |
Correct |
20 ms |
47452 KB |
Output is correct |
44 |
Correct |
31 ms |
47184 KB |
Output is correct |
45 |
Correct |
24 ms |
47408 KB |
Output is correct |
46 |
Correct |
31 ms |
47196 KB |
Output is correct |
47 |
Correct |
20 ms |
47192 KB |
Output is correct |
48 |
Correct |
20 ms |
47196 KB |
Output is correct |
49 |
Correct |
21 ms |
47192 KB |
Output is correct |
50 |
Correct |
20 ms |
47452 KB |
Output is correct |
51 |
Correct |
20 ms |
47448 KB |
Output is correct |
52 |
Correct |
20 ms |
47452 KB |
Output is correct |
53 |
Correct |
20 ms |
47416 KB |
Output is correct |
54 |
Correct |
21 ms |
47704 KB |
Output is correct |
55 |
Correct |
21 ms |
47320 KB |
Output is correct |
56 |
Correct |
20 ms |
47452 KB |
Output is correct |
57 |
Correct |
22 ms |
47444 KB |
Output is correct |
58 |
Correct |
32 ms |
47188 KB |
Output is correct |
59 |
Correct |
21 ms |
47452 KB |
Output is correct |
60 |
Correct |
24 ms |
47408 KB |
Output is correct |
61 |
Correct |
21 ms |
47412 KB |
Output is correct |
62 |
Correct |
20 ms |
47420 KB |
Output is correct |
63 |
Correct |
23 ms |
47352 KB |
Output is correct |
64 |
Correct |
21 ms |
47452 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
20 ms |
47200 KB |
Output is correct |
2 |
Correct |
20 ms |
47196 KB |
Output is correct |
3 |
Correct |
20 ms |
47260 KB |
Output is correct |
4 |
Correct |
20 ms |
47196 KB |
Output is correct |
5 |
Correct |
20 ms |
47424 KB |
Output is correct |
6 |
Correct |
31 ms |
47320 KB |
Output is correct |
7 |
Correct |
20 ms |
47196 KB |
Output is correct |
8 |
Correct |
20 ms |
47196 KB |
Output is correct |
9 |
Correct |
20 ms |
47416 KB |
Output is correct |
10 |
Correct |
31 ms |
47400 KB |
Output is correct |
11 |
Correct |
24 ms |
47192 KB |
Output is correct |
12 |
Correct |
31 ms |
47308 KB |
Output is correct |
13 |
Correct |
20 ms |
47192 KB |
Output is correct |
14 |
Correct |
25 ms |
47196 KB |
Output is correct |
15 |
Correct |
20 ms |
47268 KB |
Output is correct |
16 |
Correct |
20 ms |
47192 KB |
Output is correct |
17 |
Correct |
20 ms |
47196 KB |
Output is correct |
18 |
Correct |
20 ms |
47192 KB |
Output is correct |
19 |
Correct |
20 ms |
47192 KB |
Output is correct |
20 |
Correct |
21 ms |
47196 KB |
Output is correct |
21 |
Correct |
19 ms |
47196 KB |
Output is correct |
22 |
Correct |
31 ms |
47408 KB |
Output is correct |
23 |
Correct |
31 ms |
47196 KB |
Output is correct |
24 |
Correct |
20 ms |
47196 KB |
Output is correct |
25 |
Correct |
25 ms |
48732 KB |
Output is correct |
26 |
Correct |
24 ms |
48476 KB |
Output is correct |
27 |
Correct |
23 ms |
48476 KB |
Output is correct |
28 |
Correct |
33 ms |
48220 KB |
Output is correct |
29 |
Correct |
28 ms |
48720 KB |
Output is correct |
30 |
Correct |
25 ms |
47696 KB |
Output is correct |
31 |
Correct |
29 ms |
47964 KB |
Output is correct |
32 |
Correct |
38 ms |
47500 KB |
Output is correct |
33 |
Correct |
24 ms |
47420 KB |
Output is correct |
34 |
Correct |
30 ms |
47960 KB |
Output is correct |
35 |
Correct |
25 ms |
47708 KB |
Output is correct |
36 |
Correct |
25 ms |
47452 KB |
Output is correct |
37 |
Correct |
24 ms |
47964 KB |
Output is correct |
38 |
Correct |
25 ms |
47712 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
21 ms |
47228 KB |
Output is correct |
2 |
Correct |
21 ms |
47196 KB |
Output is correct |
3 |
Correct |
31 ms |
47196 KB |
Output is correct |
4 |
Correct |
20 ms |
47200 KB |
Output is correct |
5 |
Correct |
20 ms |
47196 KB |
Output is correct |
6 |
Correct |
20 ms |
47188 KB |
Output is correct |
7 |
Correct |
20 ms |
47192 KB |
Output is correct |
8 |
Correct |
20 ms |
47196 KB |
Output is correct |
9 |
Correct |
31 ms |
47196 KB |
Output is correct |
10 |
Correct |
20 ms |
47260 KB |
Output is correct |
11 |
Correct |
20 ms |
47196 KB |
Output is correct |
12 |
Correct |
20 ms |
47424 KB |
Output is correct |
13 |
Correct |
31 ms |
47320 KB |
Output is correct |
14 |
Correct |
20 ms |
47196 KB |
Output is correct |
15 |
Correct |
20 ms |
47196 KB |
Output is correct |
16 |
Correct |
20 ms |
47416 KB |
Output is correct |
17 |
Correct |
31 ms |
47400 KB |
Output is correct |
18 |
Correct |
24 ms |
47192 KB |
Output is correct |
19 |
Correct |
31 ms |
47308 KB |
Output is correct |
20 |
Correct |
20 ms |
47192 KB |
Output is correct |
21 |
Correct |
25 ms |
47196 KB |
Output is correct |
22 |
Correct |
20 ms |
47268 KB |
Output is correct |
23 |
Correct |
20 ms |
47192 KB |
Output is correct |
24 |
Correct |
20 ms |
47196 KB |
Output is correct |
25 |
Correct |
20 ms |
47192 KB |
Output is correct |
26 |
Correct |
20 ms |
47192 KB |
Output is correct |
27 |
Correct |
21 ms |
47196 KB |
Output is correct |
28 |
Correct |
19 ms |
47196 KB |
Output is correct |
29 |
Correct |
31 ms |
47408 KB |
Output is correct |
30 |
Correct |
31 ms |
47196 KB |
Output is correct |
31 |
Correct |
20 ms |
47196 KB |
Output is correct |
32 |
Correct |
22 ms |
47396 KB |
Output is correct |
33 |
Correct |
20 ms |
47192 KB |
Output is correct |
34 |
Correct |
21 ms |
47196 KB |
Output is correct |
35 |
Correct |
20 ms |
47196 KB |
Output is correct |
36 |
Correct |
20 ms |
47196 KB |
Output is correct |
37 |
Correct |
20 ms |
47288 KB |
Output is correct |
38 |
Correct |
20 ms |
47444 KB |
Output is correct |
39 |
Correct |
21 ms |
47448 KB |
Output is correct |
40 |
Correct |
26 ms |
47444 KB |
Output is correct |
41 |
Correct |
21 ms |
47448 KB |
Output is correct |
42 |
Correct |
25 ms |
48732 KB |
Output is correct |
43 |
Correct |
28 ms |
48724 KB |
Output is correct |
44 |
Correct |
21 ms |
48220 KB |
Output is correct |
45 |
Correct |
21 ms |
48216 KB |
Output is correct |
46 |
Correct |
21 ms |
47196 KB |
Output is correct |
47 |
Correct |
20 ms |
47452 KB |
Output is correct |
48 |
Correct |
31 ms |
47184 KB |
Output is correct |
49 |
Correct |
24 ms |
47408 KB |
Output is correct |
50 |
Correct |
31 ms |
47196 KB |
Output is correct |
51 |
Correct |
20 ms |
47192 KB |
Output is correct |
52 |
Correct |
20 ms |
47196 KB |
Output is correct |
53 |
Correct |
21 ms |
47192 KB |
Output is correct |
54 |
Correct |
20 ms |
47452 KB |
Output is correct |
55 |
Correct |
20 ms |
47448 KB |
Output is correct |
56 |
Correct |
21 ms |
47424 KB |
Output is correct |
57 |
Correct |
26 ms |
47384 KB |
Output is correct |
58 |
Correct |
26 ms |
47448 KB |
Output is correct |
59 |
Correct |
22 ms |
47952 KB |
Output is correct |
60 |
Correct |
20 ms |
47452 KB |
Output is correct |
61 |
Correct |
20 ms |
47416 KB |
Output is correct |
62 |
Correct |
33 ms |
47688 KB |
Output is correct |
63 |
Correct |
22 ms |
47448 KB |
Output is correct |
64 |
Correct |
21 ms |
47704 KB |
Output is correct |
65 |
Correct |
21 ms |
47320 KB |
Output is correct |
66 |
Correct |
20 ms |
47452 KB |
Output is correct |
67 |
Correct |
22 ms |
47444 KB |
Output is correct |
68 |
Correct |
32 ms |
47188 KB |
Output is correct |
69 |
Correct |
21 ms |
47452 KB |
Output is correct |
70 |
Correct |
24 ms |
47408 KB |
Output is correct |
71 |
Correct |
21 ms |
47412 KB |
Output is correct |
72 |
Correct |
20 ms |
47420 KB |
Output is correct |
73 |
Correct |
23 ms |
47352 KB |
Output is correct |
74 |
Correct |
21 ms |
47452 KB |
Output is correct |
75 |
Correct |
25 ms |
48732 KB |
Output is correct |
76 |
Correct |
24 ms |
48476 KB |
Output is correct |
77 |
Correct |
23 ms |
48476 KB |
Output is correct |
78 |
Correct |
33 ms |
48220 KB |
Output is correct |
79 |
Correct |
28 ms |
48720 KB |
Output is correct |
80 |
Correct |
25 ms |
47696 KB |
Output is correct |
81 |
Correct |
29 ms |
47964 KB |
Output is correct |
82 |
Correct |
38 ms |
47500 KB |
Output is correct |
83 |
Correct |
24 ms |
47420 KB |
Output is correct |
84 |
Correct |
30 ms |
47960 KB |
Output is correct |
85 |
Correct |
25 ms |
47708 KB |
Output is correct |
86 |
Correct |
25 ms |
47452 KB |
Output is correct |
87 |
Correct |
24 ms |
47964 KB |
Output is correct |
88 |
Correct |
25 ms |
47712 KB |
Output is correct |
89 |
Correct |
26 ms |
48472 KB |
Output is correct |
90 |
Correct |
24 ms |
47700 KB |
Output is correct |
91 |
Correct |
27 ms |
47904 KB |
Output is correct |
92 |
Correct |
40 ms |
47716 KB |
Output is correct |
93 |
Correct |
22 ms |
47452 KB |
Output is correct |
94 |
Correct |
40 ms |
47956 KB |
Output is correct |
95 |
Correct |
26 ms |
47704 KB |
Output is correct |
96 |
Correct |
26 ms |
47452 KB |
Output is correct |
97 |
Correct |
25 ms |
47964 KB |
Output is correct |
98 |
Correct |
29 ms |
47884 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
20 ms |
47200 KB |
Output is correct |
2 |
Correct |
20 ms |
47196 KB |
Output is correct |
3 |
Correct |
20 ms |
47260 KB |
Output is correct |
4 |
Correct |
20 ms |
47196 KB |
Output is correct |
5 |
Correct |
20 ms |
47424 KB |
Output is correct |
6 |
Correct |
31 ms |
47320 KB |
Output is correct |
7 |
Correct |
20 ms |
47196 KB |
Output is correct |
8 |
Correct |
20 ms |
47196 KB |
Output is correct |
9 |
Correct |
20 ms |
47416 KB |
Output is correct |
10 |
Correct |
31 ms |
47400 KB |
Output is correct |
11 |
Correct |
24 ms |
47192 KB |
Output is correct |
12 |
Correct |
31 ms |
47308 KB |
Output is correct |
13 |
Correct |
20 ms |
47192 KB |
Output is correct |
14 |
Correct |
25 ms |
47196 KB |
Output is correct |
15 |
Correct |
20 ms |
47268 KB |
Output is correct |
16 |
Correct |
20 ms |
47192 KB |
Output is correct |
17 |
Correct |
20 ms |
47196 KB |
Output is correct |
18 |
Correct |
20 ms |
47192 KB |
Output is correct |
19 |
Correct |
20 ms |
47192 KB |
Output is correct |
20 |
Correct |
21 ms |
47196 KB |
Output is correct |
21 |
Correct |
19 ms |
47196 KB |
Output is correct |
22 |
Correct |
31 ms |
47408 KB |
Output is correct |
23 |
Correct |
31 ms |
47196 KB |
Output is correct |
24 |
Correct |
20 ms |
47196 KB |
Output is correct |
25 |
Correct |
25 ms |
48732 KB |
Output is correct |
26 |
Correct |
24 ms |
48476 KB |
Output is correct |
27 |
Correct |
23 ms |
48476 KB |
Output is correct |
28 |
Correct |
33 ms |
48220 KB |
Output is correct |
29 |
Correct |
28 ms |
48720 KB |
Output is correct |
30 |
Correct |
25 ms |
47696 KB |
Output is correct |
31 |
Correct |
29 ms |
47964 KB |
Output is correct |
32 |
Correct |
38 ms |
47500 KB |
Output is correct |
33 |
Correct |
24 ms |
47420 KB |
Output is correct |
34 |
Correct |
30 ms |
47960 KB |
Output is correct |
35 |
Correct |
25 ms |
47708 KB |
Output is correct |
36 |
Correct |
25 ms |
47452 KB |
Output is correct |
37 |
Correct |
24 ms |
47964 KB |
Output is correct |
38 |
Correct |
25 ms |
47712 KB |
Output is correct |
39 |
Correct |
1012 ms |
191316 KB |
Output is correct |
40 |
Correct |
616 ms |
172372 KB |
Output is correct |
41 |
Correct |
508 ms |
166868 KB |
Output is correct |
42 |
Correct |
152 ms |
145128 KB |
Output is correct |
43 |
Correct |
983 ms |
163760 KB |
Output is correct |
44 |
Correct |
678 ms |
90980 KB |
Output is correct |
45 |
Execution timed out |
2037 ms |
101556 KB |
Time limit exceeded |
46 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
21 ms |
47228 KB |
Output is correct |
2 |
Correct |
21 ms |
47196 KB |
Output is correct |
3 |
Correct |
31 ms |
47196 KB |
Output is correct |
4 |
Correct |
20 ms |
47200 KB |
Output is correct |
5 |
Correct |
20 ms |
47196 KB |
Output is correct |
6 |
Correct |
20 ms |
47188 KB |
Output is correct |
7 |
Correct |
20 ms |
47192 KB |
Output is correct |
8 |
Correct |
20 ms |
47196 KB |
Output is correct |
9 |
Correct |
31 ms |
47196 KB |
Output is correct |
10 |
Correct |
20 ms |
47260 KB |
Output is correct |
11 |
Correct |
20 ms |
47196 KB |
Output is correct |
12 |
Correct |
20 ms |
47424 KB |
Output is correct |
13 |
Correct |
31 ms |
47320 KB |
Output is correct |
14 |
Correct |
20 ms |
47196 KB |
Output is correct |
15 |
Correct |
20 ms |
47196 KB |
Output is correct |
16 |
Correct |
20 ms |
47416 KB |
Output is correct |
17 |
Correct |
31 ms |
47400 KB |
Output is correct |
18 |
Correct |
24 ms |
47192 KB |
Output is correct |
19 |
Correct |
31 ms |
47308 KB |
Output is correct |
20 |
Correct |
20 ms |
47192 KB |
Output is correct |
21 |
Correct |
25 ms |
47196 KB |
Output is correct |
22 |
Correct |
20 ms |
47268 KB |
Output is correct |
23 |
Correct |
20 ms |
47192 KB |
Output is correct |
24 |
Correct |
20 ms |
47196 KB |
Output is correct |
25 |
Correct |
20 ms |
47192 KB |
Output is correct |
26 |
Correct |
20 ms |
47192 KB |
Output is correct |
27 |
Correct |
21 ms |
47196 KB |
Output is correct |
28 |
Correct |
19 ms |
47196 KB |
Output is correct |
29 |
Correct |
31 ms |
47408 KB |
Output is correct |
30 |
Correct |
31 ms |
47196 KB |
Output is correct |
31 |
Correct |
20 ms |
47196 KB |
Output is correct |
32 |
Correct |
22 ms |
47396 KB |
Output is correct |
33 |
Correct |
20 ms |
47192 KB |
Output is correct |
34 |
Correct |
21 ms |
47196 KB |
Output is correct |
35 |
Correct |
20 ms |
47196 KB |
Output is correct |
36 |
Correct |
20 ms |
47196 KB |
Output is correct |
37 |
Correct |
20 ms |
47288 KB |
Output is correct |
38 |
Correct |
149 ms |
146004 KB |
Output is correct |
39 |
Correct |
141 ms |
146004 KB |
Output is correct |
40 |
Correct |
20 ms |
47444 KB |
Output is correct |
41 |
Correct |
21 ms |
47448 KB |
Output is correct |
42 |
Correct |
26 ms |
47444 KB |
Output is correct |
43 |
Correct |
21 ms |
47448 KB |
Output is correct |
44 |
Correct |
25 ms |
48732 KB |
Output is correct |
45 |
Correct |
28 ms |
48724 KB |
Output is correct |
46 |
Correct |
21 ms |
48220 KB |
Output is correct |
47 |
Correct |
21 ms |
48216 KB |
Output is correct |
48 |
Correct |
924 ms |
192084 KB |
Output is correct |
49 |
Correct |
613 ms |
176316 KB |
Output is correct |
50 |
Correct |
249 ms |
153680 KB |
Output is correct |
51 |
Correct |
143 ms |
146000 KB |
Output is correct |
52 |
Correct |
21 ms |
47196 KB |
Output is correct |
53 |
Correct |
20 ms |
47452 KB |
Output is correct |
54 |
Correct |
31 ms |
47184 KB |
Output is correct |
55 |
Correct |
24 ms |
47408 KB |
Output is correct |
56 |
Correct |
31 ms |
47196 KB |
Output is correct |
57 |
Correct |
20 ms |
47192 KB |
Output is correct |
58 |
Correct |
20 ms |
47196 KB |
Output is correct |
59 |
Correct |
21 ms |
47192 KB |
Output is correct |
60 |
Correct |
20 ms |
47452 KB |
Output is correct |
61 |
Correct |
20 ms |
47448 KB |
Output is correct |
62 |
Correct |
21 ms |
47424 KB |
Output is correct |
63 |
Correct |
26 ms |
47384 KB |
Output is correct |
64 |
Correct |
26 ms |
47448 KB |
Output is correct |
65 |
Correct |
22 ms |
47952 KB |
Output is correct |
66 |
Correct |
155 ms |
57024 KB |
Output is correct |
67 |
Correct |
160 ms |
56580 KB |
Output is correct |
68 |
Correct |
192 ms |
56788 KB |
Output is correct |
69 |
Correct |
279 ms |
83760 KB |
Output is correct |
70 |
Correct |
20 ms |
47452 KB |
Output is correct |
71 |
Correct |
20 ms |
47416 KB |
Output is correct |
72 |
Correct |
33 ms |
47688 KB |
Output is correct |
73 |
Correct |
22 ms |
47448 KB |
Output is correct |
74 |
Correct |
185 ms |
82104 KB |
Output is correct |
75 |
Correct |
219 ms |
70348 KB |
Output is correct |
76 |
Correct |
21 ms |
47704 KB |
Output is correct |
77 |
Correct |
21 ms |
47320 KB |
Output is correct |
78 |
Correct |
20 ms |
47452 KB |
Output is correct |
79 |
Correct |
22 ms |
47444 KB |
Output is correct |
80 |
Correct |
32 ms |
47188 KB |
Output is correct |
81 |
Correct |
21 ms |
47452 KB |
Output is correct |
82 |
Correct |
24 ms |
47408 KB |
Output is correct |
83 |
Correct |
21 ms |
47412 KB |
Output is correct |
84 |
Correct |
20 ms |
47420 KB |
Output is correct |
85 |
Correct |
23 ms |
47352 KB |
Output is correct |
86 |
Correct |
21 ms |
47452 KB |
Output is correct |
87 |
Correct |
25 ms |
48732 KB |
Output is correct |
88 |
Correct |
24 ms |
48476 KB |
Output is correct |
89 |
Correct |
23 ms |
48476 KB |
Output is correct |
90 |
Correct |
33 ms |
48220 KB |
Output is correct |
91 |
Correct |
28 ms |
48720 KB |
Output is correct |
92 |
Correct |
25 ms |
47696 KB |
Output is correct |
93 |
Correct |
29 ms |
47964 KB |
Output is correct |
94 |
Correct |
38 ms |
47500 KB |
Output is correct |
95 |
Correct |
24 ms |
47420 KB |
Output is correct |
96 |
Correct |
30 ms |
47960 KB |
Output is correct |
97 |
Correct |
25 ms |
47708 KB |
Output is correct |
98 |
Correct |
25 ms |
47452 KB |
Output is correct |
99 |
Correct |
24 ms |
47964 KB |
Output is correct |
100 |
Correct |
25 ms |
47712 KB |
Output is correct |
101 |
Correct |
26 ms |
48472 KB |
Output is correct |
102 |
Correct |
24 ms |
47700 KB |
Output is correct |
103 |
Correct |
27 ms |
47904 KB |
Output is correct |
104 |
Correct |
40 ms |
47716 KB |
Output is correct |
105 |
Correct |
22 ms |
47452 KB |
Output is correct |
106 |
Correct |
40 ms |
47956 KB |
Output is correct |
107 |
Correct |
26 ms |
47704 KB |
Output is correct |
108 |
Correct |
26 ms |
47452 KB |
Output is correct |
109 |
Correct |
25 ms |
47964 KB |
Output is correct |
110 |
Correct |
29 ms |
47884 KB |
Output is correct |
111 |
Correct |
1012 ms |
191316 KB |
Output is correct |
112 |
Correct |
616 ms |
172372 KB |
Output is correct |
113 |
Correct |
508 ms |
166868 KB |
Output is correct |
114 |
Correct |
152 ms |
145128 KB |
Output is correct |
115 |
Correct |
983 ms |
163760 KB |
Output is correct |
116 |
Correct |
678 ms |
90980 KB |
Output is correct |
117 |
Execution timed out |
2037 ms |
101556 KB |
Time limit exceeded |
118 |
Halted |
0 ms |
0 KB |
- |