# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
748886 | 2023-05-27T06:25:21 Z | 반딧불(#9966) | Mađioničar (COI22_madionicar) | C++17 | 1750 ms | 1272 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
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 92 ms | 424 KB | Output is correct |
2 | Correct | 158 ms | 312 KB | Output is correct |
3 | Correct | 145 ms | 344 KB | Output is correct |
4 | Correct | 115 ms | 348 KB | Output is correct |
5 | Correct | 173 ms | 348 KB | Output is correct |
6 | Correct | 101 ms | 364 KB | Output is correct |
7 | Correct | 133 ms | 328 KB | Output is correct |
8 | Correct | 142 ms | 448 KB | Output is correct |
9 | Correct | 149 ms | 336 KB | Output is correct |
10 | Correct | 115 ms | 328 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 92 ms | 424 KB | Output is correct |
2 | Correct | 158 ms | 312 KB | Output is correct |
3 | Correct | 145 ms | 344 KB | Output is correct |
4 | Correct | 115 ms | 348 KB | Output is correct |
5 | Correct | 173 ms | 348 KB | Output is correct |
6 | Correct | 101 ms | 364 KB | Output is correct |
7 | Correct | 133 ms | 328 KB | Output is correct |
8 | Correct | 142 ms | 448 KB | Output is correct |
9 | Correct | 149 ms | 336 KB | Output is correct |
10 | Correct | 115 ms | 328 KB | Output is correct |
11 | Correct | 777 ms | 1152 KB | Output is correct |
12 | Correct | 843 ms | 968 KB | Output is correct |
13 | Correct | 879 ms | 1132 KB | Output is correct |
14 | Correct | 655 ms | 864 KB | Output is correct |
15 | Correct | 1085 ms | 912 KB | Output is correct |
16 | Correct | 1166 ms | 968 KB | Output is correct |
17 | Correct | 732 ms | 944 KB | Output is correct |
18 | Correct | 983 ms | 1164 KB | Output is correct |
19 | Correct | 1518 ms | 1260 KB | Output is correct |
20 | Correct | 851 ms | 900 KB | Output is correct |
21 | Correct | 918 ms | 1052 KB | Output is correct |
22 | Correct | 838 ms | 852 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1119 ms | 1076 KB | Output is correct |
2 | Correct | 702 ms | 1112 KB | Output is correct |
3 | Correct | 1258 ms | 1088 KB | Output is correct |
4 | Correct | 1524 ms | 1152 KB | Output is correct |
5 | Correct | 1750 ms | 1020 KB | Output is correct |
6 | Correct | 1277 ms | 1196 KB | Output is correct |
7 | Correct | 1403 ms | 1052 KB | Output is correct |
8 | Correct | 964 ms | 1164 KB | Output is correct |
9 | Correct | 1108 ms | 1056 KB | Output is correct |
10 | Correct | 981 ms | 1144 KB | Output is correct |
11 | Correct | 1526 ms | 1064 KB | Output is correct |
12 | Correct | 1381 ms | 1256 KB | Output is correct |
13 | Correct | 1235 ms | 1068 KB | Output is correct |
14 | Correct | 1255 ms | 1168 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 92 ms | 424 KB | Output is correct |
2 | Correct | 158 ms | 312 KB | Output is correct |
3 | Correct | 145 ms | 344 KB | Output is correct |
4 | Correct | 115 ms | 348 KB | Output is correct |
5 | Correct | 173 ms | 348 KB | Output is correct |
6 | Correct | 101 ms | 364 KB | Output is correct |
7 | Correct | 133 ms | 328 KB | Output is correct |
8 | Correct | 142 ms | 448 KB | Output is correct |
9 | Correct | 149 ms | 336 KB | Output is correct |
10 | Correct | 115 ms | 328 KB | Output is correct |
11 | Correct | 777 ms | 1152 KB | Output is correct |
12 | Correct | 843 ms | 968 KB | Output is correct |
13 | Correct | 879 ms | 1132 KB | Output is correct |
14 | Correct | 655 ms | 864 KB | Output is correct |
15 | Correct | 1085 ms | 912 KB | Output is correct |
16 | Correct | 1166 ms | 968 KB | Output is correct |
17 | Correct | 732 ms | 944 KB | Output is correct |
18 | Correct | 983 ms | 1164 KB | Output is correct |
19 | Correct | 1518 ms | 1260 KB | Output is correct |
20 | Correct | 851 ms | 900 KB | Output is correct |
21 | Correct | 918 ms | 1052 KB | Output is correct |
22 | Correct | 838 ms | 852 KB | Output is correct |
23 | Correct | 1119 ms | 1076 KB | Output is correct |
24 | Correct | 702 ms | 1112 KB | Output is correct |
25 | Correct | 1258 ms | 1088 KB | Output is correct |
26 | Correct | 1524 ms | 1152 KB | Output is correct |
27 | Correct | 1750 ms | 1020 KB | Output is correct |
28 | Correct | 1277 ms | 1196 KB | Output is correct |
29 | Correct | 1403 ms | 1052 KB | Output is correct |
30 | Correct | 964 ms | 1164 KB | Output is correct |
31 | Correct | 1108 ms | 1056 KB | Output is correct |
32 | Correct | 981 ms | 1144 KB | Output is correct |
33 | Correct | 1526 ms | 1064 KB | Output is correct |
34 | Correct | 1381 ms | 1256 KB | Output is correct |
35 | Correct | 1235 ms | 1068 KB | Output is correct |
36 | Correct | 1255 ms | 1168 KB | Output is correct |
37 | Correct | 1123 ms | 980 KB | Output is correct |
38 | Incorrect | 1632 ms | 1272 KB | Unexpected end of file - token expected |
39 | Halted | 0 ms | 0 KB | - |