Submission #625883

#TimeUsernameProblemLanguageResultExecution timeMemory
625883as111Carnival (CEOI14_carnival)C++14
Compilation error
0 ms0 KiB
#include <iostream> #include <vector> using namespace std; vector<int> pos; int num[155], col[155], C; int main() { int N; cin >> N; for (int i=1;i<N;i++){ cout << N-i+1; for (int j=i;j<=N;j++) cout << " " << j; cout << endl; cin >> (cost[i]); } num[N] = 1; for (int i=1;i<=N;i++) if (num[i] != num[i+1]){ col[i] = ++C; pos.push_back(i); } for (int i=1;i<=N;i++) if (!col[i]){ while (pos[0] < i) pos.erase(pos.begin()); int l = 0, r = pos.size(), a = pos.size(); while (l + 1 < r){ int m = (l + r) / 2; int s = pos.size() - m + 1; printf ("%d",s); for (int i=m;i<pos.size();i++) printf (" %d",pos[i]); printf (" %d\n",i); fflush(stdout); int c; scanf ("%d",&c); if (c == s) r = m; else l = m; } col[i] = col[pos[l]]; } printf ("0"); for (int i=1;i<=N;i++) printf (" %d",col[i]); puts(""); fflush(stdout); return 0; }

Compilation message (stderr)

carnival.cpp: In function 'int main()':
carnival.cpp:15:15: error: 'cost' was not declared in this scope
   15 |       cin >> (cost[i]);
      |               ^~~~
carnival.cpp:31:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   31 |    for (int i=m;i<pos.size();i++) printf (" %d",pos[i]);
      |                 ~^~~~~~~~~~~
carnival.cpp:26:30: warning: unused variable 'a' [-Wunused-variable]
   26 |   int l = 0, r = pos.size(), a = pos.size();
      |                              ^
carnival.cpp:42:2: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
   42 |  for (int i=1;i<=N;i++) printf (" %d",col[i]); puts(""); fflush(stdout);
      |  ^~~
carnival.cpp:42:48: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
   42 |  for (int i=1;i<=N;i++) printf (" %d",col[i]); puts(""); fflush(stdout);
      |                                                ^~~~
carnival.cpp:34:17: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   34 |    int c; scanf ("%d",&c);
      |           ~~~~~~^~~~~~~~~