Submission #810533

#TimeUsernameProblemLanguageResultExecution timeMemory
810533ymmColors (BOI20_colors)C++17
9 / 100
1 ms336 KiB
#include <bits/stdc++.h> typedef long long ll; using namespace std; set<ll> S; ll n; bool query(ll x) { assert(0 <= x && x < n && !S.count(x)); S.insert(x); int d; printf("? %lld\n", x+1); fflush(stdout); scanf("%d", &d); return d; } int main() { scanf("%lld", &n); query(0); ll ans = 1; ll pos = 0; for (int i = 0; i < n-1; ++i) { ll pos2 = i%2? n-pos: n-1-pos; if (!query(pos2)) { ans = abs(pos-pos2)+1; break; } pos = pos2; } printf("= %lld\n", ans); }

Compilation message (stderr)

Colors.cpp: In function 'bool query(ll)':
Colors.cpp:14:7: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   14 |  scanf("%d", &d);
      |  ~~~~~^~~~~~~~~~
Colors.cpp: In function 'int main()':
Colors.cpp:20:7: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   20 |  scanf("%lld", &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...