Submission #68287

#TimeUsernameProblemLanguageResultExecution timeMemory
68287polyfishCarnival (CEOI14_carnival)C++14
0 / 100
28 ms548 KiB
//I love armpit fetish #include <bits/stdc++.h> using namespace std; #define debug(x) cerr << #x << " = " << x << '\n'; #define BP() cerr << "OK!\n"; #define PR(A, n) {cerr << #A << " = "; for (int _=1; _<=n; ++_) cerr << A[_] << ' '; cerr << '\n';} #define PR0(A, n) {cerr << #A << " = "; for (int _=0; _<n; ++_) cerr << A[_] << ' '; cerr << '\n';} #define FILE_NAME "data" const int MAX_N = 152; int n, nColor, c[MAX_N]; int ask(int u, int l, int r) { printf("%d\n", r-l+2); fflush(stdout); printf("%d ", u); fflush(stdout); fflush(stdout); for (int i=l; i<=r; ++i) { printf("%d ", i); fflush(stdout); } printf("\n"); fflush(stdout); int res; cin >> res; return res; } void solve(int u) { int l = u+1, r = n; while (l<r) { int mid = (l + r) / 2; if (ask(u, l, mid)<mid-l+2) r = mid; else l = mid + 1; } if (ask(u, r, r)==1) c[u] = -r; else c[u] = ++nColor; } void find_result() { c[n] = ++nColor; for (int i=n; i>=1; --i) if (c[i]<0) c[i] = c[-c[i]]; printf("0\n"); fflush(stdout); for (int i=1; i<=n; ++i) { printf("%d ", c[i]); fflush(stdout); } fflush(stdout); } int main() { //#define OFFLINE_JUDGE doraemon #ifdef OFFLINE_JUDGE freopen(FILE_NAME".inp", "r", stdin); freopen(FILE_NAME".out", "w", stdout); #endif //ios::sync_with_stdio(0); cin.tie(0); scanf("%d", &n); for (int i=1; i<n; ++i) solve(i); find_result(); }

Compilation message (stderr)

carnival.cpp: In function 'int main()':
carnival.cpp:69:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d", &n);
     ~~~~~^~~~~~~~~~
#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...