답안 #100929

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
100929 2019-03-15T09:45:18 Z E869120 사육제 (CEOI14_carnival) C++14
20 / 100
99 ms 2988 KB
#include <iostream>
#include <vector>
using namespace std;

vector<int>X[100009]; int n, col[1009], cnts;

void dfs(int pos) {
	if (col[pos] >= 1) return;
	col[pos] = cnts;
	for (int i = 0; i < X[pos].size(); i++) dfs(X[pos][i]);
}

int main() {
	cin >> n;
	for (int i = 1; i <= n; i++) {
		for (int j = i + 1; j <= n; j++) {
			cout << "2 " << i << " " << j << endl;
			int p; cin >> p;
			if (p == 1) { X[i].push_back(j); X[j].push_back(i); }
		}
	}
	for (int i = 1; i <= n; i++) {
		if (col[i] >= 1) continue;
		cnts++; dfs(i);
	}
	cout << "0";
	for (int i = 1; i <= n; i++) cout << " " << col[i]; cout << endl;
	return 0;
}

Compilation message

carnival.cpp: In function 'void dfs(int)':
carnival.cpp:10:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for (int i = 0; i < X[pos].size(); i++) dfs(X[pos][i]);
                  ~~^~~~~~~~~~~~~~~
carnival.cpp: In function 'int main()':
carnival.cpp:27:2: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
  for (int i = 1; i <= n; i++) cout << " " << col[i]; cout << endl;
  ^~~
carnival.cpp:27:54: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
  for (int i = 1; i <= n; i++) cout << " " << col[i]; cout << endl;
                                                      ^~~~
# 결과 실행 시간 메모리 Grader output
1 Partially correct 64 ms 2900 KB Partially correct
2 Partially correct 71 ms 2668 KB Partially correct
3 Partially correct 70 ms 2664 KB Partially correct
4 Partially correct 74 ms 2560 KB Partially correct
5 Partially correct 51 ms 2988 KB Partially correct
6 Partially correct 39 ms 2880 KB Partially correct
7 Partially correct 79 ms 2688 KB Partially correct
# 결과 실행 시간 메모리 Grader output
1 Partially correct 81 ms 2736 KB Partially correct
2 Partially correct 82 ms 2728 KB Partially correct
3 Partially correct 56 ms 2668 KB Partially correct
4 Partially correct 58 ms 2560 KB Partially correct
5 Partially correct 43 ms 2676 KB Partially correct
6 Partially correct 59 ms 2836 KB Partially correct
7 Partially correct 87 ms 2688 KB Partially correct
# 결과 실행 시간 메모리 Grader output
1 Partially correct 64 ms 2728 KB Partially correct
2 Partially correct 46 ms 2728 KB Partially correct
3 Partially correct 83 ms 2668 KB Partially correct
4 Partially correct 71 ms 2560 KB Partially correct
5 Partially correct 91 ms 2680 KB Partially correct
6 Partially correct 52 ms 2728 KB Partially correct
7 Partially correct 86 ms 2688 KB Partially correct
# 결과 실행 시간 메모리 Grader output
1 Partially correct 98 ms 2816 KB Partially correct
2 Partially correct 75 ms 2760 KB Partially correct
3 Partially correct 49 ms 2688 KB Partially correct
4 Partially correct 77 ms 2560 KB Partially correct
5 Partially correct 67 ms 2808 KB Partially correct
6 Partially correct 67 ms 2808 KB Partially correct
7 Partially correct 88 ms 2560 KB Partially correct
# 결과 실행 시간 메모리 Grader output
1 Partially correct 97 ms 2816 KB Partially correct
2 Partially correct 92 ms 2736 KB Partially correct
3 Partially correct 99 ms 2752 KB Partially correct
4 Partially correct 81 ms 2728 KB Partially correct
5 Partially correct 43 ms 2676 KB Partially correct
6 Partially correct 87 ms 2736 KB Partially correct
7 Partially correct 84 ms 2560 KB Partially correct