답안 #1027045

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1027045 2024-07-18T19:17:34 Z VMaksimoski008 Mađioničar (COI22_madionicar) C++17
100 / 100
1230 ms 344 KB
#include <bits/stdc++.h>
using namespace std;
using pii = pair<int, int>;

int query(int l, int r) {
    cout << "? " << l << " " << r << endl;
    int x;
    cin >> x;
    return x;
}

int get1(int p, int d, int n) {
    if(p - d < 1 || p + d > n) return 0;
    return query(p - d, p + d);
}

int get2(int p, int d, int n) {
    if(p - d + 1 < 1 || p + d > n) return 0;
    return query(p - d + 1, p + d);
}

int main() {
    int n, ans1=0, ans2=0;
    cin >> n;

    for(int i=1; i<=n; i++) while(get1(i, ans1+1, n)) ans1++;
    for(int i=1; i+1<=n; i++) while(get2(i, ans2+1, n)) ans2++;

    cout << "! " << max(2 * ans1 + 1, 2 * ans2) << endl; 
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 101 ms 344 KB Output is correct
2 Correct 82 ms 344 KB Output is correct
3 Correct 55 ms 344 KB Output is correct
4 Correct 87 ms 344 KB Output is correct
5 Correct 60 ms 344 KB Output is correct
6 Correct 62 ms 344 KB Output is correct
7 Correct 81 ms 344 KB Output is correct
8 Correct 75 ms 344 KB Output is correct
9 Correct 77 ms 344 KB Output is correct
10 Correct 75 ms 344 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 101 ms 344 KB Output is correct
2 Correct 82 ms 344 KB Output is correct
3 Correct 55 ms 344 KB Output is correct
4 Correct 87 ms 344 KB Output is correct
5 Correct 60 ms 344 KB Output is correct
6 Correct 62 ms 344 KB Output is correct
7 Correct 81 ms 344 KB Output is correct
8 Correct 75 ms 344 KB Output is correct
9 Correct 77 ms 344 KB Output is correct
10 Correct 75 ms 344 KB Output is correct
11 Correct 756 ms 344 KB Output is correct
12 Correct 759 ms 344 KB Output is correct
13 Correct 744 ms 344 KB Output is correct
14 Correct 739 ms 344 KB Output is correct
15 Correct 721 ms 344 KB Output is correct
16 Correct 713 ms 344 KB Output is correct
17 Correct 735 ms 344 KB Output is correct
18 Correct 760 ms 344 KB Output is correct
19 Correct 722 ms 344 KB Output is correct
20 Correct 794 ms 344 KB Output is correct
21 Correct 753 ms 344 KB Output is correct
22 Correct 751 ms 344 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1108 ms 344 KB Output is correct
2 Correct 874 ms 344 KB Output is correct
3 Correct 1184 ms 344 KB Output is correct
4 Correct 1166 ms 344 KB Output is correct
5 Correct 1168 ms 344 KB Output is correct
6 Correct 1193 ms 344 KB Output is correct
7 Correct 1156 ms 344 KB Output is correct
8 Correct 1173 ms 344 KB Output is correct
9 Correct 1197 ms 344 KB Output is correct
10 Correct 1188 ms 340 KB Output is correct
11 Correct 1119 ms 344 KB Output is correct
12 Correct 1125 ms 344 KB Output is correct
13 Correct 1230 ms 344 KB Output is correct
14 Correct 1099 ms 344 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 101 ms 344 KB Output is correct
2 Correct 82 ms 344 KB Output is correct
3 Correct 55 ms 344 KB Output is correct
4 Correct 87 ms 344 KB Output is correct
5 Correct 60 ms 344 KB Output is correct
6 Correct 62 ms 344 KB Output is correct
7 Correct 81 ms 344 KB Output is correct
8 Correct 75 ms 344 KB Output is correct
9 Correct 77 ms 344 KB Output is correct
10 Correct 75 ms 344 KB Output is correct
11 Correct 756 ms 344 KB Output is correct
12 Correct 759 ms 344 KB Output is correct
13 Correct 744 ms 344 KB Output is correct
14 Correct 739 ms 344 KB Output is correct
15 Correct 721 ms 344 KB Output is correct
16 Correct 713 ms 344 KB Output is correct
17 Correct 735 ms 344 KB Output is correct
18 Correct 760 ms 344 KB Output is correct
19 Correct 722 ms 344 KB Output is correct
20 Correct 794 ms 344 KB Output is correct
21 Correct 753 ms 344 KB Output is correct
22 Correct 751 ms 344 KB Output is correct
23 Correct 1108 ms 344 KB Output is correct
24 Correct 874 ms 344 KB Output is correct
25 Correct 1184 ms 344 KB Output is correct
26 Correct 1166 ms 344 KB Output is correct
27 Correct 1168 ms 344 KB Output is correct
28 Correct 1193 ms 344 KB Output is correct
29 Correct 1156 ms 344 KB Output is correct
30 Correct 1173 ms 344 KB Output is correct
31 Correct 1197 ms 344 KB Output is correct
32 Correct 1188 ms 340 KB Output is correct
33 Correct 1119 ms 344 KB Output is correct
34 Correct 1125 ms 344 KB Output is correct
35 Correct 1230 ms 344 KB Output is correct
36 Correct 1099 ms 344 KB Output is correct
37 Correct 1129 ms 344 KB Output is correct
38 Correct 1036 ms 344 KB Output is correct
39 Correct 1094 ms 344 KB Output is correct
40 Correct 1041 ms 344 KB Output is correct
41 Correct 1163 ms 344 KB Output is correct
42 Correct 1135 ms 344 KB Output is correct
43 Correct 1092 ms 344 KB Output is correct
44 Correct 1217 ms 344 KB Output is correct
45 Correct 1194 ms 344 KB Output is correct
46 Correct 1100 ms 344 KB Output is correct
47 Correct 1151 ms 344 KB Output is correct
48 Correct 1030 ms 344 KB Output is correct
49 Correct 1063 ms 344 KB Output is correct
50 Correct 1061 ms 344 KB Output is correct
51 Correct 993 ms 344 KB Output is correct
52 Correct 1112 ms 344 KB Output is correct