Submission #731289

#TimeUsernameProblemLanguageResultExecution timeMemory
7312891neGap (APIO16_gap)C++14
Compilation error
0 ms0 KiB
#include "gap.h" #include <bits/stdc++.h> using namespace std; long long findGap(int T, int N) { long long ans = 1; if (T == 1){ long long s = -1,t = 1e18 + 1; long long x = 0,y = 0; vector<long long>pos(N); int l = 0,r = n - 1; while(l <= r && s<=t){ MinMax(s,t,&x,&y); if (x == -1 && y == -1){ break; } pos[l] = x; pos[r] = y; --r; ++l; s = x + 1; t = y - 1; } sort(pos.begin(),pos.end()); for (int i = 1;i<N;++i){ ans = max(ans,pos[i] - pos[i - 1]); } } else{ long long x,y; MinMax(0,1e18,&x,&y); long long left = 2,right = 1e18; while(left<=right){ long long mid = (left + right)>>1; long long s = x; bool ok = false; while(s < y){ long long xx,yy; MinMax(s + 1,s + mid,xx,yy); if (yy == s + mid && xx == yy){ ok = true; break; } s = yy; } if (ok){ left = mid + 1; ans = mid; } else right = mid - 1; } } return ans; }

Compilation message (stderr)

gap.cpp: In function 'long long int findGap(int, int)':
gap.cpp:11:17: error: 'n' was not declared in this scope
   11 |   int l = 0,r = n - 1;
      |                 ^
gap.cpp:39:26: error: invalid conversion from 'long long int' to 'long long int*' [-fpermissive]
   39 |     MinMax(s + 1,s + mid,xx,yy);
      |                          ^~
      |                          |
      |                          long long int
In file included from gap.cpp:1:
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:39:29: error: invalid conversion from 'long long int' to 'long long int*' [-fpermissive]
   39 |     MinMax(s + 1,s + mid,xx,yy);
      |                             ^~
      |                             |
      |                             long long int
In file included from gap.cpp:1:
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*);
      |                                               ^~~~~~~~~~