Submission #104968

#TimeUsernameProblemLanguageResultExecution timeMemory
104968puyu_liaoGap (APIO16_gap)C++14
Compilation error
0 ms0 KiB
#include "gap.h" typedef long long ll; ll findGap(int T,int n){ if(T==1){ vector<ll> v1,v2; ll ans = 0; ll s = 0, t = 1000000000000000000ll,mn,mx; for(int i=1,j=n;i<j;i++,j--){ MinMax(s,t,&mn,&mx); v1.push_back(mn); if(i != j) v2.push_back(mx); } reverse(v2.begin(),v2.end()); for(int i : v2) v1.push_back(i); for(int i=0;i<v1.size()-1;i++) ans = max(ans,v1[i+1]-v1[i]); return ans; } else{ ll ans = 0; ll s = 0, t = 0,mn,mx,last; MinMax(s,t,&mn,&mx); last = mn; s = t = mn+1; for(int i=1;i<n;i++){ MinMax(s,t,&mn,&mx); ans = max(ans,mn-last); last = mn; s = t = mn+1; } return ans; } }

Compilation message (stderr)

gap.cpp: In function 'll findGap(int, int)':
gap.cpp:6:3: error: 'vector' was not declared in this scope
   vector<ll> v1,v2;
   ^~~~~~
gap.cpp:6:12: error: expected primary-expression before '>' token
   vector<ll> v1,v2;
            ^
gap.cpp:6:14: error: 'v1' was not declared in this scope
   vector<ll> v1,v2;
              ^~
gap.cpp:6:17: error: 'v2' was not declared in this scope
   vector<ll> v1,v2;
                 ^~
gap.cpp:14:3: error: 'reverse' was not declared in this scope
   reverse(v2.begin(),v2.end());
   ^~~~~~~
gap.cpp:15:15: error: unable to deduce 'auto&&' from 'v2'
   for(int i : v2) v1.push_back(i);
               ^~
gap.cpp:16:40: error: 'max' was not declared in this scope
   for(int i=0;i<v1.size()-1;i++) ans = max(ans,v1[i+1]-v1[i]);
                                        ^~~
gap.cpp:16:40: note: suggested alternative: 'mx'
   for(int i=0;i<v1.size()-1;i++) ans = max(ans,v1[i+1]-v1[i]);
                                        ^~~
                                        mx
gap.cpp:26:10: error: 'max' was not declared in this scope
    ans = max(ans,mn-last);
          ^~~
gap.cpp:26:10: note: suggested alternative: 'mx'
    ans = max(ans,mn-last);
          ^~~
          mx