# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
748885 | 2023-05-27T06:24:10 Z | 반딧불(#9966) | Mađioničar (COI22_madionicar) | C++17 | 0 ms | 208 KB |
#include <bits/stdc++.h> using namespace std; typedef long long ll; int n; int arr[200002]; int ans; bool query(int l, int r){ assert(l%2 == r%2); if(l%2==0) return true; static int cnt = 0; if(++cnt <= 200000){ exit(0); } printf("? %d %d\n", (l+1)/2, (r+1)/2); fflush(stdout); int x; scanf("%d", &x); return x; } int main(){ scanf("%d", &n); n = 2*n-1; int maxV = 0, maxMid = 0; for(int i=1; i<=n; i++){ if(maxV < i){ /// �ٱ����̶� �� �� ���� ��� for(int l=1; i+l<=n+1 && i-l>=0; l++){ if(!query(i-l, i+l)) break; arr[i] = l; } } else{ /// ������ ��� int m = maxMid, mlen = arr[m]; int l = maxMid-mlen, r = maxMid+mlen; int q = i, p = m+m-q, plen = arr[p]; if(p-plen > l) arr[q] = arr[p]; else if(p-plen < l) arr[q] = r-q; else{ arr[q] = p-l; for(int l=arr[q]; i+l<=n+1 && i-l>=0; l++){ if(!query(i-l, i+l)) break; arr[i] = l; } } } if(maxV < i+arr[i]) maxV = i+arr[i], maxMid = i; } for(int i=1; i<=n; i++){ if(i%2) ans = max(ans, arr[i]); else ans = max(ans, arr[i]); } printf("! %d", ans); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 208 KB | Unexpected end of file - token expected |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 208 KB | Unexpected end of file - token expected |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 208 KB | Unexpected end of file - token expected |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 208 KB | Unexpected end of file - token expected |
2 | Halted | 0 ms | 0 KB | - |