Submission #1133007

#TimeUsernameProblemLanguageResultExecution timeMemory
1133007t9unkubjGap (APIO16_gap)C++20
Compilation error
0 ms0 KiB

#ifdef t9unkubj
#include"debug.cpp"
//#include"template_no_debug.h"
#else 
#define dbg(...) 199958
#endif

#undef _GLIBCXX_DEBUG
#pragma GCC optimize("O3")
using namespace std;
#include<bits/stdc++.h>
using ll=long long;
using ull=unsigned long long;
template<class T>using vc=vector<T>;
template<class T>using vvc=vc<vc<T>>;
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define REP(i,j,n) for(ll i=(j);i<(ll)(n);i++)
#define DREP(i,n,m) for(ll i=(n);i>=(m);i--)
#define drep(i,n) for(ll i=((n)-1);i>=0;i--)
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
template<class T,class F>
bool chmin(T &x, F y){
    if(x>y){
        x=y;
        return true;
    }
    return false;
}
template<class T, class F>
bool chmax(T &x, F y){
    if(x<y){
        x=y;
        return true;
    }
    return false;
}
double pass_time=0;

long long findGap(int T, int N)
{
    vc<ll>l(n+1),r(n+1);
    MinMax(0,2e18,l[0],r[0]);
    ll W=r[0]-l[0];
    ll per=(W+n-1)/n;

    for(int i=0;i<n;i++){
        MinMax(per*i+l[0],per*(i+1)+l[0],l[i+1],r[i+1]);
    }
    vc<ll>vs;
    rep(i,n){
        if(l[i+1]!=-1)vs.push_back(l[i+1]);
        if(r[i+1]!=-1)vs.push_back(r[i+1]);
    }
    vs.push_back(l[0]);
    vs.push_back(r[0]);
    sort(all(vs));
    ll ans=0;
    rep(i,vs.size()-1){
        chmax(ans,vs[i+1]-vs[i]);
    }
    return ans;
}

Compilation message (stderr)

gap.cpp: In function 'long long int findGap(int, int)':
gap.cpp:43:13: error: 'n' was not declared in this scope
   43 |     vc<ll>l(n+1),r(n+1);
      |             ^
gap.cpp:44:5: error: 'MinMax' was not declared in this scope
   44 |     MinMax(0,2e18,l[0],r[0]);
      |     ^~~~~~