Submission #718090

#TimeUsernameProblemLanguageResultExecution timeMemory
718090irmuunGap (APIO16_gap)C++17
Compilation error
0 ms0 KiB
#include<bits/stdc++.h>
#include "gap.h"

using namespace std;

#define pb push_back
#define ll long long
#define ff first
#define ss second
#define all(s) s.begin(),s.end()

const ll INF=1e18;

ll findGap(ll T,ll N){
    vector<ll>v;
    ll l=0;
    ll r=INF;
    for(ll i=1;i<=(n+1)/2;i++){
        ll a,b;
        MinMax(l,r,&a,&b);
        v.pb(a);
        if(a!=b){
            v.pb(b);
        }
        l=a+1;
        r=b-1;
    }
    sort(all(v));
    ll ans=v[1]-v[0];
    for(ll i=2;i<n;i++){
        ans=max(ans,v[i]-v[i-1]);
    }
    return ans;
}

Compilation message (stderr)

gap.cpp: In function 'long long int findGap(long long int, long long int)':
gap.cpp:18:20: error: 'n' was not declared in this scope
   18 |     for(ll i=1;i<=(n+1)/2;i++){
      |                    ^
gap.cpp:30:18: error: 'n' was not declared in this scope
   30 |     for(ll i=2;i<n;i++){
      |                  ^