#pragma GCC optimize ("O3")
#pragma GCC optimize ("Ofast")
#pragma GCC optimize ("unroll-loops")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int MAXN = 1e5;
const int INF = 5e7;
int N;
pii A[MAXN+10];
vector<int> X[MAXN+10], Y[MAXN+10];
struct Line
{
int l, r, p;
Line(int l, int r, int p) : l(l), r(r), p(p) {}
bool operator < (const Line &q) const { return r<q.r; }
};
int Q;
vector<Line> LX[MAXN+10], LY[MAXN+10];
vector<int> adjX[MAXN+10], adjY[MAXN+10];
pii get(int y, int x)
{
int nx=lower_bound(LX[y].begin(), LX[y].end(), Line(0, x, 0))->p;
int ny=lower_bound(LY[x].begin(), LY[x].end(), Line(0, y, 0))->p;
return {nx, ny};
}
pii P[MAXN+10];
struct Tree
{
int M;
//vector<vector<int>> adj, cdist;
//vector<int> sz, del, cpar, cdep;
int sz[MAXN+10], del[MAXN+10], cpar[MAXN+10], cdist[MAXN+10][21], cdep[MAXN+10];
vector<int> adj[MAXN+10];
Tree()
{
M=0;
//sz=del=cpar=cdep=vector<int>(MAXN+10);
//cdist.resize(MAXN+10);
//for(auto &it : cdist) it.resize(30);
//adj.resize(MAXN+10);
}
void getsz(int now, int bef)
{
sz[now]=1;
for(int nxt : adj[now])
{
if(nxt==bef) continue;
if(del[nxt]) continue;
getsz(nxt, now);
sz[now]+=sz[nxt];
}
}
int getcen(int now, int bef, int S)
{
for(int nxt : adj[now])
{
if(nxt==bef) continue;
if(del[nxt]) continue;
if(sz[nxt]>S/2) return getcen(nxt, now, S);
}
return now;
}
void dfs(int now, int bef, int t, int dist)
{
cdist[now][t]=dist;
for(int nxt : adj[now])
{
if(nxt==bef) continue;
if(del[nxt]) continue;
dfs(nxt, now, t, dist+1);
}
}
void decomp(int now, int bef, int cendep)
{
getsz(now, now);
now=getcen(now, now, sz[now]);
cpar[now]=bef;
cdep[now]=cendep;
dfs(now, now, cendep, 0);
del[now]=true;
for(auto nxt : adj[now])
{
if(del[nxt]) continue;
decomp(nxt, now, cendep+1);
}
}
void init()
{
decomp(1, 0, 1);
}
vector<int> getpar(int now)
{
vector<int> ans;
while(now)
{
ans.push_back(now);
now=cpar[now];
}
return ans;
}
}TX, TY;
unordered_map<ll, int> M;
int main()
{
scanf("%d", &N);
for(int i=1; i<=N; i++)
{
int y, x;
//y=readInt(); x=readInt();
scanf("%d%d", &y, &x);
A[i]={y, x};
X[y].push_back(x);
Y[x].push_back(y);
}
for(int i=1; i<=MAXN; i++)
{
if(X[i].empty()) continue;
sort(X[i].begin(), X[i].end());
int bef=X[i][0];
for(int j=0; j+1<X[i].size(); j++)
{
if(X[i][j]+1<X[i][j+1])
{
LX[i].push_back({bef, X[i][j], ++TX.M});
//printf("LX %d %d %d %d\n", i, LX[i].back().l, LX[i].back().r, LX[i].back().p);
bef=X[i][j+1];
}
}
LX[i].push_back({bef, X[i].back(), ++TX.M});
//printf("LX %d %d %d %d\n", i, LX[i].back().l, LX[i].back().r, LX[i].back().p);
}
for(int i=2; i<=MAXN; i++)
{
if(LX[i].empty() || LX[i-1].empty()) continue;
int p=0;
for(auto it : LX[i])
{
for(; p<LX[i-1].size() && LX[i-1][p].r<it.l; p++);
for(; p<LX[i-1].size() && LX[i-1][p].l<=it.r; p++)
{
int u=LX[i-1][p].p, v=it.p;
TX.adj[u].push_back(v);
TX.adj[v].push_back(u);
//printf("adjX %d %d\n", u, v);
}
if(p) p--;
}
}
for(int i=1; i<=MAXN; i++)
{
if(Y[i].empty()) continue;
sort(Y[i].begin(), Y[i].end());
int bef=Y[i][0];
for(int j=0; j+1<Y[i].size(); j++)
{
if(Y[i][j]+1!=Y[i][j+1])
{
LY[i].push_back({bef, Y[i][j], ++TY.M});
//printf("LY %d %d %d %d\n", i, LY[i].back().l, LY[i].back().r, LY[i].back().p);
bef=Y[i][j+1];
}
}
LY[i].push_back({bef, Y[i].back(), ++TY.M});
//printf("LY %d %d %d %d\n", i, LY[i].back().l, LY[i].back().r, LY[i].back().p);
}
for(int i=2; i<=MAXN; i++)
{
if(LY[i].empty() || LY[i-1].empty()) continue;
int p=0;
for(auto it : LY[i])
{
for(; p<LY[i-1].size() && LY[i-1][p].r<it.l; p++);
for(; p<LY[i-1].size() && LY[i-1][p].l<=it.r; p++)
{
int u=LY[i-1][p].p, v=it.p;
TY.adj[u].push_back(v);
TY.adj[v].push_back(u);
//printf("adjY %d %d\n", u, v);
}
if(p) p--;
}
}
TX.init(); TY.init();
scanf("%d", &Q);
bool flag=false;
while(Q--)
{
int tt, y, x;
scanf("%d%d%d", &tt, &y, &x);
pii t=get(y, x);
vector<int> V1=TX.getpar(t.first);
vector<int> V2=TY.getpar(t.second);
if(tt==1)
{
for(auto it : V1) for(auto jt : V2)
{
ll pt=((ll)it<<20)|jt;
if(M.find(pt)==M.end()) M[pt]=INF;
M[pt]=min(M[pt], TX.cdist[t.first][TX.cdep[it]]+TY.cdist[t.second][TY.cdep[jt]]);
}
flag=true;
}
else
{
if(!flag) { printf("-1\n"); continue; }
int ans=INF;
for(auto it : V1) for(auto jt : V2)
{
ll pt=((ll)it<<20)|jt;
if(M.find(pt)==M.end()) continue;
ans=min(ans, TX.cdist[t.first][TX.cdep[it]]+TY.cdist[t.second][TY.cdep[jt]]+M[pt]);
}
if(ans==INF) ans=-1;
//if(ans!=-1) assert(flag);
printf("%d\n", ans);
}
}
}
Compilation message
C.cpp: In function 'int main()':
C.cpp:144:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
144 | for(int j=0; j+1<X[i].size(); j++)
| ~~~^~~~~~~~~~~~
C.cpp:163:11: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<Line>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
163 | for(; p<LX[i-1].size() && LX[i-1][p].r<it.l; p++);
| ~^~~~~~~~~~~~~~~
C.cpp:164:11: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<Line>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
164 | for(; p<LX[i-1].size() && LX[i-1][p].l<=it.r; p++)
| ~^~~~~~~~~~~~~~~
C.cpp:181:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
181 | for(int j=0; j+1<Y[i].size(); j++)
| ~~~^~~~~~~~~~~~
C.cpp:200:11: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<Line>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
200 | for(; p<LY[i-1].size() && LY[i-1][p].r<it.l; p++);
| ~^~~~~~~~~~~~~~~
C.cpp:201:11: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<Line>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
201 | for(; p<LY[i-1].size() && LY[i-1][p].l<=it.r; p++)
| ~^~~~~~~~~~~~~~~
C.cpp:127:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
127 | scanf("%d", &N);
| ~~~~~^~~~~~~~~~
C.cpp:132:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
132 | scanf("%d%d", &y, &x);
| ~~~~~^~~~~~~~~~~~~~~~
C.cpp:214:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
214 | scanf("%d", &Q);
| ~~~~~^~~~~~~~~~
C.cpp:219:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
219 | scanf("%d%d%d", &tt, &y, &x);
| ~~~~~^~~~~~~~~~~~~~~~~~~~~~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
14 ms |
19200 KB |
Output is correct |
2 |
Correct |
14 ms |
19200 KB |
Output is correct |
3 |
Correct |
15 ms |
19200 KB |
Output is correct |
4 |
Correct |
26 ms |
19584 KB |
Output is correct |
5 |
Correct |
26 ms |
19584 KB |
Output is correct |
6 |
Correct |
27 ms |
19584 KB |
Output is correct |
7 |
Correct |
37 ms |
20856 KB |
Output is correct |
8 |
Correct |
47 ms |
20896 KB |
Output is correct |
9 |
Correct |
36 ms |
20856 KB |
Output is correct |
10 |
Correct |
44 ms |
20856 KB |
Output is correct |
11 |
Correct |
38 ms |
20856 KB |
Output is correct |
12 |
Correct |
40 ms |
20864 KB |
Output is correct |
13 |
Correct |
37 ms |
20856 KB |
Output is correct |
14 |
Correct |
36 ms |
20864 KB |
Output is correct |
15 |
Correct |
39 ms |
20856 KB |
Output is correct |
16 |
Correct |
38 ms |
20856 KB |
Output is correct |
17 |
Correct |
37 ms |
20728 KB |
Output is correct |
18 |
Correct |
37 ms |
20864 KB |
Output is correct |
19 |
Correct |
37 ms |
20472 KB |
Output is correct |
20 |
Correct |
40 ms |
20864 KB |
Output is correct |
21 |
Correct |
37 ms |
20856 KB |
Output is correct |
22 |
Correct |
45 ms |
21112 KB |
Output is correct |
23 |
Correct |
44 ms |
21120 KB |
Output is correct |
24 |
Correct |
52 ms |
21368 KB |
Output is correct |
25 |
Correct |
26 ms |
20736 KB |
Output is correct |
26 |
Correct |
27 ms |
20736 KB |
Output is correct |
27 |
Correct |
24 ms |
20736 KB |
Output is correct |
28 |
Correct |
44 ms |
21368 KB |
Output is correct |
29 |
Correct |
44 ms |
21368 KB |
Output is correct |
30 |
Correct |
44 ms |
21496 KB |
Output is correct |
31 |
Correct |
46 ms |
21504 KB |
Output is correct |
32 |
Correct |
45 ms |
21368 KB |
Output is correct |
33 |
Correct |
45 ms |
21240 KB |
Output is correct |
34 |
Correct |
45 ms |
21376 KB |
Output is correct |
35 |
Correct |
46 ms |
21372 KB |
Output is correct |
36 |
Correct |
25 ms |
20696 KB |
Output is correct |
37 |
Correct |
43 ms |
21368 KB |
Output is correct |
38 |
Correct |
46 ms |
21496 KB |
Output is correct |
39 |
Correct |
44 ms |
21500 KB |
Output is correct |
40 |
Correct |
45 ms |
21496 KB |
Output is correct |
41 |
Correct |
43 ms |
21240 KB |
Output is correct |
42 |
Correct |
41 ms |
21120 KB |
Output is correct |
43 |
Correct |
25 ms |
20608 KB |
Output is correct |
44 |
Correct |
43 ms |
21232 KB |
Output is correct |
45 |
Correct |
41 ms |
21112 KB |
Output is correct |
46 |
Correct |
24 ms |
20736 KB |
Output is correct |
47 |
Correct |
36 ms |
20216 KB |
Output is correct |
48 |
Correct |
32 ms |
20084 KB |
Output is correct |
49 |
Correct |
35 ms |
19968 KB |
Output is correct |
50 |
Correct |
31 ms |
19832 KB |
Output is correct |
51 |
Correct |
29 ms |
19584 KB |
Output is correct |
52 |
Correct |
35 ms |
20400 KB |
Output is correct |
53 |
Correct |
35 ms |
20352 KB |
Output is correct |
54 |
Correct |
44 ms |
20344 KB |
Output is correct |
55 |
Correct |
37 ms |
20352 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
14 ms |
19200 KB |
Output is correct |
2 |
Correct |
14 ms |
19200 KB |
Output is correct |
3 |
Correct |
15 ms |
19200 KB |
Output is correct |
4 |
Correct |
26 ms |
19584 KB |
Output is correct |
5 |
Correct |
26 ms |
19584 KB |
Output is correct |
6 |
Correct |
27 ms |
19584 KB |
Output is correct |
7 |
Correct |
37 ms |
20856 KB |
Output is correct |
8 |
Correct |
47 ms |
20896 KB |
Output is correct |
9 |
Correct |
36 ms |
20856 KB |
Output is correct |
10 |
Correct |
44 ms |
20856 KB |
Output is correct |
11 |
Correct |
38 ms |
20856 KB |
Output is correct |
12 |
Correct |
40 ms |
20864 KB |
Output is correct |
13 |
Correct |
37 ms |
20856 KB |
Output is correct |
14 |
Correct |
36 ms |
20864 KB |
Output is correct |
15 |
Correct |
39 ms |
20856 KB |
Output is correct |
16 |
Correct |
38 ms |
20856 KB |
Output is correct |
17 |
Correct |
37 ms |
20728 KB |
Output is correct |
18 |
Correct |
37 ms |
20864 KB |
Output is correct |
19 |
Correct |
37 ms |
20472 KB |
Output is correct |
20 |
Correct |
40 ms |
20864 KB |
Output is correct |
21 |
Correct |
37 ms |
20856 KB |
Output is correct |
22 |
Correct |
45 ms |
21112 KB |
Output is correct |
23 |
Correct |
44 ms |
21120 KB |
Output is correct |
24 |
Correct |
52 ms |
21368 KB |
Output is correct |
25 |
Correct |
26 ms |
20736 KB |
Output is correct |
26 |
Correct |
27 ms |
20736 KB |
Output is correct |
27 |
Correct |
24 ms |
20736 KB |
Output is correct |
28 |
Correct |
44 ms |
21368 KB |
Output is correct |
29 |
Correct |
44 ms |
21368 KB |
Output is correct |
30 |
Correct |
44 ms |
21496 KB |
Output is correct |
31 |
Correct |
46 ms |
21504 KB |
Output is correct |
32 |
Correct |
45 ms |
21368 KB |
Output is correct |
33 |
Correct |
45 ms |
21240 KB |
Output is correct |
34 |
Correct |
45 ms |
21376 KB |
Output is correct |
35 |
Correct |
46 ms |
21372 KB |
Output is correct |
36 |
Correct |
25 ms |
20696 KB |
Output is correct |
37 |
Correct |
43 ms |
21368 KB |
Output is correct |
38 |
Correct |
46 ms |
21496 KB |
Output is correct |
39 |
Correct |
44 ms |
21500 KB |
Output is correct |
40 |
Correct |
45 ms |
21496 KB |
Output is correct |
41 |
Correct |
43 ms |
21240 KB |
Output is correct |
42 |
Correct |
41 ms |
21120 KB |
Output is correct |
43 |
Correct |
25 ms |
20608 KB |
Output is correct |
44 |
Correct |
43 ms |
21232 KB |
Output is correct |
45 |
Correct |
41 ms |
21112 KB |
Output is correct |
46 |
Correct |
24 ms |
20736 KB |
Output is correct |
47 |
Correct |
36 ms |
20216 KB |
Output is correct |
48 |
Correct |
32 ms |
20084 KB |
Output is correct |
49 |
Correct |
35 ms |
19968 KB |
Output is correct |
50 |
Correct |
31 ms |
19832 KB |
Output is correct |
51 |
Correct |
29 ms |
19584 KB |
Output is correct |
52 |
Correct |
35 ms |
20400 KB |
Output is correct |
53 |
Correct |
35 ms |
20352 KB |
Output is correct |
54 |
Correct |
44 ms |
20344 KB |
Output is correct |
55 |
Correct |
37 ms |
20352 KB |
Output is correct |
56 |
Correct |
206 ms |
19924 KB |
Output is correct |
57 |
Correct |
216 ms |
19960 KB |
Output is correct |
58 |
Correct |
229 ms |
20088 KB |
Output is correct |
59 |
Correct |
336 ms |
22136 KB |
Output is correct |
60 |
Correct |
382 ms |
22044 KB |
Output is correct |
61 |
Correct |
349 ms |
22136 KB |
Output is correct |
62 |
Correct |
354 ms |
22008 KB |
Output is correct |
63 |
Correct |
331 ms |
22008 KB |
Output is correct |
64 |
Correct |
349 ms |
22024 KB |
Output is correct |
65 |
Correct |
335 ms |
22140 KB |
Output is correct |
66 |
Correct |
344 ms |
22108 KB |
Output is correct |
67 |
Correct |
323 ms |
22008 KB |
Output is correct |
68 |
Correct |
333 ms |
22008 KB |
Output is correct |
69 |
Correct |
320 ms |
21368 KB |
Output is correct |
70 |
Correct |
327 ms |
22040 KB |
Output is correct |
71 |
Correct |
306 ms |
21368 KB |
Output is correct |
72 |
Correct |
335 ms |
22136 KB |
Output is correct |
73 |
Correct |
329 ms |
22044 KB |
Output is correct |
74 |
Correct |
146 ms |
21344 KB |
Output is correct |
75 |
Correct |
185 ms |
21624 KB |
Output is correct |
76 |
Correct |
130 ms |
21132 KB |
Output is correct |
77 |
Correct |
428 ms |
22788 KB |
Output is correct |
78 |
Correct |
441 ms |
22916 KB |
Output is correct |
79 |
Correct |
128 ms |
21240 KB |
Output is correct |
80 |
Correct |
434 ms |
22788 KB |
Output is correct |
81 |
Correct |
457 ms |
22724 KB |
Output is correct |
82 |
Correct |
410 ms |
22548 KB |
Output is correct |
83 |
Correct |
401 ms |
22404 KB |
Output is correct |
84 |
Correct |
142 ms |
21240 KB |
Output is correct |
85 |
Correct |
396 ms |
22532 KB |
Output is correct |
86 |
Correct |
401 ms |
22388 KB |
Output is correct |
87 |
Correct |
139 ms |
21284 KB |
Output is correct |
88 |
Correct |
307 ms |
21112 KB |
Output is correct |
89 |
Correct |
321 ms |
20808 KB |
Output is correct |
90 |
Correct |
282 ms |
20856 KB |
Output is correct |
91 |
Correct |
252 ms |
20292 KB |
Output is correct |
92 |
Correct |
217 ms |
20220 KB |
Output is correct |
93 |
Correct |
315 ms |
21300 KB |
Output is correct |
94 |
Correct |
313 ms |
21368 KB |
Output is correct |
95 |
Correct |
339 ms |
21348 KB |
Output is correct |
96 |
Correct |
352 ms |
21340 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
376 ms |
51848 KB |
Output is correct |
2 |
Correct |
405 ms |
51884 KB |
Output is correct |
3 |
Correct |
1694 ms |
75412 KB |
Output is correct |
4 |
Correct |
1736 ms |
75896 KB |
Output is correct |
5 |
Correct |
1760 ms |
75528 KB |
Output is correct |
6 |
Correct |
1811 ms |
75460 KB |
Output is correct |
7 |
Correct |
775 ms |
32452 KB |
Output is correct |
8 |
Correct |
307 ms |
41712 KB |
Output is correct |
9 |
Correct |
350 ms |
48624 KB |
Output is correct |
10 |
Correct |
1179 ms |
33152 KB |
Output is correct |
11 |
Correct |
678 ms |
46216 KB |
Output is correct |
12 |
Correct |
369 ms |
50000 KB |
Output is correct |
13 |
Correct |
286 ms |
49136 KB |
Output is correct |
14 |
Correct |
361 ms |
50412 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1377 ms |
55932 KB |
Output is correct |
2 |
Correct |
1305 ms |
56136 KB |
Output is correct |
3 |
Correct |
1463 ms |
56224 KB |
Output is correct |
4 |
Correct |
1596 ms |
64716 KB |
Output is correct |
5 |
Correct |
1531 ms |
64888 KB |
Output is correct |
6 |
Correct |
1588 ms |
64664 KB |
Output is correct |
7 |
Correct |
1275 ms |
55600 KB |
Output is correct |
8 |
Correct |
1251 ms |
55816 KB |
Output is correct |
9 |
Correct |
1351 ms |
56644 KB |
Output is correct |
10 |
Correct |
1823 ms |
68440 KB |
Output is correct |
11 |
Correct |
1789 ms |
68528 KB |
Output is correct |
12 |
Correct |
1998 ms |
72256 KB |
Output is correct |
13 |
Correct |
415 ms |
52776 KB |
Output is correct |
14 |
Correct |
569 ms |
57252 KB |
Output is correct |
15 |
Correct |
309 ms |
50388 KB |
Output is correct |
16 |
Correct |
1846 ms |
74124 KB |
Output is correct |
17 |
Correct |
1842 ms |
74264 KB |
Output is correct |
18 |
Correct |
1872 ms |
75752 KB |
Output is correct |
19 |
Correct |
1870 ms |
77748 KB |
Output is correct |
20 |
Correct |
1761 ms |
74512 KB |
Output is correct |
21 |
Correct |
1883 ms |
74072 KB |
Output is correct |
22 |
Correct |
1934 ms |
75196 KB |
Output is correct |
23 |
Correct |
1865 ms |
75856 KB |
Output is correct |
24 |
Correct |
317 ms |
51556 KB |
Output is correct |
25 |
Correct |
1692 ms |
76420 KB |
Output is correct |
26 |
Correct |
1746 ms |
76536 KB |
Output is correct |
27 |
Correct |
1753 ms |
78072 KB |
Output is correct |
28 |
Correct |
1873 ms |
78200 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
14 ms |
19200 KB |
Output is correct |
2 |
Correct |
14 ms |
19200 KB |
Output is correct |
3 |
Correct |
15 ms |
19200 KB |
Output is correct |
4 |
Correct |
26 ms |
19584 KB |
Output is correct |
5 |
Correct |
26 ms |
19584 KB |
Output is correct |
6 |
Correct |
27 ms |
19584 KB |
Output is correct |
7 |
Correct |
37 ms |
20856 KB |
Output is correct |
8 |
Correct |
47 ms |
20896 KB |
Output is correct |
9 |
Correct |
36 ms |
20856 KB |
Output is correct |
10 |
Correct |
44 ms |
20856 KB |
Output is correct |
11 |
Correct |
38 ms |
20856 KB |
Output is correct |
12 |
Correct |
40 ms |
20864 KB |
Output is correct |
13 |
Correct |
37 ms |
20856 KB |
Output is correct |
14 |
Correct |
36 ms |
20864 KB |
Output is correct |
15 |
Correct |
39 ms |
20856 KB |
Output is correct |
16 |
Correct |
38 ms |
20856 KB |
Output is correct |
17 |
Correct |
37 ms |
20728 KB |
Output is correct |
18 |
Correct |
37 ms |
20864 KB |
Output is correct |
19 |
Correct |
37 ms |
20472 KB |
Output is correct |
20 |
Correct |
40 ms |
20864 KB |
Output is correct |
21 |
Correct |
37 ms |
20856 KB |
Output is correct |
22 |
Correct |
45 ms |
21112 KB |
Output is correct |
23 |
Correct |
44 ms |
21120 KB |
Output is correct |
24 |
Correct |
52 ms |
21368 KB |
Output is correct |
25 |
Correct |
26 ms |
20736 KB |
Output is correct |
26 |
Correct |
27 ms |
20736 KB |
Output is correct |
27 |
Correct |
24 ms |
20736 KB |
Output is correct |
28 |
Correct |
44 ms |
21368 KB |
Output is correct |
29 |
Correct |
44 ms |
21368 KB |
Output is correct |
30 |
Correct |
44 ms |
21496 KB |
Output is correct |
31 |
Correct |
46 ms |
21504 KB |
Output is correct |
32 |
Correct |
45 ms |
21368 KB |
Output is correct |
33 |
Correct |
45 ms |
21240 KB |
Output is correct |
34 |
Correct |
45 ms |
21376 KB |
Output is correct |
35 |
Correct |
46 ms |
21372 KB |
Output is correct |
36 |
Correct |
25 ms |
20696 KB |
Output is correct |
37 |
Correct |
43 ms |
21368 KB |
Output is correct |
38 |
Correct |
46 ms |
21496 KB |
Output is correct |
39 |
Correct |
44 ms |
21500 KB |
Output is correct |
40 |
Correct |
45 ms |
21496 KB |
Output is correct |
41 |
Correct |
43 ms |
21240 KB |
Output is correct |
42 |
Correct |
41 ms |
21120 KB |
Output is correct |
43 |
Correct |
25 ms |
20608 KB |
Output is correct |
44 |
Correct |
43 ms |
21232 KB |
Output is correct |
45 |
Correct |
41 ms |
21112 KB |
Output is correct |
46 |
Correct |
24 ms |
20736 KB |
Output is correct |
47 |
Correct |
36 ms |
20216 KB |
Output is correct |
48 |
Correct |
32 ms |
20084 KB |
Output is correct |
49 |
Correct |
35 ms |
19968 KB |
Output is correct |
50 |
Correct |
31 ms |
19832 KB |
Output is correct |
51 |
Correct |
29 ms |
19584 KB |
Output is correct |
52 |
Correct |
35 ms |
20400 KB |
Output is correct |
53 |
Correct |
35 ms |
20352 KB |
Output is correct |
54 |
Correct |
44 ms |
20344 KB |
Output is correct |
55 |
Correct |
37 ms |
20352 KB |
Output is correct |
56 |
Correct |
206 ms |
19924 KB |
Output is correct |
57 |
Correct |
216 ms |
19960 KB |
Output is correct |
58 |
Correct |
229 ms |
20088 KB |
Output is correct |
59 |
Correct |
336 ms |
22136 KB |
Output is correct |
60 |
Correct |
382 ms |
22044 KB |
Output is correct |
61 |
Correct |
349 ms |
22136 KB |
Output is correct |
62 |
Correct |
354 ms |
22008 KB |
Output is correct |
63 |
Correct |
331 ms |
22008 KB |
Output is correct |
64 |
Correct |
349 ms |
22024 KB |
Output is correct |
65 |
Correct |
335 ms |
22140 KB |
Output is correct |
66 |
Correct |
344 ms |
22108 KB |
Output is correct |
67 |
Correct |
323 ms |
22008 KB |
Output is correct |
68 |
Correct |
333 ms |
22008 KB |
Output is correct |
69 |
Correct |
320 ms |
21368 KB |
Output is correct |
70 |
Correct |
327 ms |
22040 KB |
Output is correct |
71 |
Correct |
306 ms |
21368 KB |
Output is correct |
72 |
Correct |
335 ms |
22136 KB |
Output is correct |
73 |
Correct |
329 ms |
22044 KB |
Output is correct |
74 |
Correct |
146 ms |
21344 KB |
Output is correct |
75 |
Correct |
185 ms |
21624 KB |
Output is correct |
76 |
Correct |
130 ms |
21132 KB |
Output is correct |
77 |
Correct |
428 ms |
22788 KB |
Output is correct |
78 |
Correct |
441 ms |
22916 KB |
Output is correct |
79 |
Correct |
128 ms |
21240 KB |
Output is correct |
80 |
Correct |
434 ms |
22788 KB |
Output is correct |
81 |
Correct |
457 ms |
22724 KB |
Output is correct |
82 |
Correct |
410 ms |
22548 KB |
Output is correct |
83 |
Correct |
401 ms |
22404 KB |
Output is correct |
84 |
Correct |
142 ms |
21240 KB |
Output is correct |
85 |
Correct |
396 ms |
22532 KB |
Output is correct |
86 |
Correct |
401 ms |
22388 KB |
Output is correct |
87 |
Correct |
139 ms |
21284 KB |
Output is correct |
88 |
Correct |
307 ms |
21112 KB |
Output is correct |
89 |
Correct |
321 ms |
20808 KB |
Output is correct |
90 |
Correct |
282 ms |
20856 KB |
Output is correct |
91 |
Correct |
252 ms |
20292 KB |
Output is correct |
92 |
Correct |
217 ms |
20220 KB |
Output is correct |
93 |
Correct |
315 ms |
21300 KB |
Output is correct |
94 |
Correct |
313 ms |
21368 KB |
Output is correct |
95 |
Correct |
339 ms |
21348 KB |
Output is correct |
96 |
Correct |
352 ms |
21340 KB |
Output is correct |
97 |
Correct |
376 ms |
51848 KB |
Output is correct |
98 |
Correct |
405 ms |
51884 KB |
Output is correct |
99 |
Correct |
1694 ms |
75412 KB |
Output is correct |
100 |
Correct |
1736 ms |
75896 KB |
Output is correct |
101 |
Correct |
1760 ms |
75528 KB |
Output is correct |
102 |
Correct |
1811 ms |
75460 KB |
Output is correct |
103 |
Correct |
775 ms |
32452 KB |
Output is correct |
104 |
Correct |
307 ms |
41712 KB |
Output is correct |
105 |
Correct |
350 ms |
48624 KB |
Output is correct |
106 |
Correct |
1179 ms |
33152 KB |
Output is correct |
107 |
Correct |
678 ms |
46216 KB |
Output is correct |
108 |
Correct |
369 ms |
50000 KB |
Output is correct |
109 |
Correct |
286 ms |
49136 KB |
Output is correct |
110 |
Correct |
361 ms |
50412 KB |
Output is correct |
111 |
Correct |
1377 ms |
55932 KB |
Output is correct |
112 |
Correct |
1305 ms |
56136 KB |
Output is correct |
113 |
Correct |
1463 ms |
56224 KB |
Output is correct |
114 |
Correct |
1596 ms |
64716 KB |
Output is correct |
115 |
Correct |
1531 ms |
64888 KB |
Output is correct |
116 |
Correct |
1588 ms |
64664 KB |
Output is correct |
117 |
Correct |
1275 ms |
55600 KB |
Output is correct |
118 |
Correct |
1251 ms |
55816 KB |
Output is correct |
119 |
Correct |
1351 ms |
56644 KB |
Output is correct |
120 |
Correct |
1823 ms |
68440 KB |
Output is correct |
121 |
Correct |
1789 ms |
68528 KB |
Output is correct |
122 |
Correct |
1998 ms |
72256 KB |
Output is correct |
123 |
Correct |
415 ms |
52776 KB |
Output is correct |
124 |
Correct |
569 ms |
57252 KB |
Output is correct |
125 |
Correct |
309 ms |
50388 KB |
Output is correct |
126 |
Correct |
1846 ms |
74124 KB |
Output is correct |
127 |
Correct |
1842 ms |
74264 KB |
Output is correct |
128 |
Correct |
1872 ms |
75752 KB |
Output is correct |
129 |
Correct |
1870 ms |
77748 KB |
Output is correct |
130 |
Correct |
1761 ms |
74512 KB |
Output is correct |
131 |
Correct |
1883 ms |
74072 KB |
Output is correct |
132 |
Correct |
1934 ms |
75196 KB |
Output is correct |
133 |
Correct |
1865 ms |
75856 KB |
Output is correct |
134 |
Correct |
317 ms |
51556 KB |
Output is correct |
135 |
Correct |
1692 ms |
76420 KB |
Output is correct |
136 |
Correct |
1746 ms |
76536 KB |
Output is correct |
137 |
Correct |
1753 ms |
78072 KB |
Output is correct |
138 |
Correct |
1873 ms |
78200 KB |
Output is correct |
139 |
Correct |
460 ms |
26012 KB |
Output is correct |
140 |
Correct |
516 ms |
26912 KB |
Output is correct |
141 |
Correct |
506 ms |
26708 KB |
Output is correct |
142 |
Correct |
549 ms |
27036 KB |
Output is correct |
143 |
Correct |
1299 ms |
56548 KB |
Output is correct |
144 |
Correct |
1496 ms |
65024 KB |
Output is correct |
145 |
Correct |
1421 ms |
56952 KB |
Output is correct |
146 |
Correct |
1209 ms |
51392 KB |
Output is correct |
147 |
Correct |
1607 ms |
66408 KB |
Output is correct |
148 |
Correct |
1623 ms |
66788 KB |
Output is correct |
149 |
Correct |
1719 ms |
72568 KB |
Output is correct |
150 |
Correct |
1587 ms |
71640 KB |
Output is correct |
151 |
Correct |
329 ms |
49548 KB |
Output is correct |
152 |
Correct |
1662 ms |
72568 KB |
Output is correct |
153 |
Correct |
1726 ms |
71548 KB |
Output is correct |
154 |
Correct |
369 ms |
49672 KB |
Output is correct |
155 |
Correct |
1352 ms |
48416 KB |
Output is correct |
156 |
Correct |
1079 ms |
44860 KB |
Output is correct |
157 |
Correct |
937 ms |
38272 KB |
Output is correct |
158 |
Correct |
789 ms |
35212 KB |
Output is correct |
159 |
Correct |
675 ms |
30164 KB |
Output is correct |
160 |
Correct |
1189 ms |
51944 KB |
Output is correct |
161 |
Correct |
1225 ms |
51944 KB |
Output is correct |
162 |
Correct |
1205 ms |
51564 KB |
Output is correct |
163 |
Correct |
1271 ms |
51712 KB |
Output is correct |