Submission #876163

# Submission time Handle Problem Language Result Execution time Memory
876163 2023-11-21T10:39:06 Z PagodePaiva Gap (APIO16_gap) C++17
0 / 100
2000 ms 1460 KB
    #include<bits/stdc++.h>
    #define MAXN 100010
     
    using namespace std;
     
    #include "gap.h"
     
    int query(long long a, long long b, long long &x, long long &y){
        MinMax(a, b, &x, &y);
        return 0;
    }
     
    long long res[MAXN];
     
    long long findGap(int T, int n){
        long long l = 0, r = 1e18;

        query(l, r, res[0], res[n-1]);

        long long difmax = res[n-1] - res[0];
        long long resp = difmax/n;

        long long val = res[0];

        while(val <= res[n-1]){
            long long x, y;
            query(val+1, val+resp, x, y);

            if(x == -1){
                l = resp+1; r = res[n-1] - val;

                while(l < r){
                    int mid = (l+r)/2;

                    query(val+1, val+mid, x, y);

                    if(x == -1){
                        l = mid+1;
                    }

                    else{
                        r = y-val-1;
                    }
                }

                // cout << val << ' ' << l << ' ' << r << '\n';
                resp = max(l, r)+1;
                query(val+1, val+resp, x, y);
                val = y+1;
            }

            else{
                val = y+1;
            }
        }

        return resp;
    }
# Verdict Execution time Memory Grader output
1 Runtime error 0 ms 344 KB Execution failed because the return code was nonzero
2 Runtime error 0 ms 344 KB Execution failed because the return code was nonzero
3 Runtime error 0 ms 344 KB Execution failed because the return code was nonzero
4 Runtime error 0 ms 344 KB Execution failed because the return code was nonzero
5 Incorrect 0 ms 344 KB Output isn't correct
6 Runtime error 0 ms 344 KB Execution failed because the return code was nonzero
7 Runtime error 0 ms 344 KB Execution failed because the return code was nonzero
8 Runtime error 0 ms 344 KB Execution failed because the return code was nonzero
9 Runtime error 0 ms 344 KB Execution failed because the return code was nonzero
10 Incorrect 0 ms 344 KB Output isn't correct
11 Runtime error 1 ms 344 KB Execution failed because the return code was nonzero
12 Runtime error 1 ms 344 KB Execution failed because the return code was nonzero
13 Runtime error 0 ms 344 KB Execution failed because the return code was nonzero
14 Runtime error 0 ms 344 KB Execution failed because the return code was nonzero
15 Incorrect 1 ms 344 KB Output isn't correct
16 Runtime error 4 ms 812 KB Execution failed because the return code was nonzero
17 Runtime error 4 ms 756 KB Execution failed because the return code was nonzero
18 Runtime error 4 ms 632 KB Execution failed because the return code was nonzero
19 Runtime error 4 ms 812 KB Execution failed because the return code was nonzero
20 Incorrect 2 ms 628 KB Output isn't correct
21 Runtime error 14 ms 1224 KB Execution failed because the return code was nonzero
22 Runtime error 14 ms 1136 KB Execution failed because the return code was nonzero
23 Runtime error 14 ms 1216 KB Execution failed because the return code was nonzero
24 Execution timed out 3058 ms 1460 KB Time limit exceeded
25 Incorrect 39 ms 1160 KB Output isn't correct
26 Runtime error 14 ms 1216 KB Execution failed because the return code was nonzero
27 Runtime error 14 ms 1216 KB Execution failed because the return code was nonzero
28 Runtime error 14 ms 1224 KB Execution failed because the return code was nonzero
29 Runtime error 14 ms 1216 KB Execution failed because the return code was nonzero
30 Incorrect 11 ms 1188 KB Output isn't correct
31 Runtime error 0 ms 344 KB Execution failed because the return code was nonzero
32 Runtime error 0 ms 344 KB Execution failed because the return code was nonzero
# Verdict Execution time Memory Grader output
1 Runtime error 0 ms 344 KB Execution failed because the return code was nonzero
2 Runtime error 0 ms 344 KB Execution failed because the return code was nonzero
3 Runtime error 0 ms 344 KB Execution failed because the return code was nonzero
4 Runtime error 0 ms 344 KB Execution failed because the return code was nonzero
5 Partially correct 0 ms 344 KB Partially correct
6 Runtime error 0 ms 496 KB Execution failed because the return code was nonzero
7 Runtime error 0 ms 344 KB Execution failed because the return code was nonzero
8 Runtime error 0 ms 344 KB Execution failed because the return code was nonzero
9 Runtime error 0 ms 344 KB Execution failed because the return code was nonzero
10 Incorrect 0 ms 344 KB Output isn't correct
11 Runtime error 0 ms 344 KB Execution failed because the return code was nonzero
12 Runtime error 0 ms 344 KB Execution failed because the return code was nonzero
13 Runtime error 1 ms 344 KB Execution failed because the return code was nonzero
14 Runtime error 0 ms 344 KB Execution failed because the return code was nonzero
15 Partially correct 1 ms 344 KB Partially correct
16 Runtime error 4 ms 648 KB Execution failed because the return code was nonzero
17 Execution timed out 3087 ms 640 KB Time limit exceeded
18 Runtime error 4 ms 644 KB Execution failed because the return code was nonzero
19 Runtime error 4 ms 648 KB Execution failed because the return code was nonzero
20 Incorrect 3 ms 596 KB Output isn't correct
21 Runtime error 15 ms 1224 KB Execution failed because the return code was nonzero
22 Runtime error 14 ms 1220 KB Execution failed because the return code was nonzero
23 Execution timed out 3044 ms 1236 KB Time limit exceeded
24 Execution timed out 3060 ms 1212 KB Time limit exceeded
25 Partially correct 38 ms 1196 KB Partially correct
26 Runtime error 14 ms 1212 KB Execution failed because the return code was nonzero
27 Runtime error 14 ms 1428 KB Execution failed because the return code was nonzero
28 Runtime error 15 ms 1220 KB Execution failed because the return code was nonzero
29 Runtime error 15 ms 1200 KB Execution failed because the return code was nonzero
30 Incorrect 11 ms 1228 KB Output isn't correct
31 Runtime error 0 ms 344 KB Execution failed because the return code was nonzero
32 Runtime error 0 ms 344 KB Execution failed because the return code was nonzero