답안 #575050

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
575050 2022-06-09T14:45:35 Z mdubaisi 사육제 (CEOI14_carnival) C++14
0 / 100
103 ms 292 KB
#include <bits/stdc++.h>
#include <unordered_set>
#define all(v) (v.begin()), (v.end())
#define setall(a, val) memset(a, val, sizeof a)
#define ll long long
const ll MOD = 10007;
const ll N = 5e3 + 1;
const ll M = 2e2 + 1;
using namespace std;

bool vis[M];
int main() {
	ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);

	int n, cnt = 1;
	cin >> n;
	vector<int> ans(n, 0);

	for (int i = 1; i <= n; i++) {
		if (vis[i])
			continue;
		if (!ans[i - 1])
			ans[i - 1] = cnt++;
		for (int j = i + 1; j <= n; j++) {
			if (vis[j])
				continue;

			if (!ans[j - 1]) {
				cout << "2 " << i << ' ' << j << endl;
				int x;
				cin >> x;
				if (x == 1)
					ans[j - 1] = ans[i - 1], vis[j] = 1;
				else
					ans[j - 1] = cnt++;
			}

			for (int k = j + 1; k <= n; k++) {
				if (vis[k])
					continue;

				cout << "3 " << i << ' ' << j << ' ' << k << endl;
				int x;
				cin >> x;
				if (x == 3)
					continue;
				else if (x == 2) {
					if (ans[i - 1] != ans[j - 1]) {
						cout << "2 " << j << ' ' << k << endl;
						int y;
						cin >> y;
						if (y == 1)
							ans[k - 1] = ans[j - 1];
						else
							ans[k - 1] = ans[i - 1];
					}
				}
				else
					ans[k - 1] = ans[i - 1];
				vis[k] = 1;
			}
		}
	}

	cout << "0 ";
	for (int x : ans)
		cout << x << ' ';
	cout << endl;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 7 ms 208 KB Output is correct
2 Partially correct 76 ms 208 KB Partially correct
3 Runtime error 103 ms 292 KB Execution killed with signal 13
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 208 KB Output is correct
2 Partially correct 52 ms 208 KB Partially correct
3 Runtime error 93 ms 208 KB Execution killed with signal 13
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 208 KB Output is correct
2 Correct 5 ms 208 KB Output is correct
3 Runtime error 87 ms 292 KB Execution killed with signal 13
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 208 KB Output is correct
2 Correct 5 ms 208 KB Output is correct
3 Runtime error 93 ms 292 KB Execution killed with signal 13
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 208 KB Output is correct
2 Correct 8 ms 208 KB Output is correct
3 Runtime error 91 ms 208 KB Execution killed with signal 13
4 Halted 0 ms 0 KB -