Submission #852219

# Submission time Handle Problem Language Result Execution time Memory
852219 2023-09-21T12:52:11 Z 8pete8 Gap (APIO16_gap) C++17
30 / 100
2000 ms 2152 KB
#include<iostream>
#include<stack>
#include<map>
#include<vector>
#include<string>
#include<unordered_map>
#include <queue>
#include<cstring>
#include<limits.h>
#include<cmath>
#include<set>
#include<algorithm>
#include<bitset>
#include "gap.h"
using namespace std;
#define ll long long
#define f first
#define endl "\n"
//#define s second
#define pii pair<int,int>
#define ppii pair<int,pii>
#define pb push_back
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define F(n) for(int i=0;i<n;i++)
#define lb lower_bound
#define fastio ios::sync_with_stdio(false);cin.tie(NULL);
using namespace std;
#define ll long long
const int mxn=1e5,mod=1000000007,lg=20,root=1000,inf=1e18;
ll v[mxn+10];
ll findGap(int T,int N){
    ll mn,mx;
    ll ans=1;
    ll lmn=1,lmx=1e18;
    if(T==1){
        ll j=0;
        for(ll i=0;i<(N+1)/2;i++){
            MinMax(lmn,lmx,&mn,&mx);
            if(mn==-1)break;
            v[j++]=mn;
            v[j++]=mx;
            lmn=mn+1;
            lmx=mx-1;
        }
        sort(v,v+N);       
        for(int i=1;i<N;i++)ans=max(ans,v[i]-v[i-1]);
        return ans;
    }
    MinMax(1,1e18,&mn,&mx);
    ans=ceil((((mx-mn)+(N-1))*1.0)/(N-1));//min max gap
    ll add=0,cur=mn,l,r;
    while(cur<mx){
        MinMax(cur+1,cur+ans,&l,&r);
        if(l!=-1)ans=max(ans,l-cur),cur=r;
    }
    return ans;
}

Compilation message

gap.cpp:30:54: warning: overflow in conversion from 'double' to 'int' changes value from '1.0e+18' to '2147483647' [-Woverflow]
   30 | const int mxn=1e5,mod=1000000007,lg=20,root=1000,inf=1e18;
      |                                                      ^~~~
gap.cpp: In function 'long long int findGap(int, int)':
gap.cpp:52:8: warning: unused variable 'add' [-Wunused-variable]
   52 |     ll add=0,cur=mn,l,r;
      |        ^~~
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Correct 1 ms 504 KB Output is correct
5 Correct 0 ms 344 KB Output is correct
6 Correct 1 ms 344 KB Output is correct
7 Correct 0 ms 344 KB Output is correct
8 Correct 0 ms 344 KB Output is correct
9 Correct 0 ms 344 KB Output is correct
10 Correct 1 ms 344 KB Output is correct
11 Correct 1 ms 344 KB Output is correct
12 Correct 1 ms 344 KB Output is correct
13 Correct 1 ms 344 KB Output is correct
14 Correct 1 ms 596 KB Output is correct
15 Correct 1 ms 344 KB Output is correct
16 Correct 8 ms 812 KB Output is correct
17 Correct 8 ms 648 KB Output is correct
18 Correct 8 ms 648 KB Output is correct
19 Correct 8 ms 600 KB Output is correct
20 Correct 8 ms 1056 KB Output is correct
21 Correct 33 ms 1828 KB Output is correct
22 Correct 31 ms 1984 KB Output is correct
23 Correct 36 ms 1856 KB Output is correct
24 Correct 32 ms 2004 KB Output is correct
25 Correct 28 ms 1868 KB Output is correct
26 Correct 31 ms 1900 KB Output is correct
27 Correct 31 ms 2152 KB Output is correct
28 Correct 31 ms 1944 KB Output is correct
29 Correct 34 ms 1916 KB Output is correct
30 Correct 26 ms 1956 KB Output is correct
31 Correct 0 ms 344 KB Output is correct
32 Correct 0 ms 344 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB Output isn't correct
2 Execution timed out 3057 ms 344 KB Time limit exceeded
3 Execution timed out 3057 ms 344 KB Time limit exceeded
4 Execution timed out 3063 ms 344 KB Time limit exceeded
5 Incorrect 0 ms 344 KB Output isn't correct
6 Execution timed out 3089 ms 344 KB Time limit exceeded
7 Execution timed out 3056 ms 344 KB Time limit exceeded
8 Execution timed out 3064 ms 344 KB Time limit exceeded
9 Execution timed out 3084 ms 344 KB Time limit exceeded
10 Execution timed out 3045 ms 344 KB Time limit exceeded
11 Execution timed out 3031 ms 344 KB Time limit exceeded
12 Execution timed out 3016 ms 344 KB Time limit exceeded
13 Execution timed out 3009 ms 344 KB Time limit exceeded
14 Execution timed out 3065 ms 344 KB Time limit exceeded
15 Incorrect 1 ms 344 KB Output isn't correct
16 Execution timed out 3071 ms 808 KB Time limit exceeded
17 Execution timed out 3068 ms 648 KB Time limit exceeded
18 Execution timed out 3065 ms 636 KB Time limit exceeded
19 Execution timed out 3016 ms 648 KB Time limit exceeded
20 Execution timed out 3050 ms 620 KB Time limit exceeded
21 Execution timed out 3008 ms 1220 KB Time limit exceeded
22 Execution timed out 3046 ms 1216 KB Time limit exceeded
23 Execution timed out 3035 ms 1232 KB Time limit exceeded
24 Execution timed out 3044 ms 1460 KB Time limit exceeded
25 Incorrect 37 ms 1192 KB Output isn't correct
26 Execution timed out 3047 ms 1212 KB Time limit exceeded
27 Execution timed out 3088 ms 1220 KB Time limit exceeded
28 Execution timed out 3041 ms 1112 KB Time limit exceeded
29 Execution timed out 3022 ms 1028 KB Time limit exceeded
30 Execution timed out 3007 ms 1232 KB Time limit exceeded
31 Execution timed out 3034 ms 344 KB Time limit exceeded
32 Execution timed out 3030 ms 344 KB Time limit exceeded