Submission #167532

# Submission time Handle Problem Language Result Execution time Memory
167532 2019-12-08T19:33:14 Z Lightning Carnival (CEOI14_carnival) C++14
100 / 100
17 ms 376 KB
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <set>
#include <map>
#include <iomanip>
#include <stack>
#include <queue>
#include <deque>

using namespace std;

typedef long long ll;
typedef pair <int, int> pii;

#define sz(a) (int)a.size()
#define all(a) a.begin(), a.end()
#define pb push_back
#define ppb pop_back
#define mkp make_pair
#define F first
#define S second
#define show(a) cerr << #a <<" -> "<< a <<"\n"
#define fo(a, b, c, d) for(int (a) = (b); (a) <= (c); (a) += (d))
#define foo(a, b, c ,d) for(int (a) = (b); (a) >= (c); (a) -= (d))
//#define int ll

const int N = 200;
const int INF = 1e9;

int n, ans[N], col;
vector <int> vec;

int get(int l, int r) {
	cout << r - l + 1 <<" ";
	for(int i = l; i <= r; ++i)
		cout << i <<" ";
	cout << endl;
	int cnt; 
	cin >> cnt;
	return cnt;
}

bool check(int pos, int r) {
	cout << r + 2 <<" ";
	cout << pos <<" ";
	for(int i = 0; i <= r; ++i) {
		cout << vec[i] <<" ";
	}
	cout << endl;
	int cnt; cin >> cnt;
	return (r + 2 == cnt);
}

int main () {
	cin >> n;
	int pre = 1;
	ans[1] = ++col;
	vec.pb(1);
	for(int i = 2; i <= n; ++i) {
		int cur = get(1, i);
		if(pre < cur) { // so a[i] is new element
			ans[i] = ++col;
			vec.pb(i);
		} else { // a[i] old element
			int l = 0, r = sz(vec) - 1;
			while(l < r) {
				int mid = (l + r + 1) / 2;
				if(check(i, mid)) l = mid;
				else r = mid - 1; 	
			}
			if(check(i, l)) ++l;
			ans[i] = ans[vec[l]];
		}
		pre = cur;
	} 
	cout << 0 <<" ";
	for(int i = 1; i <= n; ++i) {
		cout << ans[i] <<" ";
	}
	cout << endl;
	return 0;
}
/*
	If you only do what you can do, 
	You will never be more than you are now!
	----------------------------------------
	We must all suffer from one of two pains: the pain of discipline or the pain of regret. 
	The difference is discipline weighs grams while regret weighs tons.
*/
# Verdict Execution time Memory Grader output
1 Correct 13 ms 248 KB Output is correct
2 Correct 8 ms 376 KB Output is correct
3 Correct 9 ms 252 KB Output is correct
4 Correct 17 ms 316 KB Output is correct
5 Correct 7 ms 248 KB Output is correct
6 Correct 7 ms 248 KB Output is correct
7 Correct 7 ms 248 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 11 ms 376 KB Output is correct
2 Correct 14 ms 248 KB Output is correct
3 Correct 5 ms 252 KB Output is correct
4 Correct 6 ms 376 KB Output is correct
5 Correct 9 ms 248 KB Output is correct
6 Correct 10 ms 248 KB Output is correct
7 Correct 7 ms 248 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 ms 248 KB Output is correct
2 Correct 10 ms 248 KB Output is correct
3 Correct 13 ms 376 KB Output is correct
4 Correct 5 ms 376 KB Output is correct
5 Correct 6 ms 376 KB Output is correct
6 Correct 9 ms 252 KB Output is correct
7 Correct 11 ms 252 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 8 ms 248 KB Output is correct
2 Correct 6 ms 376 KB Output is correct
3 Correct 5 ms 248 KB Output is correct
4 Correct 5 ms 248 KB Output is correct
5 Correct 9 ms 248 KB Output is correct
6 Correct 10 ms 248 KB Output is correct
7 Correct 7 ms 248 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 248 KB Output is correct
2 Correct 13 ms 248 KB Output is correct
3 Correct 10 ms 376 KB Output is correct
4 Correct 9 ms 248 KB Output is correct
5 Correct 9 ms 376 KB Output is correct
6 Correct 7 ms 376 KB Output is correct
7 Correct 4 ms 312 KB Output is correct