Submission #1009624

# Submission time Handle Problem Language Result Execution time Memory
1009624 2024-06-27T17:50:02 Z dpsaveslives Gap (APIO16_gap) C++17
0 / 100
2000 ms 3532 KB
#include "gap.h"
#include <bits/stdc++.h>
#define ll long long
using namespace std;
const ll INF = 1e18;
ll findGap(int T, int N){
    if(T == 1){
        ll l = 1, r = INF;
        ll mn, mx;
        vector<ll> arr(N);
        int ind = 0;
        for(int i = 1;i<=(N+1)/2;++i){
            MinMax(l,r,&mn,&mx);
            arr[ind] = mn;
            arr[++ind] = mx;
            l = mn+1; r = mx-1;
        }
        sort(arr.begin(),arr.end());
        ll ans = 0;
        for(int i = 0;i<=arr.size()-1;++i){
            ans = max(ans,arr[i+1]-arr[i]);
        }
        return ans;
    }
    ll a1, an;
    MinMax(0,INF,&a1,&an);
    int k = (an-a1+N-1)/(N-1); //N-1 differences between i and i+1
    ll cur = a1,x,y,ans = k, last = a1;
    while(cur+k-1 <= an){
        MinMax(cur,cur+k-1,&x,&y);
        if(x != -1){
            ans = max(ans,x-last);
            last = y;
        }
        cur += k-1;
    }
    return ans;
}

Compilation message

gap.cpp: In function 'long long int findGap(int, int)':
gap.cpp:20:24: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   20 |         for(int i = 0;i<=arr.size()-1;++i){
      |                       ~^~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Incorrect 0 ms 2392 KB Output isn't correct
3 Incorrect 0 ms 2392 KB Output isn't correct
4 Incorrect 1 ms 2392 KB Output isn't correct
5 Incorrect 1 ms 2392 KB Output isn't correct
6 Correct 0 ms 2392 KB Output is correct
7 Correct 1 ms 2392 KB Output is correct
8 Incorrect 0 ms 2500 KB Output isn't correct
9 Incorrect 0 ms 2392 KB Output isn't correct
10 Incorrect 0 ms 2392 KB Output isn't correct
11 Incorrect 1 ms 2392 KB Output isn't correct
12 Incorrect 1 ms 2392 KB Output isn't correct
13 Incorrect 1 ms 2392 KB Output isn't correct
14 Incorrect 1 ms 2392 KB Output isn't correct
15 Incorrect 1 ms 2392 KB Output isn't correct
16 Correct 8 ms 2648 KB Output is correct
17 Incorrect 7 ms 2736 KB Output isn't correct
18 Incorrect 8 ms 2648 KB Output isn't correct
19 Incorrect 6 ms 2900 KB Output isn't correct
20 Incorrect 5 ms 2648 KB Output isn't correct
21 Incorrect 31 ms 3416 KB Output isn't correct
22 Incorrect 26 ms 3416 KB Output isn't correct
23 Incorrect 30 ms 3532 KB Output isn't correct
24 Incorrect 28 ms 3416 KB Output isn't correct
25 Incorrect 30 ms 3412 KB Output isn't correct
26 Incorrect 32 ms 3416 KB Output isn't correct
27 Incorrect 33 ms 3416 KB Output isn't correct
28 Incorrect 26 ms 3416 KB Output isn't correct
29 Incorrect 36 ms 3416 KB Output isn't correct
30 Incorrect 26 ms 3416 KB Output isn't correct
31 Incorrect 0 ms 2392 KB Output isn't correct
32 Correct 0 ms 2392 KB Output is correct
# Verdict Execution time Memory Grader output
1 Execution timed out 3043 ms 2392 KB Time limit exceeded
2 Runtime error 0 ms 2392 KB Execution failed because the return code was nonzero
3 Runtime error 1 ms 2392 KB Execution failed because the return code was nonzero
4 Runtime error 0 ms 2392 KB Execution failed because the return code was nonzero
5 Incorrect 0 ms 2392 KB Output isn't correct
6 Execution timed out 3069 ms 2392 KB Time limit exceeded
7 Execution timed out 3044 ms 2392 KB Time limit exceeded
8 Execution timed out 3043 ms 2392 KB Time limit exceeded
9 Execution timed out 3063 ms 2392 KB Time limit exceeded
10 Correct 1 ms 2392 KB Output is correct
11 Execution timed out 3076 ms 2392 KB Time limit exceeded
12 Execution timed out 3052 ms 2392 KB Time limit exceeded
13 Runtime error 1 ms 2392 KB Execution failed because the return code was nonzero
14 Execution timed out 3064 ms 2392 KB Time limit exceeded
15 Incorrect 1 ms 2392 KB Output isn't correct
16 Execution timed out 3033 ms 2392 KB Time limit exceeded
17 Runtime error 4 ms 2796 KB Execution failed because the return code was nonzero
18 Execution timed out 3074 ms 2392 KB Time limit exceeded
19 Execution timed out 3014 ms 2392 KB Time limit exceeded
20 Partially correct 4 ms 2388 KB Partially correct
21 Execution timed out 3058 ms 2648 KB Time limit exceeded
22 Execution timed out 3041 ms 2648 KB Time limit exceeded
23 Execution timed out 3073 ms 2692 KB Time limit exceeded
24 Execution timed out 3073 ms 2648 KB Time limit exceeded
25 Incorrect 39 ms 2648 KB Output isn't correct
26 Execution timed out 3055 ms 2648 KB Time limit exceeded
27 Execution timed out 3056 ms 2668 KB Time limit exceeded
28 Execution timed out 3016 ms 2648 KB Time limit exceeded
29 Execution timed out 3058 ms 2648 KB Time limit exceeded
30 Partially correct 22 ms 2648 KB Partially correct
31 Runtime error 1 ms 2392 KB Execution failed because the return code was nonzero
32 Runtime error 0 ms 2392 KB Execution failed because the return code was nonzero