답안 #198102

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
198102 2020-01-24T18:00:04 Z model_code Building Skyscrapers (CEOI19_skyscrapers) C++17
100 / 100
3054 ms 31808 KB
#include<cstdio>
#include<vector>
#include<map>
#include<algorithm>
#include<set>
using namespace std;

typedef pair<int, int> pii;
#define X first
#define Y second

const int dx[8] = {-1, 0, 1, 1, 1, 0, -1, -1}, dy[8] = {-1, -1, -1, 0, 1, 1, 1, 0};
const int next_edge_dx[4][4] = {{0, 1, 0, -1}, {1, 1, -1, -1}, {1, 0, -1, 0}, {0, 0, 0, 0}};
const int next_edge_dy[4][4] = {{-1, 0, 1, 0}, {-1, 1, 1, -1}, {0, 1, 0, -1}, {0, 0, 0, 0}};
const int next_edge_dir[4][4] = {{2, 3, 0, 1}, {3, 0, 1, 2}, {0, 1, 2, 3}, {1, 2, 3, 0}};

uint64_t ptoh(pair<int, int> & p) {
    constexpr int C0 = 1000000000 + 10;
    uint64_t res = p.X+C0;
    res <<= 32;
    res += p.Y+C0;
    return res;
}

vector<pii> where_am_i;
map<uint64_t, int> who_is_here;
vector<bool> visited;

set<int> egligible;
vector<int> next_edge, prev_edge;
vector<int> edge_parent;
vector<int> edge_rank;
int outer_boss;

int get_boss(int eid) {
	if (edge_parent[eid] == -1) return eid;
	return edge_parent[eid] = get_boss(edge_parent[eid]);
}

void join_sets(int eid1, int eid2) {
	eid1 = get_boss(eid1);
	eid2 = get_boss(eid2);
	if (eid1 == eid2) return;
	if (edge_rank[eid1] < edge_rank[eid2]) swap(eid1, eid2);
	edge_parent[eid2] = eid1;
	if (outer_boss == eid2) outer_boss = eid1;
	edge_rank[eid1] = max(edge_rank[eid1], edge_rank[eid2] + 1);
}

int find_next_edge(int edge_id) {
	pii position = where_am_i[edge_id / 4];
	int direction = edge_id % 4;
	for (int i=0; i<4; i++) {
		pii nposition(position.X + next_edge_dx[i][direction], position.Y + next_edge_dy[i][direction]);
		auto it = who_is_here.find(ptoh(nposition));
		if (it != end(who_is_here)) {
			int next_tile_id = it->Y;
			return next_tile_id * 4 + next_edge_dir[i][direction];
		}
	}
}

void find_and_join_next(int edge_id) {
	int next_eid = find_next_edge(edge_id);
	next_edge[edge_id] = next_eid;
	prev_edge[next_eid] = edge_id;
	join_sets(edge_id, next_eid);
}

void join_edges(int tile_id) {
	pii position = where_am_i[tile_id];
	for (int direction = 0; direction < 4; direction++) {
		find_and_join_next(tile_id * 4 + direction);
	}
}


void check_egligible(int tile_id) {
	bool is_egligible = false;
	vector<int> distinct_loops;
	for (int direction=0; direction<4; direction++) {
		int eid = tile_id * 4 + direction;
		if (get_boss(eid) == outer_boss) is_egligible = true;
		int next_eid = find_next_edge(eid);
		if (next_eid / 4 != tile_id) {
			distinct_loops.push_back(get_boss(eid));
		}
	}
	
	for (int i=0; i<distinct_loops.size(); i++) {
		for (int j=0; j<i; j++) {
			if (distinct_loops[i] == distinct_loops[j]) is_egligible = false;
		}
	}
	
	if (is_egligible) {
		egligible.insert(tile_id);
	}
	else {
		if (egligible.count(tile_id) > 0) {
			egligible.erase(tile_id);
		}
	}
}

void get_possible_changes(int be_id, vector<int> &to_check) {
	to_check.push_back(be_id / 4);
	while (true) {
		int next_edge_id = find_next_edge(be_id);
		to_check.push_back(next_edge_id/4);
		if (get_boss(next_edge_id) == outer_boss) break;
		be_id = next_edge_id;
	}
}

