Submission #331681

#TimeUsernameProblemLanguageResultExecution timeMemory
331681VictorColors (BOI20_colors)C++17
0 / 100
1 ms384 KiB
#include <bits/stdc++.h> using namespace std; #define ii pair<int, int> #define iii pair<int, ii> #define vi vector<int> #define vii vector<ii> #define ll long long #define INF 1000000000 int main() { ll low = 1, high, curr, next, n; int response; scanf("%lld", &n); high = n; curr = (n + 3) / 4; printf("? %lld\n", curr); fflush(NULL); scanf("%d", &response); while (low != high) { next = curr + (low + high) / 2; if (next > n) next = curr - (low + high) / 2; printf("? %lld\n", next); fflush(NULL); scanf("%d", &response); if (response) high = abs(next - curr); else low = abs(next - curr) + 1; curr = next; } printf("%lld\n", high); return 0; }

Compilation message (stderr)

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