Submission #634103

#TimeUsernameProblemLanguageResultExecution timeMemory
634103fadi57Gap (APIO16_gap)C++14
Compilation error
0 ms0 KiB
#include<bits/stdc++.h> #include "gap.h" #include "grader.cpp" using namespace std; typedef long long ll; const ll inf =1e18; const ll mod=998244353; ll findGap(int T, int N){ if(T==1){ int f=1;int en=N; ll mn=0;ll mx=1e18;ll a[N+5]; ll s=0;ll t=1e18; while(mn<=mx){ //if(f>=en){break;} if(f>en){break;} MinMax( s, t, &mn, &mx); a[f]=mn; a[en]=mx; s=mn+1; t=mx-1; f++;en--; } ll ans=1; for(int i=1;i<N;i++){ ans=max(ans,a[i+1]-a[i]); } return ans; } ll mn=0; ll mx=1e18; MinMax( 0, mx, &mn, &mx); ll st=mn;ll en=mx; ll len=(mx-(mn+2)+N)/(N-1); ll last=mn; vector<ll>v; v.push_back(mn); //cout<<len<<endl; //cout<<mx<<endl; //cout<<en<<endl; ll i=mn+1; for(;i<=en;i+=len){ MinMax( i, min(i+len-1,en-1), &mn, &mx); // cout<<i<<" "<<min(i+len-1,en-1)<<" "<<en<<endl; if(mn!=-1){ v.push_back(mn); v.push_back(mx); last=mx; } // cout<<"test \n"; } // cout<<i<<" "<<mx<<endl; MinMax( last, en-1, &mn, &mx); v.push_back(mx); v.push_back(mn); v.push_back(en); ll ans=len; sort(v.begin(),v.end()); for( int j=1;j<v.size();j++){ ans=max(ans,v[j]-v[j-1]); } //cout<<ans<<endl; return ans; }

Compilation message (stderr)

gap.cpp: In function 'll findGap(int, int)':
gap.cpp:65:15: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   65 | for( int j=1;j<v.size();j++){
      |              ~^~~~~~~~~
gap.cpp:34:4: warning: unused variable 'st' [-Wunused-variable]
   34 | ll st=mn;ll en=mx;
      |    ^~
/usr/bin/ld: /tmp/cctkBl1c.o: in function `MinMax(long long, long long, long long*, long long*)':
grader.cpp:(.text+0x0): multiple definition of `MinMax(long long, long long, long long*, long long*)'; /tmp/cclvSpIc.o:gap.cpp:(.text+0x560): first defined here
/usr/bin/ld: /tmp/cctkBl1c.o: in function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/cclvSpIc.o:gap.cpp:(.text.startup+0x0): first defined here
collect2: error: ld returned 1 exit status