void fix_edges_after_removal(int tile_id) {
	vector<int> to_check;
	for (int direction=0; direction<4; direction++) {
		int edge_id = tile_id * 4 + direction;
		int previous_edge_id = prev_edge[edge_id];
		if (previous_edge_id / 4 != tile_id) {
			if (get_boss(previous_edge_id) == outer_boss) {
				get_possible_changes(previous_edge_id, to_check);
			}
		}
	}
	for (int direction = 0; direction<4; direction++) {
		int edge_id = tile_id * 4 + direction;
		int previous_edge_id = prev_edge[edge_id];
		if (previous_edge_id / 4 != tile_id) {
			find_and_join_next(previous_edge_id);
		}
	}
	for (int tile_id : to_check) {
		check_egligible(tile_id);
	}
}

void dfs(int id) {
	if (visited[id]) return;
	visited[id] = true;
	for (int dir = 0; dir < 8; dir++) {
		pii ncoor(where_am_i[id].X + dx[dir], where_am_i[id].Y + dy[dir]);
		if (who_is_here.count(ptoh(ncoor)) > 0) {
			dfs(who_is_here[ptoh(ncoor)]);
		}
	}
}





int main() {
	int n, t;
	scanf("%d %d", &n, &t);
	where_am_i.resize(n);
	for (int i=0; i<n; i++) {
		scanf("%d %d", &where_am_i[i].X, &where_am_i[i].Y);
		who_is_here[ptoh(where_am_i[i])] = i;
	}
	
	visited.resize(n, false);
	dfs(0);
	for (bool v : visited) {
		if (!v) {
			printf("No\n");
			return 0;
		}
	}
	
	next_edge.resize(4*n);
	prev_edge.resize(4*n);
	edge_parent.resize(4*n, -1);
	edge_rank.resize(4*n, 0);
	
	outer_boss == -1;
	for (int i=0; i<n; i++) {
		join_edges(i);
	}
	
	int top_left = who_is_here.begin()->second;
	outer_boss = get_boss(top_left * 4 + 3);
	
	for (int i=0; i<n; i++) {
		check_egligible(i);
	}
	
	
	vector<int> result;
	while (!egligible.empty()) {
		
		/*fprintf(stderr, "egligible:");
		for (int x : egligible) {
			fprintf(stderr, " %d", x);
		}
		fprintf(stderr, "\n");*/
		
		auto it = egligible.end();
		it--;
		int current = *it;
		egligible.erase(current);
		who_is_here.erase(ptoh(where_am_i[current]));
		fix_edges_after_removal(current);
		
		result.push_back(current);
	}
	printf("Yes\n");
	reverse(result.begin(), result.end());
	for (int id : result) {
		printf("%d\n", id+1);
	}
	
	return 0;
}

Compilation message

skyscrapers.cpp: In function 'void join_edges(int)':
skyscrapers.cpp:71:6: warning: variable 'position' set but not used [-Wunused-but-set-variable]
  pii position = where_am_i[tile_id];
      ^~~~~~~~
