Submission #1083342

# Submission time Handle Problem Language Result Execution time Memory
1083342 2024-09-03T02:23:02 Z djs100201 Gap (APIO16_gap) C++17
Compilation error
0 ms 0 KB
#include<bits/stdc++.h>
#include "gap.h"
#define all(v) v.begin(),v.end()
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
using PP = pair<ll, P>;
const ll n_ =2e5+10, inf = (ll)2e9 * (ll)1e9 + 7, mod = 998244353;
ll n, m, tc = 1, a, b, c, d, sum, x, y, z, base, ans, k;
ll findGap(int T, int N) {
    vector<ll>res(N);
    ll l=0,r=1e18;
    MinMax(l,r,&res[0],&res[N-1]);
    ll lidx=1,ridx=N-2;
    while(lidx<=ridx){
        MinMax(l+1,r-1,res[lidx],res[ridx]);
        l=res[lidx],r=res[ridx];
        lidx++,ridx--;
    }
    ll ret=0;
    for(int i=1;i<N;i++)ret=max(ret,res[i]-res[i-1]);
	return ret;
}

Compilation message

gap.cpp: In function 'll findGap(int, int)':
gap.cpp:16:43: error: invalid conversion from '__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type' {aka 'long long int'} to 'long long int*' [-fpermissive]
   16 |         MinMax(l+1,r-1,res[lidx],res[ridx]);
      |                                           ^
      |                                           |
      |                                           __gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type {aka 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:16:43: error: invalid conversion from '__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type' {aka 'long long int'} to 'long long int*' [-fpermissive]
   16 |         MinMax(l+1,r-1,res[lidx],res[ridx]);
      |                                           ^
      |                                           |
      |                                           __gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type {aka 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*);
      |                                               ^~~~~~~~~~