Submission #864683

#TimeUsernameProblemLanguageResultExecution timeMemory
864683Trisanu_DasMađioničar (COI22_madionicar)C++17
100 / 100
1217 ms600 KiB
#include <bits/stdc++.h> using namespace std; int query(int i, int j) { int x; printf("? %d %d\n", i + 1, j + 1), fflush(stdout); scanf("%d", &x); return x; } int main() { int n, t, i, l, l_; scanf("%d", &n); l_ = 0; for (t = 0; t <= 1; t++) { for (i = 0, l = t; i < n; i++) while (i > 0 && i + l < n && query(i - 1, i + l)) i--, l += 2; l_ = max(l_, l); } printf("! %d\n", l_), fflush(stdout); }

Compilation message (stderr)

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