skyscrapers.cpp: In function 'void check_egligible(int)':
skyscrapers.cpp:90:17: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for (int i=0; i<distinct_loops.size(); i++) {
                ~^~~~~~~~~~~~~~~~~~~~~~
skyscrapers.cpp: In function 'int main()':
skyscrapers.cpp:177:13: warning: statement has no effect [-Wunused-value]
  outer_boss == -1;
  ~~~~~~~~~~~^~~~~
skyscrapers.cpp: In function 'int find_next_edge(int)':
skyscrapers.cpp:61:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
skyscrapers.cpp: In function 'int main()':
skyscrapers.cpp:156:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d %d", &n, &t);
  ~~~~~^~~~~~~~~~~~~~~~~
skyscrapers.cpp:159:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d %d", &where_am_i[i].X, &where_am_i[i].Y);
   ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 256 KB ans=YES N=1
2 Correct 6 ms 376 KB ans=YES N=4
3 Correct 2 ms 256 KB ans=NO N=4
4 Correct 2 ms 256 KB ans=YES N=5
5 Correct 2 ms 252 KB ans=YES N=9
6 Correct 2 ms 376 KB ans=YES N=5
7 Correct 2 ms 376 KB ans=NO N=9
8 Correct 3 ms 376 KB ans=NO N=10
9 Correct 2 ms 256 KB ans=YES N=10
10 Correct 2 ms 256 KB ans=YES N=10
11 Correct 2 ms 256 KB ans=YES N=10
12 Correct 3 ms 376 KB ans=YES N=9
13 Correct 2 ms 376 KB ans=YES N=9
14 Correct 4 ms 376 KB ans=YES N=8
15 Correct 2 ms 256 KB ans=YES N=8
16 Correct 2 ms 256 KB ans=NO N=2
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 256 KB ans=YES N=1
2 Correct 6 ms 376 KB ans=YES N=4
3 Correct 2 ms 256 KB ans=NO N=4
4 Correct 2 ms 256 KB ans=YES N=5
5 Correct 2 ms 252 KB ans=YES N=9
6 Correct 2 ms 376 KB ans=YES N=5
7 Correct 2 ms 376 KB ans=NO N=9
8 Correct 3 ms 376 KB ans=NO N=10
9 Correct 2 ms 256 KB ans=YES N=10
10 Correct 2 ms 256 KB ans=YES N=10
11 Correct 2 ms 256 KB ans=YES N=10
12 Correct 3 ms 376 KB ans=YES N=9
13 Correct 2 ms 376 KB ans=YES N=9
14 Correct 4 ms 376 KB ans=YES N=8
15 Correct 2 ms 256 KB ans=YES N=8
16 Correct 2 ms 256 KB ans=NO N=2
17 Correct 2 ms 380 KB ans=YES N=17
18 Correct 2 ms 256 KB ans=YES N=25
19 Correct 2 ms 256 KB ans=YES N=100
20 Correct 3 ms 376 KB ans=YES N=185
21 Correct 2 ms 256 KB ans=NO N=174
22 Correct 2 ms 256 KB ans=YES N=90
23 Correct 0 ms 256 KB ans=YES N=63
24 Correct 2 ms 256 KB ans=YES N=87
25 Correct 4 ms 380 KB ans=YES N=183
26 Correct 2 ms 376 KB ans=YES N=188
27 Correct 3 ms 376 KB ans=YES N=183
28 Correct 3 ms 504 KB ans=YES N=189
29 Correct 3 ms 376 KB ans=YES N=200
30 Correct 3 ms 256 KB ans=YES N=190
31 Correct 3 ms 376 KB ans=YES N=187
32 Correct 3 ms 376 KB ans=YES N=187
33 Correct 3 ms 376 KB ans=YES N=182
34 Correct 3 ms 376 KB ans=YES N=184
35 Correct 2 ms 376 KB ans=YES N=188
36 Correct 3 ms 256 KB ans=YES N=181
37 Correct 3 ms 376 KB ans=YES N=188
38 Correct 5 ms 348 KB ans=YES N=191
39 Correct 3 ms 376 KB ans=YES N=196
40 Correct 3 ms 376 KB ans=YES N=196
41 Correct 3 ms 376 KB ans=YES N=196
42 Correct 3 ms 376 KB ans=YES N=196
43 Correct 3 ms 376 KB ans=YES N=195
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 256 KB ans=YES N=1
2 Correct 6 ms 376 KB ans=YES N=4
3 Correct 2 ms 256 KB ans=NO N=4
4 Correct 2 ms 256 KB ans=YES N=5
5 Correct 2 ms 252 KB ans=YES N=9
6 Correct 2 ms 376 KB ans=YES N=5
7 Correct 2 ms 376 KB ans=NO N=9
8 Correct 3 ms 376 KB ans=NO N=10
9 Correct 2 ms 256 KB ans=YES N=10
10 Correct 2 ms 256 KB ans=YES N=10
11 Correct 2 ms 256 KB ans=YES N=10
12 Correct 3 ms 376 KB ans=YES N=9
13 Correct 2 ms 376 KB ans=YES N=9
14 Correct 4 ms 376 KB ans=YES N=8
15 Correct 2 ms 256 KB ans=YES N=8
16 Correct 2 ms 256 KB ans=NO N=2
17 Correct 2 ms 380 KB ans=YES N=17
18 Correct 2 ms 256 KB ans=YES N=25
19 Correct 2 ms 256 KB ans=YES N=100
20 Correct 3 ms 376 KB ans=YES N=185
21 Correct 2 ms 256 KB ans=NO N=174
22 Correct 2 ms 256 KB ans=YES N=90
23 Correct 0 ms 256 KB ans=YES N=63
24 Correct 2 ms 256 KB ans=YES N=87
25 Correct 4 ms 380 KB ans=YES N=183
26 Correct 2 ms 376 KB ans=YES N=188
27 Correct 3 ms 376 KB ans=YES N=183
28 Correct 3 ms 504 KB ans=YES N=189
29 Correct 3 ms 376 KB ans=YES N=200
30 Correct 3 ms 256 KB ans=YES N=190
31 Correct 3 ms 376 KB ans=YES N=187
32 Correct 3 ms 376 KB ans=YES N=187
33 Correct 3 ms 376 KB ans=YES N=182
34 Correct 3 ms 376 KB ans=YES N=184
35 Correct 2 ms 376 KB ans=YES N=188
36 Correct 3 ms 256 KB ans=YES N=181
37 Correct 3 ms 376 KB ans=YES N=188
38 Correct 5 ms 348 KB ans=YES N=191
39 Correct 3 ms 376 KB ans=YES N=196
40 Correct 3 ms 376 KB ans=YES N=196
41 Correct 3 ms 376 KB ans=YES N=196
42 Correct 3 ms 376 KB ans=YES N=196
43 Correct 3 ms 376 KB ans=YES N=195
44 Correct 3 ms 508 KB ans=NO N=1934
45 Correct 3 ms 376 KB ans=NO N=1965
46 Correct 15 ms 732 KB ans=YES N=1824
47 Correct 17 ms 740 KB ans=YES N=1981
48 Correct 15 ms 652 KB ans=YES N=1814
49 Correct 16 ms 632 KB ans=YES N=1854
50 Correct 14 ms 760 KB ans=YES N=1831
51 Correct 9 ms 764 KB ans=YES N=2000
52 Correct 18 ms 704 KB ans=YES N=1847
53 Correct 18 ms 572 KB ans=YES N=1819
54 Correct 18 ms 740 KB ans=YES N=1986
55 Correct 20 ms 632 KB ans=YES N=2000
56 Correct 15 ms 724 KB ans=YES N=1834
57 Correct 8 ms 708 KB ans=YES N=1860
58 Correct 18 ms 632 KB ans=YES N=1898
59 Correct 15 ms 632 KB ans=YES N=1832
60 Correct 14 ms 640 KB ans=YES N=1929
61 Correct 17 ms 708 KB ans=YES N=1919
62 Correct 16 ms 632 KB ans=YES N=1882
63 Correct 13 ms 632 KB ans=YES N=1922
64 Correct 10 ms 740 KB ans=YES N=1989
65 Correct 9 ms 632 KB ans=YES N=1978
66 Correct 3 ms 636 KB ans=YES N=1867
67 Correct 18 ms 732 KB ans=YES N=1942
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 420 KB ans=NO N=1934
2 Correct 3 ms 376 KB ans=NO N=1965
3 Correct 16 ms 732 KB ans=YES N=1824
4 Correct 17 ms 760 KB ans=YES N=1981
5 Correct 16 ms 732 KB ans=YES N=1814
6 Correct 19 ms 732 KB ans=YES N=1854
7 Correct 11 ms 636 KB ans=YES N=1831
8 Correct 17 ms 732 KB ans=YES N=2000
9 Correct 25 ms 612 KB ans=YES N=1847
10 Correct 15 ms 692 KB ans=YES N=1819
11 Correct 20 ms 760 KB ans=YES N=1986
12 Correct 19 ms 732 KB ans=YES N=2000
13 Correct 17 ms 796 KB ans=YES N=1834
14 Correct 17 ms 632 KB ans=YES N=1860
15 Correct 18 ms 732 KB ans=YES N=1898
16 Correct 16 ms 632 KB ans=YES N=1832
17 Correct 14 ms 640 KB ans=YES N=1929
18 Correct 14 ms 732 KB ans=YES N=1919
19 Correct 15 ms 680 KB ans=YES N=1882
20 Correct 3 ms 604 KB ans=YES N=1922
21 Correct 16 ms 728 KB ans=YES N=1989
22 Correct 9 ms 708 KB ans=YES N=1978
23 Correct 13 ms 628 KB ans=YES N=1867
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 256 KB ans=YES N=1
2 Correct 6 ms 376 KB ans=YES N=4
3 Correct 2 ms 256 KB ans=NO N=4
4 Correct 2 ms 256 KB ans=YES N=5
5 Correct 2 ms 252 KB ans=YES N=9
6 Correct 2 ms 376 KB ans=YES N=5
7 Correct 2 ms 376 KB ans=NO N=9
8 Correct 3 ms 376 KB ans=NO N=10
9 Correct 2 ms 256 KB ans=YES N=10
10 Correct 2 ms 256 KB ans=YES N=10
11 Correct 2 ms 256 KB ans=YES N=10
12 Correct 3 ms 376 KB ans=YES N=9
13 Correct 2 ms 376 KB ans=YES N=9
14 Correct 4 ms 376 KB ans=YES N=8
15 Correct 2 ms 256 KB ans=YES N=8
16 Correct 2 ms 256 KB ans=NO N=2
17 Correct 2 ms 380 KB ans=YES N=17
18 Correct 2 ms 256 KB ans=YES N=25
19 Correct 2 ms 256 KB ans=YES N=100
20 Correct 3 ms 376 KB ans=YES N=185
21 Correct 2 ms 256 KB ans=NO N=174
22 Correct 2 ms 256 KB ans=YES N=90
23 Correct 0 ms 256 KB ans=YES N=63
24 Correct 2 ms 256 KB ans=YES N=87
25 Correct 4 ms 380 KB ans=YES N=183
26 Correct 2 ms 376 KB ans=YES N=188
27 Correct 3 ms 376 KB ans=YES N=183
28 Correct 3 ms 504 KB ans=YES N=189
29 Correct 3 ms 376 KB ans=YES N=200
30 Correct 3 ms 256 KB ans=YES N=190
31 Correct 3 ms 376 KB ans=YES N=187
32 Correct 3 ms 376 KB ans=YES N=187
33 Correct 3 ms 376 KB ans=YES N=182
34 Correct 3 ms 376 KB ans=YES N=184
35 Correct 2 ms 376 KB ans=YES N=188
36 Correct 3 ms 256 KB ans=YES N=181
37 Correct 3 ms 376 KB ans=YES N=188
38 Correct 5 ms 348 KB ans=YES N=191
39 Correct 3 ms 376 KB ans=YES N=196
40 Correct 3 ms 376 KB ans=YES N=196
41 Correct 3 ms 376 KB ans=YES N=196
42 Correct 3 ms 376 KB ans=YES N=196
43 Correct 3 ms 376 KB ans=YES N=195
44 Correct 3 ms 508 KB ans=NO N=1934
45 Correct 3 ms 376 KB ans=NO N=1965
46 Correct 15 ms 732 KB ans=YES N=1824
47 Correct 17 ms 740 KB ans=YES N=1981
48 Correct 15 ms 652 KB ans=YES N=1814
49 Correct 16 ms 632 KB ans=YES N=1854
50 Correct 14 ms 760 KB ans=YES N=1831
51 Correct 9 ms 764 KB ans=YES N=2000
52 Correct 18 ms 704 KB ans=YES N=1847
53 Correct 18 ms 572 KB ans=YES N=1819
54 Correct 18 ms 740 KB ans=YES N=1986
55 Correct 20 ms 632 KB ans=YES N=2000
56 Correct 15 ms 724 KB ans=YES N=1834
57 Correct 8 ms 708 KB ans=YES N=1860
58 Correct 18 ms 632 KB ans=YES N=1898
59 Correct 15 ms 632 KB ans=YES N=1832
60 Correct 14 ms 640 KB ans=YES N=1929
61 Correct 17 ms 708 KB ans=YES N=1919
62 Correct 16 ms 632 KB ans=YES N=1882
63 Correct 13 ms 632 KB ans=YES N=1922
64 Correct 10 ms 740 KB ans=YES N=1989
65 Correct 9 ms 632 KB ans=YES N=1978
66 Correct 3 ms 636 KB ans=YES N=1867
67 Correct 18 ms 732 KB ans=YES N=1942
68 Correct 173 ms 8384 KB ans=NO N=66151
69 Correct 55 ms 4828 KB ans=NO N=64333
70 Correct 994 ms 14800 KB ans=YES N=69316
71 Correct 922 ms 14356 KB ans=YES N=66695
72 Correct 962 ms 14652 KB ans=YES N=68436
73 Correct 983 ms 14968 KB ans=YES N=70000
74 Correct 955 ms 14552 KB ans=YES N=68501
75 Correct 1000 ms 14936 KB ans=YES N=70000
76 Correct 977 ms 13924 KB ans=YES N=65009
77 Correct 1171 ms 13332 KB ans=YES N=67007
78 Correct 1158 ms 12676 KB ans=YES N=66357
79 Correct 1062 ms 12460 KB ans=YES N=65430
80 Correct 1108 ms 12124 KB ans=YES N=65790
81 Correct 1161 ms 12476 KB ans=YES N=66020
82 Correct 1119 ms 12904 KB ans=YES N=65809
83 Correct 1020 ms 13276 KB ans=YES N=65651
84 Correct 1132 ms 12144 KB ans=YES N=68040
85 Correct 1091 ms 11596 KB ans=YES N=66570
86 Correct 955 ms 13884 KB ans=YES N=65421
87 Correct 988 ms 11604 KB ans=YES N=68351
88 Correct 980 ms 14116 KB ans=YES N=67027
89 Correct 542 ms 13292 KB ans=YES N=68879
90 Correct 1048 ms 14684 KB ans=YES N=67256
91 Correct 2530 ms 31196 KB ans=YES N=148315
92 Correct 152 ms 10324 KB ans=NO N=142745
93 Correct 190 ms 10664 KB ans=NO N=148443
94 Correct 2509 ms 31184 KB ans=YES N=148328
95 Correct 2467 ms 31004 KB ans=YES N=147855
96 Correct 2515 ms 31564 KB ans=YES N=150000
97 Correct 2394 ms 30480 KB ans=YES N=144725
98 Correct 2536 ms 31616 KB ans=YES N=149445
99 Correct 2382 ms 30344 KB ans=YES N=144455
100 Correct 2403 ms 30348 KB ans=YES N=143487
101 Correct 2529 ms 31392 KB ans=YES N=149688
102 Correct 2927 ms 27632 KB ans=YES N=141481
103 Correct 2708 ms 29816 KB ans=YES N=147430
104 Correct 2726 ms 28088 KB ans=YES N=142247
105 Correct 3054 ms 29448 KB ans=YES N=149941
106 Correct 2492 ms 28224 KB ans=YES N=141635
107 Correct 3021 ms 26352 KB ans=YES N=142896
108 Correct 2867 ms 25792 KB ans=YES N=142069
109 Correct 2521 ms 29004 KB ans=YES N=142378
110 Correct 2407 ms 23952 KB ans=YES N=150000
111 Correct 2193 ms 24220 KB ans=YES N=141452
112 Correct 1426 ms 22036 KB ans=YES N=134453
113 Correct 1381 ms 27708 KB ans=YES N=144172
# 결과 실행 시간 메모리 Grader output
1 Correct 168 ms 8312 KB ans=NO N=66151
2 Correct 53 ms 4856 KB ans=NO N=64333
3 Correct 999 ms 14932 KB ans=YES N=69316
4 Correct 987 ms 14280 KB ans=YES N=66695
5 Correct 939 ms 14576 KB ans=YES N=68436
6 Correct 968 ms 14936 KB ans=YES N=70000
7 Correct 959 ms 14908 KB ans=YES N=68501
8 Correct 1016 ms 14964 KB ans=YES N=70000
9 Correct 958 ms 13788 KB ans=YES N=65009
10 Correct 1150 ms 13220 KB ans=YES N=67007
11 Correct 1201 ms 12828 KB ans=YES N=66357
12 Correct 1074 ms 12612 KB ans=YES N=65430
13 Correct 1143 ms 12208 KB ans=YES N=65790
14 Correct 1142 ms 12516 KB ans=YES N=66020
15 Correct 1091 ms 13064 KB ans=YES N=65809
16 Correct 1006 ms 13196 KB ans=YES N=65651
17 Correct 1139 ms 12172 KB ans=YES N=68040
18 Correct 1068 ms 11644 KB ans=YES N=66570
19 Correct 926 ms 13876 KB ans=YES N=65421
20 Correct 975 ms 11912 KB ans=YES N=68351
21 Correct 892 ms 14088 KB ans=YES N=67027
22 Correct 513 ms 13096 KB ans=YES N=68879
23 Correct 1038 ms 14556 KB ans=YES N=67256
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 420 KB ans=NO N=1934
2 Correct 3 ms 376 KB ans=NO N=1965
3 Correct 16 ms 732 KB ans=YES N=1824
4 Correct 17 ms 760 KB ans=YES N=1981
5 Correct 16 ms 732 KB ans=YES N=1814
6 Correct 19 ms 732 KB ans=YES N=1854
7 Correct 11 ms 636 KB ans=YES N=1831
8 Correct 17 ms 732 KB ans=YES N=2000
9 Correct 25 ms 612 KB ans=YES N=1847
10 Correct 15 ms 692 KB ans=YES N=1819
11 Correct 20 ms 760 KB ans=YES N=1986
12 Correct 19 ms 732 KB ans=YES N=2000
13 Correct 17 ms 796 KB ans=YES N=1834
14 Correct 17 ms 632 KB ans=YES N=1860
15 Correct 18 ms 732 KB ans=YES N=1898
16 Correct 16 ms 632 KB ans=YES N=1832
17 Correct 14 ms 640 KB ans=YES N=1929
18 Correct 14 ms 732 KB ans=YES N=1919
19 Correct 15 ms 680 KB ans=YES N=1882
20 Correct 3 ms 604 KB ans=YES N=1922
21 Correct 16 ms 728 KB ans=YES N=1989
22 Correct 9 ms 708 KB ans=YES N=1978
23 Correct 13 ms 628 KB ans=YES N=1867
24 Correct 168 ms 8312 KB ans=NO N=66151
25 Correct 53 ms 4856 KB ans=NO N=64333
26 Correct 999 ms 14932 KB ans=YES N=69316
27 Correct 987 ms 14280 KB ans=YES N=66695
28 Correct 939 ms 14576 KB ans=YES N=68436
29 Correct 968 ms 14936 KB ans=YES N=70000
30 Correct 959 ms 14908 KB ans=YES N=68501
31 Correct 1016 ms 14964 KB ans=YES N=70000
32 Correct 958 ms 13788 KB ans=YES N=65009
33 Correct 1150 ms 13220 KB ans=YES N=67007
34 Correct 1201 ms 12828 KB ans=YES N=66357
35 Correct 1074 ms 12612 KB ans=YES N=65430
36 Correct 1143 ms 12208 KB ans=YES N=65790
37 Correct 1142 ms 12516 KB ans=YES N=66020
38 Correct 1091 ms 13064 KB ans=YES N=65809
39 Correct 1006 ms 13196 KB ans=YES N=65651
40 Correct 1139 ms 12172 KB ans=YES N=68040
41 Correct 1068 ms 11644 KB ans=YES N=66570
42 Correct 926 ms 13876 KB ans=YES N=65421
43 Correct 975 ms 11912 KB ans=YES N=68351
44 Correct 892 ms 14088 KB ans=YES N=67027
45 Correct 513 ms 13096 KB ans=YES N=68879
46 Correct 1038 ms 14556 KB ans=YES N=67256
47 Correct 2666 ms 31164 KB ans=YES N=148315
48 Correct 149 ms 10360 KB ans=NO N=142745
49 Correct 194 ms 10852 KB ans=NO N=148443
50 Correct 2472 ms 31192 KB ans=YES N=148328
51 Correct 2427 ms 30856 KB ans=YES N=147855
52 Correct 2593 ms 31808 KB ans=YES N=150000
53 Correct 2456 ms 30552 KB ans=YES N=144725
54 Correct 2470 ms 31672 KB ans=YES N=149445
55 Correct 2505 ms 30500 KB ans=YES N=144455
56 Correct 2445 ms 30312 KB ans=YES N=143487
57 Correct 2540 ms 31552 KB ans=YES N=149688
58 Correct 2894 ms 27296 KB ans=YES N=141481
59 Correct 2719 ms 29728 KB ans=YES N=147430
60 Correct 2740 ms 27992 KB ans=YES N=142247
61 Correct 3032 ms 29296 KB ans=YES N=149941
62 Correct 2461 ms 28180 KB ans=YES N=141635
63 Correct 2966 ms 26480 KB ans=YES N=142896
64 Correct 2866 ms 25948 KB ans=YES N=142069
65 Correct 2621 ms 29028 KB ans=YES N=142378
66 Correct 2302 ms 23996 KB ans=YES N=150000
67 Correct 2094 ms 24224 KB ans=YES N=141452
68 Correct 1435 ms 22036 KB ans=YES N=134453
69 Correct 1323 ms 27676 KB ans=YES N=144172