Submission #25976

# Submission time Handle Problem Language Result Execution time Memory
25976 2017-06-25T09:17:59 Z 구재현(#1094) Carnival (CEOI14_carnival) C++14
100 / 100
26 ms 2024 KB
#include <bits/stdc++.h>
using namespace std;
 
int party(set<int> s){
	printf("%d\n", s.size());
	fflush(stdout);
	for(auto &i : s) printf("%d ", i);
	fflush(stdout);
	int ret;
	scanf("%d",&ret);
	return ret;
}
 
void findClothes(int N, vector<int> &C)
{
	int size[151] = {};
	int piv = 0;
	set<int> s;
	for(int i=1; i<=N; i++){
		s.insert(i);
		size[i] = party(s);
		if(size[i] == size[i-1]){
			int s = 1, e = i-1;
			while (s != e) {
				int m = (s+e)/2;
				set<int> original;
				for (int i=s; i<=m; i++) {
					original.insert(i);
				}
				int v = party(original);
				original.insert(i);
				if(v != party(original)) s = m+1;
				else e = m;
			}
			C.push_back(C[e-1]);
		}
		else{
			C.push_back(++piv);
		}
	}
}
 
int main(){
	int n; cin >> n;
	vector<int> v;
	findClothes(n, v);
	printf("0\n");
	for(auto &i : v) printf("%d ", i);
}

Compilation message

carnival.cpp: In function 'int party(std::set<int>)':
carnival.cpp:5:25: warning: format '%d' expects argument of type 'int', but argument 2 has type 'std::set<int>::size_type {aka long unsigned int}' [-Wformat=]
  printf("%d\n", s.size());
                         ^
carnival.cpp:10:18: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d",&ret);
                  ^
# Verdict Execution time Memory Grader output
1 Correct 13 ms 2024 KB Output is correct
2 Correct 16 ms 2024 KB Output is correct
3 Correct 6 ms 2024 KB Output is correct
4 Correct 6 ms 2024 KB Output is correct
5 Correct 9 ms 2024 KB Output is correct
6 Correct 19 ms 2024 KB Output is correct
7 Correct 6 ms 2024 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 6 ms 2024 KB Output is correct
2 Correct 9 ms 2024 KB Output is correct
3 Correct 13 ms 2024 KB Output is correct
4 Correct 3 ms 2024 KB Output is correct
5 Correct 16 ms 2024 KB Output is correct
6 Correct 26 ms 2024 KB Output is correct
7 Correct 13 ms 2024 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 6 ms 2024 KB Output is correct
2 Correct 13 ms 2024 KB Output is correct
3 Correct 23 ms 2024 KB Output is correct
4 Correct 6 ms 2024 KB Output is correct
5 Correct 19 ms 2024 KB Output is correct
6 Correct 9 ms 2024 KB Output is correct
7 Correct 13 ms 2024 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 13 ms 2024 KB Output is correct
2 Correct 19 ms 2024 KB Output is correct
3 Correct 6 ms 2024 KB Output is correct
4 Correct 0 ms 2024 KB Output is correct
5 Correct 13 ms 2024 KB Output is correct
6 Correct 3 ms 2024 KB Output is correct
7 Correct 9 ms 2024 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 6 ms 2024 KB Output is correct
2 Correct 13 ms 2024 KB Output is correct
3 Correct 9 ms 2024 KB Output is correct
4 Correct 3 ms 2024 KB Output is correct
5 Correct 6 ms 2024 KB Output is correct
6 Correct 6 ms 2024 KB Output is correct
7 Correct 9 ms 2024 KB Output is correct