Submission #800368

# Submission time Handle Problem Language Result Execution time Memory
800368 2023-08-01T13:48:24 Z PagodePaiva Mađioničar (COI22_madionicar) C++14
100 / 100
1402 ms 336 KB
#include<bits/stdc++.h>

using namespace std;

int main(){
    int n;
    cin >> n;

    int res = 1;
    int l = 1, r = 3;

    while(r <= n){
        cout << "? " << l << " " << r << "\n";
        cout << flush;

        int x;
        cin >> x;

        if(x == 1){
            res = r-l+1;
            if(l == 1) r += 2;
            else{
                l--;
                r++;
            }
        }

        else{
            l++;
            r++;
        }
    }

    l = 1;
    r = res+1;

    while(r <= n){
        cout << "? " << l << " " << r << "\n";
        cout << flush;

        int x;
        cin >> x;

        if(x == 1){
            res = r-l+1;
            if(l == 1) r += 2;
            else{
                l--;
                r++;
            }
        }

        else{
            l++;
            r++;
        }
    }

    cout << "! " << res << "\n";
    cout << flush;

    return 0;    
}
# Verdict Execution time Memory Grader output
1 Correct 124 ms 208 KB Output is correct
2 Correct 131 ms 208 KB Output is correct
3 Correct 100 ms 208 KB Output is correct
4 Correct 127 ms 208 KB Output is correct
5 Correct 79 ms 208 KB Output is correct
6 Correct 92 ms 208 KB Output is correct
7 Correct 70 ms 208 KB Output is correct
8 Correct 47 ms 208 KB Output is correct
9 Correct 77 ms 208 KB Output is correct
10 Correct 50 ms 208 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 124 ms 208 KB Output is correct
2 Correct 131 ms 208 KB Output is correct
3 Correct 100 ms 208 KB Output is correct
4 Correct 127 ms 208 KB Output is correct
5 Correct 79 ms 208 KB Output is correct
6 Correct 92 ms 208 KB Output is correct
7 Correct 70 ms 208 KB Output is correct
8 Correct 47 ms 208 KB Output is correct
9 Correct 77 ms 208 KB Output is correct
10 Correct 50 ms 208 KB Output is correct
11 Correct 1010 ms 208 KB Output is correct
12 Correct 861 ms 208 KB Output is correct
13 Correct 908 ms 208 KB Output is correct
14 Correct 881 ms 208 KB Output is correct
15 Correct 937 ms 208 KB Output is correct
16 Correct 393 ms 208 KB Output is correct
17 Correct 424 ms 208 KB Output is correct
18 Correct 976 ms 256 KB Output is correct
19 Correct 346 ms 208 KB Output is correct
20 Correct 758 ms 208 KB Output is correct
21 Correct 760 ms 208 KB Output is correct
22 Correct 608 ms 208 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1220 ms 208 KB Output is correct
2 Correct 360 ms 208 KB Output is correct
3 Correct 1112 ms 292 KB Output is correct
4 Correct 832 ms 208 KB Output is correct
5 Correct 693 ms 208 KB Output is correct
6 Correct 1234 ms 208 KB Output is correct
7 Correct 686 ms 208 KB Output is correct
8 Correct 1341 ms 208 KB Output is correct
9 Correct 1160 ms 208 KB Output is correct
10 Correct 1397 ms 208 KB Output is correct
11 Correct 627 ms 208 KB Output is correct
12 Correct 694 ms 208 KB Output is correct
13 Correct 1120 ms 208 KB Output is correct
14 Correct 986 ms 208 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 124 ms 208 KB Output is correct
2 Correct 131 ms 208 KB Output is correct
3 Correct 100 ms 208 KB Output is correct
4 Correct 127 ms 208 KB Output is correct
5 Correct 79 ms 208 KB Output is correct
6 Correct 92 ms 208 KB Output is correct
7 Correct 70 ms 208 KB Output is correct
8 Correct 47 ms 208 KB Output is correct
9 Correct 77 ms 208 KB Output is correct
10 Correct 50 ms 208 KB Output is correct
11 Correct 1010 ms 208 KB Output is correct
12 Correct 861 ms 208 KB Output is correct
13 Correct 908 ms 208 KB Output is correct
14 Correct 881 ms 208 KB Output is correct
15 Correct 937 ms 208 KB Output is correct
16 Correct 393 ms 208 KB Output is correct
17 Correct 424 ms 208 KB Output is correct
18 Correct 976 ms 256 KB Output is correct
19 Correct 346 ms 208 KB Output is correct
20 Correct 758 ms 208 KB Output is correct
21 Correct 760 ms 208 KB Output is correct
22 Correct 608 ms 208 KB Output is correct
23 Correct 1220 ms 208 KB Output is correct
24 Correct 360 ms 208 KB Output is correct
25 Correct 1112 ms 292 KB Output is correct
26 Correct 832 ms 208 KB Output is correct
27 Correct 693 ms 208 KB Output is correct
28 Correct 1234 ms 208 KB Output is correct
29 Correct 686 ms 208 KB Output is correct
30 Correct 1341 ms 208 KB Output is correct
31 Correct 1160 ms 208 KB Output is correct
32 Correct 1397 ms 208 KB Output is correct
33 Correct 627 ms 208 KB Output is correct
34 Correct 694 ms 208 KB Output is correct
35 Correct 1120 ms 208 KB Output is correct
36 Correct 986 ms 208 KB Output is correct
37 Correct 1251 ms 208 KB Output is correct
38 Correct 1188 ms 208 KB Output is correct
39 Correct 1111 ms 208 KB Output is correct
40 Correct 1101 ms 208 KB Output is correct
41 Correct 1172 ms 208 KB Output is correct
42 Correct 967 ms 208 KB Output is correct
43 Correct 535 ms 208 KB Output is correct
44 Correct 1402 ms 208 KB Output is correct
45 Correct 594 ms 208 KB Output is correct
46 Correct 1365 ms 208 KB Output is correct
47 Correct 1252 ms 208 KB Output is correct
48 Correct 1244 ms 208 KB Output is correct
49 Correct 696 ms 208 KB Output is correct
50 Correct 608 ms 208 KB Output is correct
51 Correct 1161 ms 336 KB Output is correct
52 Correct 838 ms 208 KB Output is correct