제출 #1299165

#제출 시각아이디문제언어결과실행 시간메모리
1299165floColors (BOI20_colors)C++20
100 / 100
2 ms404 KiB
#include <bits/stdc++.h> #define task "testing" #define ll long long #define multitest 0 using namespace std; bool ask(ll x) { cout << "? " << x << endl; bool c; cin >> c; return c; } void guess(ll x) { cout << "= " << x << endl; } void flo(int ID) { ll n; cin >> n; int sign = 1; ll l = 1, r = n-1, cur = n, s = n; while (l <= r) { ll mid = (l+r)/2; cur = min(cur, s += sign*mid); sign *= -1, l = mid+1; } l = 1, r = n-1, sign = -1; ll ans = n; bool trash = ask(cur); while (l <= r) { ll mid = (l+r)/2; cur += sign*mid, sign *= -1; bool c = ask(cur); if (c == 1) { r = (ans = mid)-1; } else { l = mid+1; } } guess(ans); } int main() { // ios_base::sync_with_stdio(0); // cin.tie(0); cout.tie(0); if (fopen(task".inp", "r")) { freopen(task".inp", "r", stdin); freopen(task".out", "w", stdout); } int TCS = 1, ID = 1; if (multitest) { cin >> TCS; } while (TCS--) flo(ID++); return 0; }

컴파일 시 표준 에러 (stderr) 메시지

Colors.cpp: In function 'int main()':
Colors.cpp:63:24: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   63 |                 freopen(task".inp", "r", stdin);
      |                 ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
Colors.cpp:64:24: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   64 |                 freopen(task".out", "w", stdout);
      |                 ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
#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...