Submission #167507

# Submission time Handle Problem Language Result Execution time Memory
167507 2019-12-08T18:02:47 Z Lightning Carnival (CEOI14_carnival) C++14
0 / 100
16 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;

bool check(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 == r - l + 1);
}

int main () {
	cin >> n;
	int pre = 1;
	ans[1] = ++col;
	for(int i = 2; i <= n; ++i) {
		// query
		cout << i <<" "; 
		for(int j = 1; j <= i; ++j) 
			cout << j <<" "; 
		cout << endl;
		// answer of query -> cur
		int cur; 
		cin >> cur;
		// pre < cur so a[i] is new element
		if(pre < cur) {
			ans[i] = ++col;
		} else { // else old
			int l = 1, r = i;
			while(l < r) {
				int mid = (l + r) / 2;
				if(check(mid, i)) r = mid;
				else l = mid + 1; 	
			}
			ans[i] = ans[r - 1];
		}
		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 Incorrect 15 ms 376 KB Incorrect
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 8 ms 376 KB Incorrect
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 14 ms 248 KB Output is correct
2 Incorrect 14 ms 248 KB Incorrect
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 14 ms 376 KB Incorrect
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 16 ms 248 KB Incorrect
2 Halted 0 ms 0 KB -