Submission #876450

#TimeUsernameProblemLanguageResultExecution timeMemory
876450AlphaMale06Gap (APIO16_gap)C++14
0 / 100
28 ms3808 KiB
#include<bits/stdc++.h>
#include "gap.h"
using namespace std;
using ll=long long;

long long findGap(int subt, int n){
    if(subt==1){
        ll mn=0;
        ll mx=1e18;
        ll a[n];
        for(int i=0; i< n/2; i++){
            MinMax(mn, mx, &mn, &mx);
            a[i]=mn;
            a[n-i-1]=mx;
            mn++;
            mx--;
        }
        if(n&1)a[n/2]=mn;
        ll ans=0;
        for(int i=1; i<n; i++){
            ans=max(ans, a[i]-a[i-1]);
        }
        return ans;
    }
    else{

    }
}

Compilation message (stderr)

gap.cpp: In function 'long long int findGap(int, int)':
gap.cpp:28:1: warning: control reaches end of non-void function [-Wreturn-type]
   28 | }
      | ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...