Submission #1084418

# Submission time Handle Problem Language Result Execution time Memory
1084418 2024-09-06T08:31:06 Z MMihalev Gap (APIO16_gap) C++14
Compilation error
0 ms 0 KB
#include<iostream>
#include<algorithm>
#include "gap.h"
using namespace std;
long long mn,mx;
long long findGap(int T, int N)
{
    long long l=-1,r=1000000000000000001LL;
    int rem=N;
    __int64 ans=1;
    while(rem>0)
    {
        MinMax(l+1,r-1,&mn,&mx);
        if(rem==2)ans=max(ans,mx-mn);
        if(l!=-1)
        {
            ans=max(ans,mn-l);
            ans=max(ans,r-mx);
        }
        if(mn!=mx)rem-=2;
        else rem--;
        l=mn;
        r=mx;
    }
    return ans;
}

Compilation message

gap.cpp: In function 'long long int findGap(int, int)':
gap.cpp:10:5: error: '__int64' was not declared in this scope; did you mean '__int64_t'?
   10 |     __int64 ans=1;
      |     ^~~~~~~
      |     __int64_t
gap.cpp:14:19: error: 'ans' was not declared in this scope; did you mean 'abs'?
   14 |         if(rem==2)ans=max(ans,mx-mn);
      |                   ^~~
      |                   abs
gap.cpp:17:13: error: 'ans' was not declared in this scope; did you mean 'abs'?
   17 |             ans=max(ans,mn-l);
      |             ^~~
      |             abs
gap.cpp:25:12: error: 'ans' was not declared in this scope; did you mean 'abs'?
   25 |     return ans;
      |            ^~~
      |            abs