제출 #1019671

#제출 시각아이디문제언어결과실행 시간메모리
1019671thangdz2k7Mađioničar (COI22_madionicar)C++17
0 / 100
0 ms344 KiB
#include <bits/stdc++.h> using namespace std; bool ask(int l, int r){ cout << "? " << l << ' ' << r; cout << flush; int t; cin >> t; return t; } void answer(int L){ cout << "! " << L; cout << flush; } void solve(){ int n; cin >> n; int ans = 1; for (int i = 1; i <= n; ++ i){ while (i - ans >= 1 && i + ans <= n && ask(i - ans, i + ans)) ++ ans; } int res = 2 * ans - 1; for (int i = 1; i <= n; ++ i){ while (i - ans >= 1 && i + ans + 1 <= n && ask(i - ans, i + ans + 1)) ++ ans, res = max(res, 2 * ans - 2); } answer(res); } int main(){ ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); solve(); return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...