Submission #854210

#TimeUsernameProblemLanguageResultExecution timeMemory
854210Trisanu_DasColors (BOI20_colors)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; #define int long long bool query(int i) { cout << "? " << i << '\n'; cin >> i; return i; } int main() { int N; cin >> N; int i = 0, c = 0, l = 1, r = N, d = -1; for(; l < r; d = -d) { l = (l + r - 1) >> 1; i = max(i, int(1) - (c += d * l++)); } query(i); l = 1, r = N, d = -1; for(; l < r; d = -d) { ll m = (l + r - 1) >> 1; if(query(i += d * m)) r = m; else l = m + 1; } cout << "= " << l << '\n'; }

Compilation message (stderr)

cc1plus: error: '::main' must return 'int'
Colors.cpp: In function 'int main()':
Colors.cpp:3:13: error: expected primary-expression before 'long'
    3 | #define int long long
      |             ^~~~
Colors.cpp:16:14: note: in expansion of macro 'int'
   16 |   i = max(i, int(1) - (c += d * l++));
      |              ^~~
Colors.cpp:21:3: error: 'll' was not declared in this scope; did you mean 'l'?
   21 |   ll m = (l + r - 1) >> 1;
      |   ^~
      |   l
Colors.cpp:22:21: error: 'm' was not declared in this scope
   22 |   if(query(i += d * m)) r = m;
      |                     ^
Colors.cpp:13:13: warning: unused variable 'c' [-Wunused-variable]
   13 |  int i = 0, c = 0, l = 1, r = N, d = -1;
      |             ^