Submission #713148

#TimeUsernameProblemLanguageResultExecution timeMemory
713148bin9638Gap (APIO16_gap)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #ifndef SKY #include "gap.h" #endif // SKY using namespace std; #define ll long long #define pb push_back #define N 100010 #define ii pair<int,int> #define fs first #define sc second #define ld double int n; #ifdef SKY ll a[N]; void MinMax(ll s,ll t, ll&mn, ll&mx) { if(s>t) { cout<<"NGU VC"; exit(0); } if(s>a[n]||a[lower_bound(a+1,a+1+n,s)-a]>t) { mn=-1; mx=-1; return; } mn=a[lower_bound(a+1,a+1+n,s)-a]; if(t>=a[n]) { mx=a[n]; return; } mx=a[prev(upper_bound(a+1,a+1+n,t))-a]; } #endif long long findGap(int T, int cc) { n=cc; ll L=0,R=1e18; vector<ll>s; while(L<=R) { ll u,v; MinMax(L,R,u,v); // cout<<L<<" "<<R<<" "<<u<<" "<<v<<endl; if(u==-1) break; s.pb(u); s.pb(v); L=u+1; R=v-1; } sort(s.begin(),s.end()); // s.erase(unique(s.begin(),s.end()),s.end()); // for(auto u:s)cout<<u<<" ";cout<<endl; ll res=0; for(int i=0;i<n-1;i++) res=max(res,s[i+1]-s[i]); return res; } #ifdef SKY int main() { freopen("A.inp","r",stdin); freopen("A.out","w",stdout); int n,T; cin>>T>>n; for(int i=1;i<=n;i++) cin>>a[i]; cout<<findGap(T,n)<<endl; return 0; } #endif // SKY

Compilation message (stderr)

gap.cpp: In function 'long long int findGap(int, int)':
gap.cpp:52:20: error: invalid conversion from 'long long int' to 'long long int*' [-fpermissive]
   52 |         MinMax(L,R,u,v);
      |                    ^
      |                    |
      |                    long long int
In file included from gap.cpp:4:
gap.h:1:35: note:   initializing argument 3 of 'void MinMax(long long int, long long int, long long int*, long long int*)'
    1 | void MinMax(long long, long long, long long*, long long*);
      |                                   ^~~~~~~~~~
gap.cpp:52:22: error: invalid conversion from 'long long int' to 'long long int*' [-fpermissive]
   52 |         MinMax(L,R,u,v);
      |                      ^
      |                      |
      |                      long long int
In file included from gap.cpp:4:
gap.h:1:47: note:   initializing argument 4 of 'void MinMax(long long int, long long int, long long int*, long long int*)'
    1 | void MinMax(long long, long long, long long*, long long*);
      |                                               ^~~~~~~~~~
gap.cpp:65:5: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
   65 |     for(int i=0;i<n-1;i++)
      |     ^~~
gap.cpp:67:2: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
   67 |  return res;
      |  ^~~~~~