Submission #164963

# Submission time Handle Problem Language Result Execution time Memory
164963 2019-11-24T14:03:39 Z kostia244 Carnival (CEOI14_carnival) C++17
100 / 100
13 ms 424 KB
//#pragma GCC optimize("Ofast")
//#pragma GCC target("avx2,tune=native")
//#pragma GCC optimize("unroll-loops")
#pragma GCC optimize("trapv")
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define pb push_back
using namespace std;
using ll = long long;
using ld = long double;
using vi = vector<ll>;
using vvi = vector<vi>;
using pi = pair<ll, ll>;
const ll mod = 7 * 17 * (1 << 23) + 1;
const ll inf = 1e18;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int uniq[200], col[200], c = 1;
bool party(int l, int r) {
	vi p;
	for(; l <= r; l++) {
		if(uniq[l])
			p.pb(l);
	}
	cout << p.size() << " ";
	for(auto i : p) cout << i << " ";
	cout << endl;
	int t;
	cin >> t;
	return t==p.size();
}
int main() { //DINIC ORZ
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	int n;
	cin >> n;
	for(int i = n; i; i--) {
		uniq[i] = 1;
		int pos = i;
		for(int x = 1<<7; x; x>>=1)
			if(pos+x<=n&&party(i, pos+x))pos+=x;
		if(pos!=n) uniq[i] = 0, col[i]=col[pos+1];
		else col[i] = c++;
	}
	cout << "0 ";
	for(int i = 1; i <= n; i++)
		cout << col[i] << " ";
	cout << endl;
}

Compilation message

carnival.cpp: In function 'bool party(int, int)':
carnival.cpp:32:10: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  return t==p.size();
         ~^~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 12 ms 248 KB Output is correct
2 Correct 11 ms 248 KB Output is correct
3 Correct 9 ms 248 KB Output is correct
4 Correct 12 ms 376 KB Output is correct
5 Correct 9 ms 248 KB Output is correct
6 Correct 5 ms 376 KB Output is correct
7 Correct 12 ms 376 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 10 ms 376 KB Output is correct
2 Correct 12 ms 248 KB Output is correct
3 Correct 6 ms 332 KB Output is correct
4 Correct 12 ms 376 KB Output is correct
5 Correct 5 ms 296 KB Output is correct
6 Correct 10 ms 248 KB Output is correct
7 Correct 11 ms 376 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 7 ms 376 KB Output is correct
2 Correct 11 ms 248 KB Output is correct
3 Correct 10 ms 248 KB Output is correct
4 Correct 11 ms 380 KB Output is correct
5 Correct 7 ms 248 KB Output is correct
6 Correct 12 ms 376 KB Output is correct
7 Correct 8 ms 248 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 9 ms 376 KB Output is correct
2 Correct 6 ms 248 KB Output is correct
3 Correct 13 ms 248 KB Output is correct
4 Correct 12 ms 376 KB Output is correct
5 Correct 9 ms 376 KB Output is correct
6 Correct 10 ms 424 KB Output is correct
7 Correct 13 ms 248 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 9 ms 380 KB Output is correct
2 Correct 13 ms 248 KB Output is correct
3 Correct 12 ms 332 KB Output is correct
4 Correct 13 ms 376 KB Output is correct
5 Correct 12 ms 376 KB Output is correct
6 Correct 12 ms 248 KB Output is correct
7 Correct 12 ms 376 KB Output is correct