#include "beechtree.h"
#include <bits/stdc++.h>
#define all(v) v.begin(), v.end()
#define pb push_back
#define lb lower_bound
#define gibon ios::sync_with_stdio(false); cin.tie(0);
#define fi first
#define se second
#define pii pair<int, int>
#define pll pair<ll, ll>
typedef long long ll;
using namespace std;
const int mxN=200010;
const int mxM=200100;
const int mxK=61;
const int MOD=1e9;
const ll INF=2e18;
int N, M;
vector <pii> v[mxN];
pii par[mxN];
bool ok[mxN];
int sub[mxN];
set <pii> s[mxN]; ///subtree 크기, 노드
void input(){
cin >> N >> M;
for(int i=1;i<=N;i++){
cin >> par[i].fi;
par[i].fi++;
}
for(int i=1;i<=N;i++) cin >> par[i].se;
for(int i=2;i<=N;i++) v[par[i].fi].emplace_back(par[i].se, i);
for(int i=1;i<=N;i++) if(v[i].size()) sort(all(v[i]));
}
bool cmp(int a, int b){
if((int)v[a].size()>(int)v[b].size()) return false;
for(auto [nxta, x] : v[a]){
int idx=lower_bound(all(v[b]), pii(nxta, 0))-v[b].begin();
if(idx==v[b].size() || v[b][idx].fi!=nxta || sub[v[b][idx].se]<sub[x]) return false;
}
return true;
}
bool add(int now, int idx){
pii nv=pii(sub[now], now);
auto it=s[idx].lower_bound(nv);
if(it!=s[idx].end()) if(!cmp(now, it->se)){
return false;
}
if(it!=s[idx].begin()){
it--;
if(!cmp(it->se, now)){
return false;
}
}
s[idx].insert(nv);
return true;
}
void dfs(int now){
sub[now]=1;
if(v[now].empty()){
ok[now]=true;
s[now].insert(pii(sub[now], now));
return;
}
for(auto [x, nxt] : v[now]) dfs(nxt), sub[now]+=sub[nxt];
for(auto [x, nxt] : v[now]) if(!ok[nxt]) return;
for(int i=1;i<v[now].size();i++) if(v[now][i-1].fi==v[now][i].fi) return;
int bi=-1;
for(auto [x, nxt] : v[now]) if(bi==-1 || sub[nxt]>sub[bi]) bi=nxt;
for(auto [x, nxt] : v[now]) if(nxt!=bi){
for(auto [_, y] : s[nxt]) if(!add(y, bi)){
return;
}
s[nxt].clear();
}
if(!add(now, bi)) return;
swap(s[now], s[bi]);
ok[now]=true;
}
vector <int> solve(){
dfs(1);
vector <int> res;
for(int i=1;i<=N;i++) res.push_back(ok[i]);
return res;
}
std::vector<int> beechtree(int n, int m, std::vector<int> P, std::vector<int> C)
{
N=n, M=m;
for(int i=0;i<N;i++) par[i+1]=pii(P[i]+1, C[i]);
for(int i=2;i<=N;i++) v[par[i].fi].emplace_back(par[i].se, i);
for(int i=1;i<=N;i++) if(v[i].size()) sort(all(v[i]));
return solve();
}
Compilation message
beechtree.cpp: In function 'bool cmp(int, int)':
beechtree.cpp:41:15: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
41 | if(idx==v[b].size() || v[b][idx].fi!=nxta || sub[v[b][idx].se]<sub[x]) return false;
| ~~~^~~~~~~~~~~~~
beechtree.cpp: In function 'void dfs(int)':
beechtree.cpp:69:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
69 | for(int i=1;i<v[now].size();i++) if(v[now][i-1].fi==v[now][i].fi) return;
| ~^~~~~~~~~~~~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
16988 KB |
Output is correct |
2 |
Correct |
4 ms |
16988 KB |
Output is correct |
3 |
Correct |
4 ms |
16996 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
16988 KB |
Output is correct |
2 |
Correct |
4 ms |
16988 KB |
Output is correct |
3 |
Correct |
4 ms |
16988 KB |
Output is correct |
4 |
Correct |
4 ms |
16984 KB |
Output is correct |
5 |
Correct |
6 ms |
16988 KB |
Output is correct |
6 |
Correct |
3 ms |
16984 KB |
Output is correct |
7 |
Correct |
5 ms |
16988 KB |
Output is correct |
8 |
Correct |
4 ms |
16988 KB |
Output is correct |
9 |
Correct |
4 ms |
16988 KB |
Output is correct |
10 |
Correct |
3 ms |
16988 KB |
Output is correct |
11 |
Correct |
3 ms |
16988 KB |
Output is correct |
12 |
Correct |
4 ms |
16988 KB |
Output is correct |
13 |
Correct |
4 ms |
16988 KB |
Output is correct |
14 |
Correct |
4 ms |
16988 KB |
Output is correct |
15 |
Correct |
4 ms |
16988 KB |
Output is correct |
16 |
Correct |
3 ms |
16988 KB |
Output is correct |
17 |
Correct |
4 ms |
17084 KB |
Output is correct |
18 |
Correct |
3 ms |
16988 KB |
Output is correct |
19 |
Correct |
4 ms |
16988 KB |
Output is correct |
20 |
Correct |
4 ms |
16984 KB |
Output is correct |
21 |
Correct |
4 ms |
16988 KB |
Output is correct |
22 |
Correct |
4 ms |
16988 KB |
Output is correct |
23 |
Correct |
4 ms |
17072 KB |
Output is correct |
24 |
Correct |
4 ms |
16984 KB |
Output is correct |
25 |
Correct |
4 ms |
17052 KB |
Output is correct |
26 |
Correct |
4 ms |
16988 KB |
Output is correct |
27 |
Correct |
4 ms |
16988 KB |
Output is correct |
28 |
Correct |
4 ms |
17064 KB |
Output is correct |
29 |
Correct |
5 ms |
16988 KB |
Output is correct |
30 |
Correct |
3 ms |
16984 KB |
Output is correct |
31 |
Correct |
4 ms |
16984 KB |
Output is correct |
32 |
Correct |
3 ms |
16988 KB |
Output is correct |
33 |
Correct |
4 ms |
17076 KB |
Output is correct |
34 |
Correct |
3 ms |
16988 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
16988 KB |
Output is correct |
2 |
Correct |
4 ms |
16988 KB |
Output is correct |
3 |
Correct |
4 ms |
16988 KB |
Output is correct |
4 |
Correct |
4 ms |
16984 KB |
Output is correct |
5 |
Correct |
6 ms |
16988 KB |
Output is correct |
6 |
Correct |
3 ms |
16984 KB |
Output is correct |
7 |
Correct |
80 ms |
51908 KB |
Output is correct |
8 |
Correct |
76 ms |
51920 KB |
Output is correct |
9 |
Correct |
4 ms |
16984 KB |
Output is correct |
10 |
Correct |
4 ms |
16988 KB |
Output is correct |
11 |
Correct |
4 ms |
16988 KB |
Output is correct |
12 |
Correct |
5 ms |
16988 KB |
Output is correct |
13 |
Correct |
5 ms |
17496 KB |
Output is correct |
14 |
Correct |
6 ms |
17244 KB |
Output is correct |
15 |
Correct |
5 ms |
17244 KB |
Output is correct |
16 |
Correct |
4 ms |
17244 KB |
Output is correct |
17 |
Correct |
124 ms |
61000 KB |
Output is correct |
18 |
Correct |
104 ms |
58056 KB |
Output is correct |
19 |
Correct |
79 ms |
53428 KB |
Output is correct |
20 |
Correct |
84 ms |
52172 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
16984 KB |
Output is correct |
2 |
Correct |
3 ms |
16988 KB |
Output is correct |
3 |
Correct |
3 ms |
16988 KB |
Output is correct |
4 |
Correct |
4 ms |
16988 KB |
Output is correct |
5 |
Correct |
4 ms |
16988 KB |
Output is correct |
6 |
Correct |
4 ms |
16988 KB |
Output is correct |
7 |
Correct |
4 ms |
16984 KB |
Output is correct |
8 |
Correct |
4 ms |
16988 KB |
Output is correct |
9 |
Correct |
4 ms |
17072 KB |
Output is correct |
10 |
Correct |
5 ms |
16988 KB |
Output is correct |
11 |
Correct |
4 ms |
17080 KB |
Output is correct |
12 |
Correct |
4 ms |
16988 KB |
Output is correct |
13 |
Correct |
4 ms |
16988 KB |
Output is correct |
14 |
Correct |
4 ms |
16988 KB |
Output is correct |
15 |
Correct |
76 ms |
26412 KB |
Output is correct |
16 |
Correct |
81 ms |
25660 KB |
Output is correct |
17 |
Correct |
82 ms |
26020 KB |
Output is correct |
18 |
Correct |
90 ms |
26280 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
16988 KB |
Output is correct |
2 |
Correct |
4 ms |
16988 KB |
Output is correct |
3 |
Correct |
5 ms |
16988 KB |
Output is correct |
4 |
Correct |
4 ms |
16988 KB |
Output is correct |
5 |
Correct |
80 ms |
51908 KB |
Output is correct |
6 |
Correct |
76 ms |
51920 KB |
Output is correct |
7 |
Correct |
4 ms |
16984 KB |
Output is correct |
8 |
Correct |
5 ms |
16984 KB |
Output is correct |
9 |
Correct |
5 ms |
17244 KB |
Output is correct |
10 |
Correct |
4 ms |
17076 KB |
Output is correct |
11 |
Correct |
81 ms |
36552 KB |
Output is correct |
12 |
Correct |
122 ms |
33528 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
16988 KB |
Output is correct |
2 |
Correct |
4 ms |
16988 KB |
Output is correct |
3 |
Correct |
4 ms |
16996 KB |
Output is correct |
4 |
Correct |
4 ms |
16988 KB |
Output is correct |
5 |
Correct |
4 ms |
16988 KB |
Output is correct |
6 |
Correct |
4 ms |
16988 KB |
Output is correct |
7 |
Correct |
4 ms |
16984 KB |
Output is correct |
8 |
Correct |
6 ms |
16988 KB |
Output is correct |
9 |
Correct |
3 ms |
16984 KB |
Output is correct |
10 |
Correct |
5 ms |
16988 KB |
Output is correct |
11 |
Correct |
4 ms |
16988 KB |
Output is correct |
12 |
Correct |
4 ms |
16988 KB |
Output is correct |
13 |
Correct |
3 ms |
16988 KB |
Output is correct |
14 |
Correct |
3 ms |
16988 KB |
Output is correct |
15 |
Correct |
4 ms |
16988 KB |
Output is correct |
16 |
Correct |
4 ms |
16988 KB |
Output is correct |
17 |
Correct |
4 ms |
16988 KB |
Output is correct |
18 |
Correct |
4 ms |
16988 KB |
Output is correct |
19 |
Correct |
3 ms |
16988 KB |
Output is correct |
20 |
Correct |
4 ms |
17084 KB |
Output is correct |
21 |
Correct |
3 ms |
16988 KB |
Output is correct |
22 |
Correct |
4 ms |
16988 KB |
Output is correct |
23 |
Correct |
4 ms |
16984 KB |
Output is correct |
24 |
Correct |
4 ms |
16988 KB |
Output is correct |
25 |
Correct |
4 ms |
16988 KB |
Output is correct |
26 |
Correct |
4 ms |
17072 KB |
Output is correct |
27 |
Correct |
4 ms |
16984 KB |
Output is correct |
28 |
Correct |
4 ms |
17052 KB |
Output is correct |
29 |
Correct |
4 ms |
16988 KB |
Output is correct |
30 |
Correct |
4 ms |
16988 KB |
Output is correct |
31 |
Correct |
4 ms |
17064 KB |
Output is correct |
32 |
Correct |
5 ms |
16988 KB |
Output is correct |
33 |
Correct |
3 ms |
16984 KB |
Output is correct |
34 |
Correct |
4 ms |
16984 KB |
Output is correct |
35 |
Correct |
3 ms |
16988 KB |
Output is correct |
36 |
Correct |
4 ms |
17076 KB |
Output is correct |
37 |
Correct |
3 ms |
16988 KB |
Output is correct |
38 |
Correct |
4 ms |
16984 KB |
Output is correct |
39 |
Correct |
4 ms |
16988 KB |
Output is correct |
40 |
Correct |
4 ms |
16988 KB |
Output is correct |
41 |
Correct |
5 ms |
16988 KB |
Output is correct |
42 |
Correct |
3 ms |
16984 KB |
Output is correct |
43 |
Correct |
3 ms |
16988 KB |
Output is correct |
44 |
Correct |
3 ms |
16988 KB |
Output is correct |
45 |
Correct |
4 ms |
16988 KB |
Output is correct |
46 |
Correct |
4 ms |
16988 KB |
Output is correct |
47 |
Correct |
4 ms |
16988 KB |
Output is correct |
48 |
Correct |
4 ms |
16984 KB |
Output is correct |
49 |
Correct |
4 ms |
16988 KB |
Output is correct |
50 |
Correct |
4 ms |
17072 KB |
Output is correct |
51 |
Correct |
5 ms |
16988 KB |
Output is correct |
52 |
Correct |
4 ms |
16984 KB |
Output is correct |
53 |
Correct |
5 ms |
16984 KB |
Output is correct |
54 |
Correct |
5 ms |
16988 KB |
Output is correct |
55 |
Correct |
4 ms |
16988 KB |
Output is correct |
56 |
Correct |
5 ms |
17052 KB |
Output is correct |
57 |
Correct |
4 ms |
16984 KB |
Output is correct |
58 |
Correct |
4 ms |
17052 KB |
Output is correct |
59 |
Correct |
4 ms |
16988 KB |
Output is correct |
60 |
Correct |
4 ms |
17076 KB |
Output is correct |
61 |
Correct |
4 ms |
16988 KB |
Output is correct |
62 |
Correct |
4 ms |
16988 KB |
Output is correct |
63 |
Correct |
5 ms |
17080 KB |
Output is correct |
64 |
Correct |
4 ms |
16984 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
16988 KB |
Output is correct |
2 |
Correct |
4 ms |
16988 KB |
Output is correct |
3 |
Correct |
5 ms |
16988 KB |
Output is correct |
4 |
Correct |
4 ms |
16988 KB |
Output is correct |
5 |
Correct |
4 ms |
16988 KB |
Output is correct |
6 |
Correct |
3 ms |
16988 KB |
Output is correct |
7 |
Correct |
3 ms |
16988 KB |
Output is correct |
8 |
Correct |
4 ms |
16988 KB |
Output is correct |
9 |
Correct |
4 ms |
16988 KB |
Output is correct |
10 |
Correct |
4 ms |
16988 KB |
Output is correct |
11 |
Correct |
4 ms |
16988 KB |
Output is correct |
12 |
Correct |
3 ms |
16988 KB |
Output is correct |
13 |
Correct |
4 ms |
17084 KB |
Output is correct |
14 |
Correct |
3 ms |
16988 KB |
Output is correct |
15 |
Correct |
4 ms |
16988 KB |
Output is correct |
16 |
Correct |
4 ms |
16984 KB |
Output is correct |
17 |
Correct |
4 ms |
16988 KB |
Output is correct |
18 |
Correct |
4 ms |
16988 KB |
Output is correct |
19 |
Correct |
4 ms |
17072 KB |
Output is correct |
20 |
Correct |
4 ms |
16984 KB |
Output is correct |
21 |
Correct |
4 ms |
17052 KB |
Output is correct |
22 |
Correct |
4 ms |
16988 KB |
Output is correct |
23 |
Correct |
4 ms |
16988 KB |
Output is correct |
24 |
Correct |
4 ms |
17064 KB |
Output is correct |
25 |
Correct |
5 ms |
17500 KB |
Output is correct |
26 |
Correct |
5 ms |
17240 KB |
Output is correct |
27 |
Correct |
5 ms |
17244 KB |
Output is correct |
28 |
Correct |
5 ms |
17356 KB |
Output is correct |
29 |
Correct |
6 ms |
17500 KB |
Output is correct |
30 |
Correct |
5 ms |
17080 KB |
Output is correct |
31 |
Correct |
5 ms |
17084 KB |
Output is correct |
32 |
Correct |
5 ms |
17240 KB |
Output is correct |
33 |
Correct |
6 ms |
17244 KB |
Output is correct |
34 |
Correct |
7 ms |
17244 KB |
Output is correct |
35 |
Correct |
5 ms |
17244 KB |
Output is correct |
36 |
Correct |
5 ms |
17244 KB |
Output is correct |
37 |
Correct |
4 ms |
17244 KB |
Output is correct |
38 |
Correct |
4 ms |
17244 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
16988 KB |
Output is correct |
2 |
Correct |
4 ms |
16988 KB |
Output is correct |
3 |
Correct |
4 ms |
16996 KB |
Output is correct |
4 |
Correct |
4 ms |
16988 KB |
Output is correct |
5 |
Correct |
4 ms |
16988 KB |
Output is correct |
6 |
Correct |
4 ms |
16988 KB |
Output is correct |
7 |
Correct |
4 ms |
16984 KB |
Output is correct |
8 |
Correct |
6 ms |
16988 KB |
Output is correct |
9 |
Correct |
3 ms |
16984 KB |
Output is correct |
10 |
Correct |
5 ms |
16988 KB |
Output is correct |
11 |
Correct |
4 ms |
16988 KB |
Output is correct |
12 |
Correct |
4 ms |
16988 KB |
Output is correct |
13 |
Correct |
3 ms |
16988 KB |
Output is correct |
14 |
Correct |
3 ms |
16988 KB |
Output is correct |
15 |
Correct |
4 ms |
16988 KB |
Output is correct |
16 |
Correct |
4 ms |
16988 KB |
Output is correct |
17 |
Correct |
4 ms |
16988 KB |
Output is correct |
18 |
Correct |
4 ms |
16988 KB |
Output is correct |
19 |
Correct |
3 ms |
16988 KB |
Output is correct |
20 |
Correct |
4 ms |
17084 KB |
Output is correct |
21 |
Correct |
3 ms |
16988 KB |
Output is correct |
22 |
Correct |
4 ms |
16988 KB |
Output is correct |
23 |
Correct |
4 ms |
16984 KB |
Output is correct |
24 |
Correct |
4 ms |
16988 KB |
Output is correct |
25 |
Correct |
4 ms |
16988 KB |
Output is correct |
26 |
Correct |
4 ms |
17072 KB |
Output is correct |
27 |
Correct |
4 ms |
16984 KB |
Output is correct |
28 |
Correct |
4 ms |
17052 KB |
Output is correct |
29 |
Correct |
4 ms |
16988 KB |
Output is correct |
30 |
Correct |
4 ms |
16988 KB |
Output is correct |
31 |
Correct |
4 ms |
17064 KB |
Output is correct |
32 |
Correct |
5 ms |
16988 KB |
Output is correct |
33 |
Correct |
3 ms |
16984 KB |
Output is correct |
34 |
Correct |
4 ms |
16984 KB |
Output is correct |
35 |
Correct |
3 ms |
16988 KB |
Output is correct |
36 |
Correct |
4 ms |
17076 KB |
Output is correct |
37 |
Correct |
3 ms |
16988 KB |
Output is correct |
38 |
Correct |
4 ms |
16984 KB |
Output is correct |
39 |
Correct |
4 ms |
16988 KB |
Output is correct |
40 |
Correct |
4 ms |
16988 KB |
Output is correct |
41 |
Correct |
5 ms |
16988 KB |
Output is correct |
42 |
Correct |
5 ms |
17496 KB |
Output is correct |
43 |
Correct |
6 ms |
17244 KB |
Output is correct |
44 |
Correct |
5 ms |
17244 KB |
Output is correct |
45 |
Correct |
4 ms |
17244 KB |
Output is correct |
46 |
Correct |
3 ms |
16984 KB |
Output is correct |
47 |
Correct |
3 ms |
16988 KB |
Output is correct |
48 |
Correct |
3 ms |
16988 KB |
Output is correct |
49 |
Correct |
4 ms |
16988 KB |
Output is correct |
50 |
Correct |
4 ms |
16988 KB |
Output is correct |
51 |
Correct |
4 ms |
16988 KB |
Output is correct |
52 |
Correct |
4 ms |
16984 KB |
Output is correct |
53 |
Correct |
4 ms |
16988 KB |
Output is correct |
54 |
Correct |
4 ms |
17072 KB |
Output is correct |
55 |
Correct |
5 ms |
16988 KB |
Output is correct |
56 |
Correct |
4 ms |
17080 KB |
Output is correct |
57 |
Correct |
4 ms |
16988 KB |
Output is correct |
58 |
Correct |
4 ms |
16988 KB |
Output is correct |
59 |
Correct |
4 ms |
16988 KB |
Output is correct |
60 |
Correct |
4 ms |
16984 KB |
Output is correct |
61 |
Correct |
5 ms |
16984 KB |
Output is correct |
62 |
Correct |
5 ms |
17244 KB |
Output is correct |
63 |
Correct |
4 ms |
17076 KB |
Output is correct |
64 |
Correct |
5 ms |
16988 KB |
Output is correct |
65 |
Correct |
4 ms |
16988 KB |
Output is correct |
66 |
Correct |
5 ms |
17052 KB |
Output is correct |
67 |
Correct |
4 ms |
16984 KB |
Output is correct |
68 |
Correct |
4 ms |
17052 KB |
Output is correct |
69 |
Correct |
4 ms |
16988 KB |
Output is correct |
70 |
Correct |
4 ms |
17076 KB |
Output is correct |
71 |
Correct |
4 ms |
16988 KB |
Output is correct |
72 |
Correct |
4 ms |
16988 KB |
Output is correct |
73 |
Correct |
5 ms |
17080 KB |
Output is correct |
74 |
Correct |
4 ms |
16984 KB |
Output is correct |
75 |
Correct |
5 ms |
17500 KB |
Output is correct |
76 |
Correct |
5 ms |
17240 KB |
Output is correct |
77 |
Correct |
5 ms |
17244 KB |
Output is correct |
78 |
Correct |
5 ms |
17356 KB |
Output is correct |
79 |
Correct |
6 ms |
17500 KB |
Output is correct |
80 |
Correct |
5 ms |
17080 KB |
Output is correct |
81 |
Correct |
5 ms |
17084 KB |
Output is correct |
82 |
Correct |
5 ms |
17240 KB |
Output is correct |
83 |
Correct |
6 ms |
17244 KB |
Output is correct |
84 |
Correct |
7 ms |
17244 KB |
Output is correct |
85 |
Correct |
5 ms |
17244 KB |
Output is correct |
86 |
Correct |
5 ms |
17244 KB |
Output is correct |
87 |
Correct |
4 ms |
17244 KB |
Output is correct |
88 |
Correct |
4 ms |
17244 KB |
Output is correct |
89 |
Correct |
5 ms |
17244 KB |
Output is correct |
90 |
Correct |
4 ms |
17108 KB |
Output is correct |
91 |
Correct |
6 ms |
17244 KB |
Output is correct |
92 |
Correct |
5 ms |
17244 KB |
Output is correct |
93 |
Correct |
6 ms |
17088 KB |
Output is correct |
94 |
Correct |
6 ms |
17244 KB |
Output is correct |
95 |
Correct |
5 ms |
17244 KB |
Output is correct |
96 |
Correct |
5 ms |
17244 KB |
Output is correct |
97 |
Correct |
5 ms |
17240 KB |
Output is correct |
98 |
Correct |
5 ms |
17244 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
16988 KB |
Output is correct |
2 |
Correct |
4 ms |
16988 KB |
Output is correct |
3 |
Correct |
5 ms |
16988 KB |
Output is correct |
4 |
Correct |
4 ms |
16988 KB |
Output is correct |
5 |
Correct |
4 ms |
16988 KB |
Output is correct |
6 |
Correct |
3 ms |
16988 KB |
Output is correct |
7 |
Correct |
3 ms |
16988 KB |
Output is correct |
8 |
Correct |
4 ms |
16988 KB |
Output is correct |
9 |
Correct |
4 ms |
16988 KB |
Output is correct |
10 |
Correct |
4 ms |
16988 KB |
Output is correct |
11 |
Correct |
4 ms |
16988 KB |
Output is correct |
12 |
Correct |
3 ms |
16988 KB |
Output is correct |
13 |
Correct |
4 ms |
17084 KB |
Output is correct |
14 |
Correct |
3 ms |
16988 KB |
Output is correct |
15 |
Correct |
4 ms |
16988 KB |
Output is correct |
16 |
Correct |
4 ms |
16984 KB |
Output is correct |
17 |
Correct |
4 ms |
16988 KB |
Output is correct |
18 |
Correct |
4 ms |
16988 KB |
Output is correct |
19 |
Correct |
4 ms |
17072 KB |
Output is correct |
20 |
Correct |
4 ms |
16984 KB |
Output is correct |
21 |
Correct |
4 ms |
17052 KB |
Output is correct |
22 |
Correct |
4 ms |
16988 KB |
Output is correct |
23 |
Correct |
4 ms |
16988 KB |
Output is correct |
24 |
Correct |
4 ms |
17064 KB |
Output is correct |
25 |
Correct |
5 ms |
17500 KB |
Output is correct |
26 |
Correct |
5 ms |
17240 KB |
Output is correct |
27 |
Correct |
5 ms |
17244 KB |
Output is correct |
28 |
Correct |
5 ms |
17356 KB |
Output is correct |
29 |
Correct |
6 ms |
17500 KB |
Output is correct |
30 |
Correct |
5 ms |
17080 KB |
Output is correct |
31 |
Correct |
5 ms |
17084 KB |
Output is correct |
32 |
Correct |
5 ms |
17240 KB |
Output is correct |
33 |
Correct |
6 ms |
17244 KB |
Output is correct |
34 |
Correct |
7 ms |
17244 KB |
Output is correct |
35 |
Correct |
5 ms |
17244 KB |
Output is correct |
36 |
Correct |
5 ms |
17244 KB |
Output is correct |
37 |
Correct |
4 ms |
17244 KB |
Output is correct |
38 |
Correct |
4 ms |
17244 KB |
Output is correct |
39 |
Correct |
128 ms |
60616 KB |
Output is correct |
40 |
Correct |
102 ms |
56788 KB |
Output is correct |
41 |
Correct |
96 ms |
55496 KB |
Output is correct |
42 |
Correct |
75 ms |
51176 KB |
Output is correct |
43 |
Correct |
140 ms |
54060 KB |
Output is correct |
44 |
Correct |
104 ms |
40740 KB |
Output is correct |
45 |
Correct |
364 ms |
38736 KB |
Output is correct |
46 |
Correct |
224 ms |
36680 KB |
Output is correct |
47 |
Correct |
182 ms |
36468 KB |
Output is correct |
48 |
Correct |
141 ms |
36256 KB |
Output is correct |
49 |
Correct |
95 ms |
35640 KB |
Output is correct |
50 |
Correct |
360 ms |
38740 KB |
Output is correct |
51 |
Correct |
268 ms |
35464 KB |
Output is correct |
52 |
Correct |
198 ms |
35576 KB |
Output is correct |
53 |
Correct |
146 ms |
35532 KB |
Output is correct |
54 |
Correct |
105 ms |
34292 KB |
Output is correct |
55 |
Correct |
92 ms |
41900 KB |
Output is correct |
56 |
Correct |
120 ms |
42188 KB |
Output is correct |
57 |
Correct |
85 ms |
35020 KB |
Output is correct |
58 |
Correct |
78 ms |
34244 KB |
Output is correct |
59 |
Correct |
79 ms |
34252 KB |
Output is correct |
60 |
Correct |
77 ms |
34000 KB |
Output is correct |
61 |
Correct |
79 ms |
33996 KB |
Output is correct |
62 |
Correct |
77 ms |
33992 KB |
Output is correct |
63 |
Correct |
133 ms |
43092 KB |
Output is correct |
64 |
Correct |
100 ms |
39408 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
16988 KB |
Output is correct |
2 |
Correct |
4 ms |
16988 KB |
Output is correct |
3 |
Correct |
4 ms |
16996 KB |
Output is correct |
4 |
Correct |
4 ms |
16988 KB |
Output is correct |
5 |
Correct |
4 ms |
16988 KB |
Output is correct |
6 |
Correct |
4 ms |
16988 KB |
Output is correct |
7 |
Correct |
4 ms |
16984 KB |
Output is correct |
8 |
Correct |
6 ms |
16988 KB |
Output is correct |
9 |
Correct |
3 ms |
16984 KB |
Output is correct |
10 |
Correct |
5 ms |
16988 KB |
Output is correct |
11 |
Correct |
4 ms |
16988 KB |
Output is correct |
12 |
Correct |
4 ms |
16988 KB |
Output is correct |
13 |
Correct |
3 ms |
16988 KB |
Output is correct |
14 |
Correct |
3 ms |
16988 KB |
Output is correct |
15 |
Correct |
4 ms |
16988 KB |
Output is correct |
16 |
Correct |
4 ms |
16988 KB |
Output is correct |
17 |
Correct |
4 ms |
16988 KB |
Output is correct |
18 |
Correct |
4 ms |
16988 KB |
Output is correct |
19 |
Correct |
3 ms |
16988 KB |
Output is correct |
20 |
Correct |
4 ms |
17084 KB |
Output is correct |
21 |
Correct |
3 ms |
16988 KB |
Output is correct |
22 |
Correct |
4 ms |
16988 KB |
Output is correct |
23 |
Correct |
4 ms |
16984 KB |
Output is correct |
24 |
Correct |
4 ms |
16988 KB |
Output is correct |
25 |
Correct |
4 ms |
16988 KB |
Output is correct |
26 |
Correct |
4 ms |
17072 KB |
Output is correct |
27 |
Correct |
4 ms |
16984 KB |
Output is correct |
28 |
Correct |
4 ms |
17052 KB |
Output is correct |
29 |
Correct |
4 ms |
16988 KB |
Output is correct |
30 |
Correct |
4 ms |
16988 KB |
Output is correct |
31 |
Correct |
4 ms |
17064 KB |
Output is correct |
32 |
Correct |
5 ms |
16988 KB |
Output is correct |
33 |
Correct |
3 ms |
16984 KB |
Output is correct |
34 |
Correct |
4 ms |
16984 KB |
Output is correct |
35 |
Correct |
3 ms |
16988 KB |
Output is correct |
36 |
Correct |
4 ms |
17076 KB |
Output is correct |
37 |
Correct |
3 ms |
16988 KB |
Output is correct |
38 |
Correct |
80 ms |
51908 KB |
Output is correct |
39 |
Correct |
76 ms |
51920 KB |
Output is correct |
40 |
Correct |
4 ms |
16984 KB |
Output is correct |
41 |
Correct |
4 ms |
16988 KB |
Output is correct |
42 |
Correct |
4 ms |
16988 KB |
Output is correct |
43 |
Correct |
5 ms |
16988 KB |
Output is correct |
44 |
Correct |
5 ms |
17496 KB |
Output is correct |
45 |
Correct |
6 ms |
17244 KB |
Output is correct |
46 |
Correct |
5 ms |
17244 KB |
Output is correct |
47 |
Correct |
4 ms |
17244 KB |
Output is correct |
48 |
Correct |
124 ms |
61000 KB |
Output is correct |
49 |
Correct |
104 ms |
58056 KB |
Output is correct |
50 |
Correct |
79 ms |
53428 KB |
Output is correct |
51 |
Correct |
84 ms |
52172 KB |
Output is correct |
52 |
Correct |
3 ms |
16984 KB |
Output is correct |
53 |
Correct |
3 ms |
16988 KB |
Output is correct |
54 |
Correct |
3 ms |
16988 KB |
Output is correct |
55 |
Correct |
4 ms |
16988 KB |
Output is correct |
56 |
Correct |
4 ms |
16988 KB |
Output is correct |
57 |
Correct |
4 ms |
16988 KB |
Output is correct |
58 |
Correct |
4 ms |
16984 KB |
Output is correct |
59 |
Correct |
4 ms |
16988 KB |
Output is correct |
60 |
Correct |
4 ms |
17072 KB |
Output is correct |
61 |
Correct |
5 ms |
16988 KB |
Output is correct |
62 |
Correct |
4 ms |
17080 KB |
Output is correct |
63 |
Correct |
4 ms |
16988 KB |
Output is correct |
64 |
Correct |
4 ms |
16988 KB |
Output is correct |
65 |
Correct |
4 ms |
16988 KB |
Output is correct |
66 |
Correct |
76 ms |
26412 KB |
Output is correct |
67 |
Correct |
81 ms |
25660 KB |
Output is correct |
68 |
Correct |
82 ms |
26020 KB |
Output is correct |
69 |
Correct |
90 ms |
26280 KB |
Output is correct |
70 |
Correct |
4 ms |
16984 KB |
Output is correct |
71 |
Correct |
5 ms |
16984 KB |
Output is correct |
72 |
Correct |
5 ms |
17244 KB |
Output is correct |
73 |
Correct |
4 ms |
17076 KB |
Output is correct |
74 |
Correct |
81 ms |
36552 KB |
Output is correct |
75 |
Correct |
122 ms |
33528 KB |
Output is correct |
76 |
Correct |
5 ms |
16988 KB |
Output is correct |
77 |
Correct |
4 ms |
16988 KB |
Output is correct |
78 |
Correct |
5 ms |
17052 KB |
Output is correct |
79 |
Correct |
4 ms |
16984 KB |
Output is correct |
80 |
Correct |
4 ms |
17052 KB |
Output is correct |
81 |
Correct |
4 ms |
16988 KB |
Output is correct |
82 |
Correct |
4 ms |
17076 KB |
Output is correct |
83 |
Correct |
4 ms |
16988 KB |
Output is correct |
84 |
Correct |
4 ms |
16988 KB |
Output is correct |
85 |
Correct |
5 ms |
17080 KB |
Output is correct |
86 |
Correct |
4 ms |
16984 KB |
Output is correct |
87 |
Correct |
5 ms |
17500 KB |
Output is correct |
88 |
Correct |
5 ms |
17240 KB |
Output is correct |
89 |
Correct |
5 ms |
17244 KB |
Output is correct |
90 |
Correct |
5 ms |
17356 KB |
Output is correct |
91 |
Correct |
6 ms |
17500 KB |
Output is correct |
92 |
Correct |
5 ms |
17080 KB |
Output is correct |
93 |
Correct |
5 ms |
17084 KB |
Output is correct |
94 |
Correct |
5 ms |
17240 KB |
Output is correct |
95 |
Correct |
6 ms |
17244 KB |
Output is correct |
96 |
Correct |
7 ms |
17244 KB |
Output is correct |
97 |
Correct |
5 ms |
17244 KB |
Output is correct |
98 |
Correct |
5 ms |
17244 KB |
Output is correct |
99 |
Correct |
4 ms |
17244 KB |
Output is correct |
100 |
Correct |
4 ms |
17244 KB |
Output is correct |
101 |
Correct |
5 ms |
17244 KB |
Output is correct |
102 |
Correct |
4 ms |
17108 KB |
Output is correct |
103 |
Correct |
6 ms |
17244 KB |
Output is correct |
104 |
Correct |
5 ms |
17244 KB |
Output is correct |
105 |
Correct |
6 ms |
17088 KB |
Output is correct |
106 |
Correct |
6 ms |
17244 KB |
Output is correct |
107 |
Correct |
5 ms |
17244 KB |
Output is correct |
108 |
Correct |
5 ms |
17244 KB |
Output is correct |
109 |
Correct |
5 ms |
17240 KB |
Output is correct |
110 |
Correct |
5 ms |
17244 KB |
Output is correct |
111 |
Correct |
128 ms |
60616 KB |
Output is correct |
112 |
Correct |
102 ms |
56788 KB |
Output is correct |
113 |
Correct |
96 ms |
55496 KB |
Output is correct |
114 |
Correct |
75 ms |
51176 KB |
Output is correct |
115 |
Correct |
140 ms |
54060 KB |
Output is correct |
116 |
Correct |
104 ms |
40740 KB |
Output is correct |
117 |
Correct |
364 ms |
38736 KB |
Output is correct |
118 |
Correct |
224 ms |
36680 KB |
Output is correct |
119 |
Correct |
182 ms |
36468 KB |
Output is correct |
120 |
Correct |
141 ms |
36256 KB |
Output is correct |
121 |
Correct |
95 ms |
35640 KB |
Output is correct |
122 |
Correct |
360 ms |
38740 KB |
Output is correct |
123 |
Correct |
268 ms |
35464 KB |
Output is correct |
124 |
Correct |
198 ms |
35576 KB |
Output is correct |
125 |
Correct |
146 ms |
35532 KB |
Output is correct |
126 |
Correct |
105 ms |
34292 KB |
Output is correct |
127 |
Correct |
92 ms |
41900 KB |
Output is correct |
128 |
Correct |
120 ms |
42188 KB |
Output is correct |
129 |
Correct |
85 ms |
35020 KB |
Output is correct |
130 |
Correct |
78 ms |
34244 KB |
Output is correct |
131 |
Correct |
79 ms |
34252 KB |
Output is correct |
132 |
Correct |
77 ms |
34000 KB |
Output is correct |
133 |
Correct |
79 ms |
33996 KB |
Output is correct |
134 |
Correct |
77 ms |
33992 KB |
Output is correct |
135 |
Correct |
133 ms |
43092 KB |
Output is correct |
136 |
Correct |
100 ms |
39408 KB |
Output is correct |
137 |
Correct |
142 ms |
50272 KB |
Output is correct |
138 |
Correct |
105 ms |
41548 KB |
Output is correct |
139 |
Correct |
310 ms |
39748 KB |
Output is correct |
140 |
Correct |
203 ms |
37848 KB |
Output is correct |
141 |
Correct |
148 ms |
37584 KB |
Output is correct |
142 |
Correct |
120 ms |
37520 KB |
Output is correct |
143 |
Correct |
91 ms |
36560 KB |
Output is correct |
144 |
Correct |
290 ms |
38376 KB |
Output is correct |
145 |
Correct |
228 ms |
35748 KB |
Output is correct |
146 |
Correct |
188 ms |
36552 KB |
Output is correct |
147 |
Correct |
137 ms |
36232 KB |
Output is correct |
148 |
Correct |
92 ms |
34772 KB |
Output is correct |
149 |
Correct |
91 ms |
42192 KB |
Output is correct |
150 |
Correct |
91 ms |
42236 KB |
Output is correct |
151 |
Correct |
84 ms |
35752 KB |
Output is correct |
152 |
Correct |
77 ms |
35064 KB |
Output is correct |
153 |
Correct |
77 ms |
35016 KB |
Output is correct |
154 |
Correct |
76 ms |
35108 KB |
Output is correct |
155 |
Correct |
80 ms |
35020 KB |
Output is correct |
156 |
Correct |
86 ms |
34940 KB |
Output is correct |
157 |
Correct |
143 ms |
44284 KB |
Output is correct |
158 |
Correct |
103 ms |
40244 KB |
Output is correct |