답안 #283662

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
283662 2020-08-26T04:54:11 Z arnold518 Iqea (innopolis2018_final_C) C++14
51 / 100
2000 ms 117860 KB
#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], T[MAXN+10];
vector<int> VX[MAXN+10], VY[MAXN+10];
unordered_map<ll, int> M2;

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][30], cdep[MAXN+10];
	vector<int> adj[MAXN+10];

	Tree()
	{
		M=0;
		memset(sz, 0, sizeof(sz));
		memset(del, 0, sizeof(del));
		memset(cpar, 0, sizeof(cpar));
		memset(cdist, 0, sizeof(cdist));
		memset(cdep, 0, sizeof(cdep));
		//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);
		for(int i=1; i<=M; i++) if(!del[i]) while(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 readInt () {
	bool minus = false;
	int result = 0;
	char ch;
	ch = getchar();
	while (true) {
		if (ch == '-') break;
		if (ch >= '0' && ch <= '9') break;
		ch = getchar();
	}
	if (ch == '-') minus = true; else result = ch-'0';
	while (true) {
		ch = getchar();
		if (ch < '0' || ch > '9') break;
		result = result*10 + (ch - '0');
	}
	if (minus)
		return -result;
	else
		return result;
}

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);
	}

	int cnt=0;
	for(int i=2; i<=MAXN; i++)
	{
		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);
				cnt++;
				//printf("adjX %d %d\n", u, v);
			}
			if(p) p--;
		}
	}
	if(cnt!=TX.M-1) while(1);

	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);
	}

	cnt=0;
	for(int i=2; i<=MAXN; i++)
	{
		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);
				cnt++;
				//printf("adjY %d %d\n", u, v);
			}
			if(p) p--;
		}
	}
	if(cnt!=TY.M-1) while(1);

	TX.init(); TY.init();

	for(int i=1; i<=N; i++)
	{
		pii t=get(A[i].first, A[i].second);
		VX[i]=TX.getpar(t.first);
		VY[i]=TY.getpar(t.second);
		T[i]=t;

		ll pt=((ll)A[i].first<<20)|A[i].second;
		M2[pt]=i;
	}

	scanf("%d", &Q);
	bool flag=false;
	while(Q--)
	{
		int tt, y, x;
		scanf("%d%d%d", &tt, &y, &x);
		//tt=readInt(); y=readInt(); x=readInt();

		int pt=M2[((ll)y<<20)|x];
		vector<int> &V1=VX[pt], &V2=VY[pt];
		pii &t=T[pt];
		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:174:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  174 |   for(int j=0; j+1<X[i].size(); j++)
      |                ~~~^~~~~~~~~~~~
C.cpp:193:11: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<Line>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  193 |    for(; p<LX[i-1].size() && LX[i-1][p].r<it.l; p++);
      |          ~^~~~~~~~~~~~~~~
C.cpp:194:11: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<Line>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  194 |    for(; p<LX[i-1].size() && LX[i-1][p].l<=it.r; p++)
      |          ~^~~~~~~~~~~~~~~
C.cpp:213:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  213 |   for(int j=0; j+1<Y[i].size(); j++)
      |                ~~~^~~~~~~~~~~~
C.cpp:232:11: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<Line>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  232 |    for(; p<LY[i-1].size() && LY[i-1][p].r<it.l; p++);
      |          ~^~~~~~~~~~~~~~~
C.cpp:233:11: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<Line>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  233 |    for(; p<LY[i-1].size() && LY[i-1][p].l<=it.r; p++)
      |          ~^~~~~~~~~~~~~~~
C.cpp:157:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  157 |  scanf("%d", &N);
      |  ~~~~~^~~~~~~~~~
C.cpp:162:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  162 |   scanf("%d%d", &y, &x);
      |   ~~~~~^~~~~~~~~~~~~~~~
C.cpp:259:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  259 |  scanf("%d", &Q);
      |  ~~~~~^~~~~~~~~~
C.cpp:264:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  264 |   scanf("%d%d%d", &tt, &y, &x);
      |   ~~~~~^~~~~~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 32 ms 50432 KB Output is correct
2 Correct 32 ms 50424 KB Output is correct
3 Correct 38 ms 50424 KB Output is correct
4 Correct 44 ms 51320 KB Output is correct
5 Correct 47 ms 51360 KB Output is correct
6 Correct 46 ms 51448 KB Output is correct
7 Correct 58 ms 52344 KB Output is correct
8 Correct 58 ms 52472 KB Output is correct
9 Correct 57 ms 52472 KB Output is correct
10 Correct 57 ms 52344 KB Output is correct
11 Correct 56 ms 52412 KB Output is correct
12 Correct 55 ms 52472 KB Output is correct
13 Correct 55 ms 52472 KB Output is correct
14 Correct 57 ms 52472 KB Output is correct
15 Correct 55 ms 52472 KB Output is correct
16 Correct 59 ms 52472 KB Output is correct
17 Correct 56 ms 52472 KB Output is correct
18 Correct 56 ms 52344 KB Output is correct
19 Correct 53 ms 52088 KB Output is correct
20 Correct 58 ms 52472 KB Output is correct
21 Correct 57 ms 52600 KB Output is correct
22 Correct 63 ms 52812 KB Output is correct
23 Correct 62 ms 52856 KB Output is correct
24 Correct 64 ms 53184 KB Output is correct
25 Correct 45 ms 52344 KB Output is correct
26 Correct 46 ms 52344 KB Output is correct
27 Correct 44 ms 52216 KB Output is correct
28 Correct 66 ms 53112 KB Output is correct
29 Correct 64 ms 53112 KB Output is correct
30 Correct 65 ms 53240 KB Output is correct
31 Correct 62 ms 53240 KB Output is correct
32 Correct 66 ms 53112 KB Output is correct
33 Correct 69 ms 53112 KB Output is correct
34 Correct 63 ms 53112 KB Output is correct
35 Correct 66 ms 53112 KB Output is correct
36 Correct 44 ms 52216 KB Output is correct
37 Correct 62 ms 53112 KB Output is correct
38 Correct 65 ms 53112 KB Output is correct
39 Correct 61 ms 53240 KB Output is correct
40 Correct 69 ms 53240 KB Output is correct
41 Correct 63 ms 52856 KB Output is correct
42 Correct 63 ms 52856 KB Output is correct
43 Correct 45 ms 52344 KB Output is correct
44 Correct 59 ms 52984 KB Output is correct
45 Correct 61 ms 52856 KB Output is correct
46 Correct 45 ms 52224 KB Output is correct
47 Correct 54 ms 52088 KB Output is correct
48 Correct 51 ms 51832 KB Output is correct
49 Correct 51 ms 51840 KB Output is correct
50 Correct 48 ms 51576 KB Output is correct
51 Correct 58 ms 51448 KB Output is correct
52 Correct 61 ms 52216 KB Output is correct
53 Correct 56 ms 52216 KB Output is correct
54 Correct 59 ms 52216 KB Output is correct
55 Correct 55 ms 52216 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 32 ms 50432 KB Output is correct
2 Correct 32 ms 50424 KB Output is correct
3 Correct 38 ms 50424 KB Output is correct
4 Correct 44 ms 51320 KB Output is correct
5 Correct 47 ms 51360 KB Output is correct
6 Correct 46 ms 51448 KB Output is correct
7 Correct 58 ms 52344 KB Output is correct
8 Correct 58 ms 52472 KB Output is correct
9 Correct 57 ms 52472 KB Output is correct
10 Correct 57 ms 52344 KB Output is correct
11 Correct 56 ms 52412 KB Output is correct
12 Correct 55 ms 52472 KB Output is correct
13 Correct 55 ms 52472 KB Output is correct
14 Correct 57 ms 52472 KB Output is correct
15 Correct 55 ms 52472 KB Output is correct
16 Correct 59 ms 52472 KB Output is correct
17 Correct 56 ms 52472 KB Output is correct
18 Correct 56 ms 52344 KB Output is correct
19 Correct 53 ms 52088 KB Output is correct
20 Correct 58 ms 52472 KB Output is correct
21 Correct 57 ms 52600 KB Output is correct
22 Correct 63 ms 52812 KB Output is correct
23 Correct 62 ms 52856 KB Output is correct
24 Correct 64 ms 53184 KB Output is correct
25 Correct 45 ms 52344 KB Output is correct
26 Correct 46 ms 52344 KB Output is correct
27 Correct 44 ms 52216 KB Output is correct
28 Correct 66 ms 53112 KB Output is correct
29 Correct 64 ms 53112 KB Output is correct
30 Correct 65 ms 53240 KB Output is correct
31 Correct 62 ms 53240 KB Output is correct
32 Correct 66 ms 53112 KB Output is correct
33 Correct 69 ms 53112 KB Output is correct
34 Correct 63 ms 53112 KB Output is correct
35 Correct 66 ms 53112 KB Output is correct
36 Correct 44 ms 52216 KB Output is correct
37 Correct 62 ms 53112 KB Output is correct
38 Correct 65 ms 53112 KB Output is correct
39 Correct 61 ms 53240 KB Output is correct
40 Correct 69 ms 53240 KB Output is correct
41 Correct 63 ms 52856 KB Output is correct
42 Correct 63 ms 52856 KB Output is correct
43 Correct 45 ms 52344 KB Output is correct
44 Correct 59 ms 52984 KB Output is correct
45 Correct 61 ms 52856 KB Output is correct
46 Correct 45 ms 52224 KB Output is correct
47 Correct 54 ms 52088 KB Output is correct
48 Correct 51 ms 51832 KB Output is correct
49 Correct 51 ms 51840 KB Output is correct
50 Correct 48 ms 51576 KB Output is correct
51 Correct 58 ms 51448 KB Output is correct
52 Correct 61 ms 52216 KB Output is correct
53 Correct 56 ms 52216 KB Output is correct
54 Correct 59 ms 52216 KB Output is correct
55 Correct 55 ms 52216 KB Output is correct
56 Correct 188 ms 51812 KB Output is correct
57 Correct 196 ms 51832 KB Output is correct
58 Correct 184 ms 51960 KB Output is correct
59 Correct 288 ms 53496 KB Output is correct
60 Correct 316 ms 53636 KB Output is correct
61 Correct 306 ms 53624 KB Output is correct
62 Correct 317 ms 53660 KB Output is correct
63 Correct 301 ms 53608 KB Output is correct
64 Correct 317 ms 53636 KB Output is correct
65 Correct 291 ms 53624 KB Output is correct
66 Correct 334 ms 53636 KB Output is correct
67 Correct 288 ms 53624 KB Output is correct
68 Correct 335 ms 53752 KB Output is correct
69 Correct 296 ms 53112 KB Output is correct
70 Correct 297 ms 53628 KB Output is correct
71 Correct 302 ms 52856 KB Output is correct
72 Correct 304 ms 53752 KB Output is correct
73 Correct 307 ms 53624 KB Output is correct
74 Correct 132 ms 52856 KB Output is correct
75 Correct 166 ms 53368 KB Output is correct
76 Correct 118 ms 52856 KB Output is correct
77 Correct 415 ms 54536 KB Output is correct
78 Correct 419 ms 54484 KB Output is correct
79 Correct 122 ms 52772 KB Output is correct
80 Correct 405 ms 54496 KB Output is correct
81 Correct 414 ms 54456 KB Output is correct
82 Correct 373 ms 54176 KB Output is correct
83 Correct 390 ms 54176 KB Output is correct
84 Correct 128 ms 52728 KB Output is correct
85 Correct 364 ms 54188 KB Output is correct
86 Correct 362 ms 54148 KB Output is correct
87 Correct 125 ms 52856 KB Output is correct
88 Correct 273 ms 52856 KB Output is correct
89 Correct 259 ms 52600 KB Output is correct
90 Correct 254 ms 52772 KB Output is correct
91 Correct 226 ms 52216 KB Output is correct
92 Correct 190 ms 51960 KB Output is correct
93 Correct 286 ms 53112 KB Output is correct
94 Correct 283 ms 53112 KB Output is correct
95 Correct 322 ms 53092 KB Output is correct
96 Correct 318 ms 53112 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 517 ms 91276 KB Output is correct
2 Correct 514 ms 91292 KB Output is correct
3 Correct 1815 ms 117256 KB Output is correct
4 Correct 1903 ms 117860 KB Output is correct
5 Correct 1833 ms 117612 KB Output is correct
6 Correct 1935 ms 117332 KB Output is correct
7 Correct 895 ms 82112 KB Output is correct
8 Correct 419 ms 83080 KB Output is correct
9 Correct 409 ms 88068 KB Output is correct
10 Correct 1297 ms 82704 KB Output is correct
11 Correct 737 ms 87952 KB Output is correct
12 Correct 464 ms 89352 KB Output is correct
13 Correct 409 ms 88328 KB Output is correct
14 Correct 438 ms 89688 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1403 ms 97052 KB Output is correct
2 Correct 1494 ms 97500 KB Output is correct
3 Correct 1507 ms 97520 KB Output is correct
4 Correct 1590 ms 106280 KB Output is correct
5 Correct 1598 ms 106220 KB Output is correct
6 Correct 1615 ms 106064 KB Output is correct
7 Correct 1407 ms 96940 KB Output is correct
8 Correct 1332 ms 96948 KB Output is correct
9 Correct 1573 ms 97768 KB Output is correct
10 Correct 1983 ms 110436 KB Output is correct
11 Correct 1903 ms 110620 KB Output is correct
12 Execution timed out 2067 ms 114456 KB Time limit exceeded
13 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 32 ms 50432 KB Output is correct
2 Correct 32 ms 50424 KB Output is correct
3 Correct 38 ms 50424 KB Output is correct
4 Correct 44 ms 51320 KB Output is correct
5 Correct 47 ms 51360 KB Output is correct
6 Correct 46 ms 51448 KB Output is correct
7 Correct 58 ms 52344 KB Output is correct
8 Correct 58 ms 52472 KB Output is correct
9 Correct 57 ms 52472 KB Output is correct
10 Correct 57 ms 52344 KB Output is correct
11 Correct 56 ms 52412 KB Output is correct
12 Correct 55 ms 52472 KB Output is correct
13 Correct 55 ms 52472 KB Output is correct
14 Correct 57 ms 52472 KB Output is correct
15 Correct 55 ms 52472 KB Output is correct
16 Correct 59 ms 52472 KB Output is correct
17 Correct 56 ms 52472 KB Output is correct
18 Correct 56 ms 52344 KB Output is correct
19 Correct 53 ms 52088 KB Output is correct
20 Correct 58 ms 52472 KB Output is correct
21 Correct 57 ms 52600 KB Output is correct
22 Correct 63 ms 52812 KB Output is correct
23 Correct 62 ms 52856 KB Output is correct
24 Correct 64 ms 53184 KB Output is correct
25 Correct 45 ms 52344 KB Output is correct
26 Correct 46 ms 52344 KB Output is correct
27 Correct 44 ms 52216 KB Output is correct
28 Correct 66 ms 53112 KB Output is correct
29 Correct 64 ms 53112 KB Output is correct
30 Correct 65 ms 53240 KB Output is correct
31 Correct 62 ms 53240 KB Output is correct
32 Correct 66 ms 53112 KB Output is correct
33 Correct 69 ms 53112 KB Output is correct
34 Correct 63 ms 53112 KB Output is correct
35 Correct 66 ms 53112 KB Output is correct
36 Correct 44 ms 52216 KB Output is correct
37 Correct 62 ms 53112 KB Output is correct
38 Correct 65 ms 53112 KB Output is correct
39 Correct 61 ms 53240 KB Output is correct
40 Correct 69 ms 53240 KB Output is correct
41 Correct 63 ms 52856 KB Output is correct
42 Correct 63 ms 52856 KB Output is correct
43 Correct 45 ms 52344 KB Output is correct
44 Correct 59 ms 52984 KB Output is correct
45 Correct 61 ms 52856 KB Output is correct
46 Correct 45 ms 52224 KB Output is correct
47 Correct 54 ms 52088 KB Output is correct
48 Correct 51 ms 51832 KB Output is correct
49 Correct 51 ms 51840 KB Output is correct
50 Correct 48 ms 51576 KB Output is correct
51 Correct 58 ms 51448 KB Output is correct
52 Correct 61 ms 52216 KB Output is correct
53 Correct 56 ms 52216 KB Output is correct
54 Correct 59 ms 52216 KB Output is correct
55 Correct 55 ms 52216 KB Output is correct
56 Correct 188 ms 51812 KB Output is correct
57 Correct 196 ms 51832 KB Output is correct
58 Correct 184 ms 51960 KB Output is correct
59 Correct 288 ms 53496 KB Output is correct
60 Correct 316 ms 53636 KB Output is correct
61 Correct 306 ms 53624 KB Output is correct
62 Correct 317 ms 53660 KB Output is correct
63 Correct 301 ms 53608 KB Output is correct
64 Correct 317 ms 53636 KB Output is correct
65 Correct 291 ms 53624 KB Output is correct
66 Correct 334 ms 53636 KB Output is correct
67 Correct 288 ms 53624 KB Output is correct
68 Correct 335 ms 53752 KB Output is correct
69 Correct 296 ms 53112 KB Output is correct
70 Correct 297 ms 53628 KB Output is correct
71 Correct 302 ms 52856 KB Output is correct
72 Correct 304 ms 53752 KB Output is correct
73 Correct 307 ms 53624 KB Output is correct
74 Correct 132 ms 52856 KB Output is correct
75 Correct 166 ms 53368 KB Output is correct
76 Correct 118 ms 52856 KB Output is correct
77 Correct 415 ms 54536 KB Output is correct
78 Correct 419 ms 54484 KB Output is correct
79 Correct 122 ms 52772 KB Output is correct
80 Correct 405 ms 54496 KB Output is correct
81 Correct 414 ms 54456 KB Output is correct
82 Correct 373 ms 54176 KB Output is correct
83 Correct 390 ms 54176 KB Output is correct
84 Correct 128 ms 52728 KB Output is correct
85 Correct 364 ms 54188 KB Output is correct
86 Correct 362 ms 54148 KB Output is correct
87 Correct 125 ms 52856 KB Output is correct
88 Correct 273 ms 52856 KB Output is correct
89 Correct 259 ms 52600 KB Output is correct
90 Correct 254 ms 52772 KB Output is correct
91 Correct 226 ms 52216 KB Output is correct
92 Correct 190 ms 51960 KB Output is correct
93 Correct 286 ms 53112 KB Output is correct
94 Correct 283 ms 53112 KB Output is correct
95 Correct 322 ms 53092 KB Output is correct
96 Correct 318 ms 53112 KB Output is correct
97 Correct 517 ms 91276 KB Output is correct
98 Correct 514 ms 91292 KB Output is correct
99 Correct 1815 ms 117256 KB Output is correct
100 Correct 1903 ms 117860 KB Output is correct
101 Correct 1833 ms 117612 KB Output is correct
102 Correct 1935 ms 117332 KB Output is correct
103 Correct 895 ms 82112 KB Output is correct
104 Correct 419 ms 83080 KB Output is correct
105 Correct 409 ms 88068 KB Output is correct
106 Correct 1297 ms 82704 KB Output is correct
107 Correct 737 ms 87952 KB Output is correct
108 Correct 464 ms 89352 KB Output is correct
109 Correct 409 ms 88328 KB Output is correct
110 Correct 438 ms 89688 KB Output is correct
111 Correct 1403 ms 97052 KB Output is correct
112 Correct 1494 ms 97500 KB Output is correct
113 Correct 1507 ms 97520 KB Output is correct
114 Correct 1590 ms 106280 KB Output is correct
115 Correct 1598 ms 106220 KB Output is correct
116 Correct 1615 ms 106064 KB Output is correct
117 Correct 1407 ms 96940 KB Output is correct
118 Correct 1332 ms 96948 KB Output is correct
119 Correct 1573 ms 97768 KB Output is correct
120 Correct 1983 ms 110436 KB Output is correct
121 Correct 1903 ms 110620 KB Output is correct
122 Execution timed out 2067 ms 114456 KB Time limit exceeded
123 Halted 0 ms 0 KB -