Submission #347274

#TimeUsernameProblemLanguageResultExecution timeMemory
347274maomao90Carnival (CEOI14_carnival)C++14
0 / 100
5 ms364 KiB
// https://oj.uz/problem/view/CEOI14_carnival #include <bits/stdc++.h> using namespace std; #define REP(i, j, k) for (int i = j; i < k; i++) #define pb push_back int n; int ans[155]; vector<int> used; int main() { scanf("%d", &n); ans[0] = 0; used.pb(0); REP (i, 1, n) { printf("%d", i + 1); REP (j, 0, i + 1) printf(" %d", j + 1); printf("\n"); fflush(stdout); int all; scanf("%d", &all); if (all > used.size()) { used.pb(i); ans[i] = all - 1; } else { int lo = 0, hi = used.size() - 1, mid; while (lo < hi) { mid = hi + lo + 1 >> 1; printf("%d", mid - lo + 1); REP (i, 0, mid) printf(" %d", used[i] + 1); printf(" %d\n", i + 1); fflush(stdout); int cur; scanf("%d", &cur); if (cur == mid - lo) { hi = mid - 1; } else { lo = mid; } } ans[i] = hi; } } printf("0"); REP (i, 0, n) printf(" %d", ans[i] + 1); printf("\n"); return 0; }

Compilation message (stderr)

carnival.cpp: In function 'int main()':
carnival.cpp:23:11: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   23 |   if (all > used.size()) {
      |       ~~~~^~~~~~~~~~~~~
carnival.cpp:29:19: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
   29 |     mid = hi + lo + 1 >> 1;
      |           ~~~~~~~~^~~
carnival.cpp:14:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   14 |  scanf("%d", &n);
      |  ~~~~~^~~~~~~~~~
carnival.cpp:22:17: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   22 |   int all; scanf("%d", &all);
      |            ~~~~~^~~~~~~~~~~~
carnival.cpp:34:19: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   34 |     int cur; scanf("%d", &cur);
      |              ~~~~~^~~~~~~~~~~~
#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...