Submission #655292

#TimeUsernameProblemLanguageResultExecution timeMemory
655292ssenseGap (APIO16_gap)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #include "gap.h" #define startt ios_base::sync_with_stdio(false);cin.tie(0); typedef long long ll; using namespace std; #define vint vector<int> #define all(v) v.begin(), v.end() #define MOD 1000000007 #define MOD2 998244353 #define MX 1000000000 #define MXL 1000000000000000000 #define PI (ld)2*acos(0.0) #define pb push_back #define sc second #define fr first //#define int long long #define endl '\n' #define ld long double #define NO cout << "NO" << endl #define YES cout << "YES" << endl long long findGap(int T, int N) { if(T == 1) { long long mn, mx; long long ask1 = 0, ask2 = 1e18; vector<long long> a(N); for(int i = 0; i < N; i++) { a[i] = -1; } long long nowi = 0, nowi2 = N-1; while(true) { MinMax(ask1, ask2, &mn, &mx); if(mn == -1 && mx == -1) { break; } if(mn == mx) { a[nowi] = mn; break; } a[nowi] = mn; nowi++; a[nowi2] = mx; nowi2--; ask1 = mn+1; ask2 = mx-1; } long long ans = 0; for(int i = 0; i < N-1; i++) { assert(a[i] != -1); ans = max(ans, a[i+1]-a[i]); } return ans; } else { long long mn, mx; MinMax(0, 1e18, mn, mx); long long size = mx-mn-1; long long nowmin = mn+1, last = mn; long long ans = size/(N-1); for(int i = 0; i < N-1; i++) { long long nowmax = nowmin+size/(N-1)-1; MinMax(nowmin, nowmax, mn, mx); if(mn != -1) { ans = max(ans, mn-last); last = mx; } nowmin = nowmax+1; } return ans; } }

Compilation message (stderr)

gap.cpp: In function 'long long int findGap(int, int)':
gap.cpp:64:25: error: invalid conversion from 'long long int' to 'long long int*' [-fpermissive]
   64 |         MinMax(0, 1e18, mn, mx);
      |                         ^~
      |                         |
      |                         long long int
In file included from gap.cpp:2:
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:64:29: error: invalid conversion from 'long long int' to 'long long int*' [-fpermissive]
   64 |         MinMax(0, 1e18, mn, mx);
      |                             ^~
      |                             |
      |                             long long int
In file included from gap.cpp:2:
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:71:36: error: invalid conversion from 'long long int' to 'long long int*' [-fpermissive]
   71 |             MinMax(nowmin, nowmax, mn, mx);
      |                                    ^~
      |                                    |
      |                                    long long int
In file included from gap.cpp:2:
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:71:40: error: invalid conversion from 'long long int' to 'long long int*' [-fpermissive]
   71 |             MinMax(nowmin, nowmax, mn, mx);
      |                                        ^~
      |                                        |
      |                                        long long int
In file included from gap.cpp:2:
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*);
      |                                               ^~~~~~~~~~