답안 #83551

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
83551 2018-11-09T06:41:56 Z faceless 사육제 (CEOI14_carnival) C++14
100 / 100
17 ms 656 KB
#include <bits/stdc++.h>
#define MP make_pair
#define F first
#define PB push_back
#define S second
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
const int mod = (int)1e9 + 7;
const int maxn = 1e5 + 4;
const ll inf = 1e18;
int col = 1, c[maxn];
vector <int> v;

int print (int lo, int hi, bool wh) {
	cout << hi - lo + wh << " ";
	if (wh)
		cout << v[0] << " ";	
	for (int i = lo; i < hi; i++)
		cout << v[i] << " ";
	cout << endl;
	int k;
	cin >> k;
	return k;
}

void find_same (int lo, int hi) {
	if (print (lo, hi, 1) > print (lo, hi, 0))
		return;
	if (lo + 1 == hi) {
		c[v[lo]] = col;
		return;
	}
	int mid = (hi + lo) >> 1;
	find_same (lo, mid);
	find_same (mid, hi);
}

int main (){
	ios_base::sync_with_stdio(false);
	int n;
	cin >> n;
	for (int i = 1; i <= n; i++)
		v.PB (i);
	while (!v.empty()) {
		if (v.size() == 1) {
			c[v.back()] = col;
			break;
		}
		find_same (1, v.size());
		c[v[0]] = col;
		for (int i = v.size() - 1; i >= 0; i--)
			if (c[v[i]] == col)
				v.erase (v.begin() + i);
		col ++;
	}
	cout << 0 << " ";
	for (int i = 1; i <= n; i++)
		cout << c[i] << " ";
	cout << endl;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 15 ms 376 KB Output is correct
2 Correct 17 ms 456 KB Output is correct
3 Correct 11 ms 508 KB Output is correct
4 Correct 7 ms 508 KB Output is correct
5 Correct 8 ms 508 KB Output is correct
6 Correct 7 ms 508 KB Output is correct
7 Correct 16 ms 508 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 16 ms 508 KB Output is correct
2 Correct 17 ms 508 KB Output is correct
3 Correct 11 ms 656 KB Output is correct
4 Correct 6 ms 656 KB Output is correct
5 Correct 8 ms 656 KB Output is correct
6 Correct 7 ms 656 KB Output is correct
7 Correct 13 ms 656 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 656 KB Output is correct
2 Correct 12 ms 656 KB Output is correct
3 Correct 17 ms 656 KB Output is correct
4 Correct 8 ms 656 KB Output is correct
5 Correct 9 ms 656 KB Output is correct
6 Correct 5 ms 656 KB Output is correct
7 Correct 17 ms 656 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 12 ms 656 KB Output is correct
2 Correct 13 ms 656 KB Output is correct
3 Correct 13 ms 656 KB Output is correct
4 Correct 7 ms 656 KB Output is correct
5 Correct 13 ms 656 KB Output is correct
6 Correct 6 ms 656 KB Output is correct
7 Correct 10 ms 656 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 8 ms 656 KB Output is correct
2 Correct 16 ms 656 KB Output is correct
3 Correct 10 ms 656 KB Output is correct
4 Correct 17 ms 656 KB Output is correct
5 Correct 11 ms 656 KB Output is correct
6 Correct 7 ms 656 KB Output is correct
7 Correct 7 ms 656 KB Output is correct