Submission #479576

#TimeUsernameProblemLanguageResultExecution timeMemory
479576HabitusGap (APIO16_gap)C++14
Compilation error
0 ms0 KiB
#include "gap.h" #include<bits/stdc++.h> #define ios ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0) #define dec(x, y) fixed << setprecision((y)) << (x) #define xx first #define yy second #define srt(v) sort((v).begin(), (v).end()) #define srtr(v) sort((v).rbegin(), (v).rend()) #define pb push_back #define popb pop_back #define sz(a) (int)(a).size() #define len(a) (int)(a).length() #define mp make_pair using namespace std; typedef long long ll; typedef pair<int, int> pii; typedef pair<ll, ll> pll; const ll maks=(ll)1e18; ll findGap(int T, int N) { int n=N; if(T==1) { ll a[100002]; ll mini=0LL, maxi=maks+1LL; for(int i=0; i<(n+1)/2; ++i) { MinMax(mini+1, maxi-1, mini, maxi); a[i]=mini; a[n-i-1]=maxi; } maxi=0LL; for(int i=1; i<n; ++i) { maxi=max(maxi, a[i]-a[i-1]); } return maxi; } ll mini, maxi; MinMax(1LL, maks, mini, maxi); vector<ll> v; v.pb(mini); v.pb(maxi); ll x=ceil((maxi-mini+1LL)/((ll)n-1LL)); ll mn1, mx1; for(int i=0;; ++i) { if(mini+(ll)i*x>=maxi) break; MinMax((i==0?1LL:0LL)+mini+(ll)i*x, mini+(ll)(i+1)*x-1LL, mn1, mx1); v.pb(mn1); v.pb(mx1); } srt(v); maxi=0LL; for(int i=1; i<sz(v); ++i) { max(maxi, v[i]-v[i-1]); } return maxi; }

Compilation message (stderr)

gap.cpp: In function 'll findGap(int, int)':
gap.cpp:28:36: error: invalid conversion from 'll' {aka 'long long int'} to 'long long int*' [-fpermissive]
   28 |             MinMax(mini+1, maxi-1, mini, maxi);
      |                                    ^~~~
      |                                    |
      |                                    ll {aka 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:28:42: error: invalid conversion from 'll' {aka 'long long int'} to 'long long int*' [-fpermissive]
   28 |             MinMax(mini+1, maxi-1, mini, maxi);
      |                                          ^~~~
      |                                          |
      |                                          ll {aka 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*);
      |                                               ^~~~~~~~~~
gap.cpp:39:23: error: invalid conversion from 'll' {aka 'long long int'} to 'long long int*' [-fpermissive]
   39 |     MinMax(1LL, maks, mini, maxi);
      |                       ^~~~
      |                       |
      |                       ll {aka 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 'll' {aka 'long long int'} to 'long long int*' [-fpermissive]
   39 |     MinMax(1LL, maks, mini, maxi);
      |                             ^~~~
      |                             |
      |                             ll {aka 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*);
      |                                               ^~~~~~~~~~
gap.cpp:46:67: error: invalid conversion from 'll' {aka 'long long int'} to 'long long int*' [-fpermissive]
   46 |         MinMax((i==0?1LL:0LL)+mini+(ll)i*x, mini+(ll)(i+1)*x-1LL, mn1, mx1);
      |                                                                   ^~~
      |                                                                   |
      |                                                                   ll {aka 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:46:72: error: invalid conversion from 'll' {aka 'long long int'} to 'long long int*' [-fpermissive]
   46 |         MinMax((i==0?1LL:0LL)+mini+(ll)i*x, mini+(ll)(i+1)*x-1LL, mn1, mx1);
      |                                                                        ^~~
      |                                                                        |
      |                                                                        ll {aka 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*);
      |                                               ^~~~~~~~~~