Submission #963910

# Submission time Handle Problem Language Result Execution time Memory
963910 2024-04-16T02:54:10 Z becaido Mađioničar (COI22_madionicar) C++17
63 / 100
1000 ms 2176 KB
#pragma GCC optimize("O3,unroll-loops")
#pragma GCC target("avx,popcnt,sse4,abm")
#include <bits/stdc++.h>
using namespace std;

#ifdef WAIMAI
#define debug(HEHE...) cout << "[" << #HEHE << "] : ", dout(HEHE)
void dout() {cout << '\n';}
template<typename T, typename...U>
void dout(T t, U...u) {cout << t << (sizeof...(u) ? ", " : ""), dout(u...);}
#else
#define debug(...) 7122
#endif

#define ll long long
#define Waimai ios::sync_with_stdio(false), cin.tie(0)
#define FOR(x,a,b) for (int x = a, I = b; x <= I; x++)
#define pb emplace_back
#define F first
#define S second

const int SIZE = 2e5 + 5;

int n;
int z[SIZE];

int que(int l, int r) {
    if (l & 1) return 1;
    int foo = 114514;
    l /= 2, r /= 2;
    cout << "? " << l << ' ' << r << endl;
    cin >> foo;
    return foo;
}

void solve() {
    cin >> n;
    n = 2 * n + 1;
    for (int i = 1, mid = 0, r = 0; i <= n; i++) {
        if (i <= r) {
            z[i] = min(z[2 * mid - i], r - i);
            if (i + z[i] < r) continue;
            if (i + z[2 * mid - i] > r) continue;
        }
        int len = min(i - 1, n - i);
        for (int j = z[i] + 1; j <= len; j++) {
            if (que(i - j, i + j) == 0) break;
            z[i]++;
        }
        if (i + z[i] > r) {
            mid = i;
            r = i + z[i];
        }
    }
    cout << "! " << *max_element(z + 1, z + n + 1) << '\n';
}

int main() {
    Waimai;
    solve();
}
# Verdict Execution time Memory Grader output
1 Correct 50 ms 1496 KB Output is correct
2 Correct 77 ms 1232 KB Output is correct
3 Correct 68 ms 960 KB Output is correct
4 Correct 67 ms 992 KB Output is correct
5 Correct 74 ms 1140 KB Output is correct
6 Correct 69 ms 952 KB Output is correct
7 Correct 72 ms 712 KB Output is correct
8 Correct 79 ms 996 KB Output is correct
9 Correct 89 ms 964 KB Output is correct
10 Correct 77 ms 1224 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 50 ms 1496 KB Output is correct
2 Correct 77 ms 1232 KB Output is correct
3 Correct 68 ms 960 KB Output is correct
4 Correct 67 ms 992 KB Output is correct
5 Correct 74 ms 1140 KB Output is correct
6 Correct 69 ms 952 KB Output is correct
7 Correct 72 ms 712 KB Output is correct
8 Correct 79 ms 996 KB Output is correct
9 Correct 89 ms 964 KB Output is correct
10 Correct 77 ms 1224 KB Output is correct
11 Correct 500 ms 1460 KB Output is correct
12 Correct 660 ms 1444 KB Output is correct
13 Correct 661 ms 1876 KB Output is correct
14 Correct 585 ms 1368 KB Output is correct
15 Correct 634 ms 1672 KB Output is correct
16 Correct 603 ms 1540 KB Output is correct
17 Correct 644 ms 1276 KB Output is correct
18 Correct 546 ms 1768 KB Output is correct
19 Correct 972 ms 1932 KB Output is correct
20 Correct 600 ms 1680 KB Output is correct
21 Correct 534 ms 1728 KB Output is correct
22 Correct 664 ms 1596 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 704 ms 2096 KB Output is correct
2 Correct 488 ms 1848 KB Output is correct
3 Correct 727 ms 1996 KB Output is correct
4 Correct 991 ms 1560 KB Output is correct
5 Correct 964 ms 1472 KB Output is correct
6 Correct 691 ms 1944 KB Output is correct
7 Correct 991 ms 1336 KB Output is correct
8 Correct 752 ms 2096 KB Output is correct
9 Correct 681 ms 1732 KB Output is correct
10 Correct 735 ms 2172 KB Output is correct
11 Correct 949 ms 2080 KB Output is correct
12 Correct 1000 ms 1336 KB Output is correct
13 Correct 707 ms 2148 KB Output is correct
14 Correct 743 ms 2056 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 50 ms 1496 KB Output is correct
2 Correct 77 ms 1232 KB Output is correct
3 Correct 68 ms 960 KB Output is correct
4 Correct 67 ms 992 KB Output is correct
5 Correct 74 ms 1140 KB Output is correct
6 Correct 69 ms 952 KB Output is correct
7 Correct 72 ms 712 KB Output is correct
8 Correct 79 ms 996 KB Output is correct
9 Correct 89 ms 964 KB Output is correct
10 Correct 77 ms 1224 KB Output is correct
11 Correct 500 ms 1460 KB Output is correct
12 Correct 660 ms 1444 KB Output is correct
13 Correct 661 ms 1876 KB Output is correct
14 Correct 585 ms 1368 KB Output is correct
15 Correct 634 ms 1672 KB Output is correct
16 Correct 603 ms 1540 KB Output is correct
17 Correct 644 ms 1276 KB Output is correct
18 Correct 546 ms 1768 KB Output is correct
19 Correct 972 ms 1932 KB Output is correct
20 Correct 600 ms 1680 KB Output is correct
21 Correct 534 ms 1728 KB Output is correct
22 Correct 664 ms 1596 KB Output is correct
23 Correct 704 ms 2096 KB Output is correct
24 Correct 488 ms 1848 KB Output is correct
25 Correct 727 ms 1996 KB Output is correct
26 Correct 991 ms 1560 KB Output is correct
27 Correct 964 ms 1472 KB Output is correct
28 Correct 691 ms 1944 KB Output is correct
29 Correct 991 ms 1336 KB Output is correct
30 Correct 752 ms 2096 KB Output is correct
31 Correct 681 ms 1732 KB Output is correct
32 Correct 735 ms 2172 KB Output is correct
33 Correct 949 ms 2080 KB Output is correct
34 Correct 1000 ms 1336 KB Output is correct
35 Correct 707 ms 2148 KB Output is correct
36 Correct 743 ms 2056 KB Output is correct
37 Correct 713 ms 2176 KB Output is correct
38 Runtime error 986 ms 2008 KB Execution killed with signal 13
39 Halted 0 ms 0 KB -