Submission #25732

#TimeUsernameProblemLanguageResultExecution timeMemory
25732gs14004Carnival (CEOI14_carnival)C++11
100 / 100
39 ms2024 KiB
#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 (stderr)

carnival.cpp: In function 'int party(std::set<int>)':
carnival.cpp:5:28: 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:21: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d",&ret);
                     ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...