답안 #23352

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
23352 2017-05-06T16:32:14 Z Hassoony Gap (APIO16_gap) C++11
컴파일 오류
0 ms 0 KB
#include<bits/stdc++.h>
#define MEM(dp,i) memset(dp,i,sizeof(dp))
#define R return
#define F first
#define S second
#define C continue
#define pb push_back
using namespace std;
typedef long long ll;
typedef pair<ll,ll> pll;
typedef pair<int,int> pii;
const int MX=5009;
const ll mod=1e9+7;
const ll inf=(1ll<<60);
ll a[MX];
void MinMax(ll s,ll t,ll mn,ll mx);
int findGap(int t,int n){
    ll x=0,y=1e18,mn=-1,mx=-1,i=0;
    MinMax(x,y,&mn,&mx);
    while(mn!=-1&&mx!=-1&&i<(n+1)/2){
        a[i]=mn;
        a[n-i-1]=mx;
        MinMax(mn,mx,&mn,&mx);
        i++;
    }
    sort(a,a+n);
    ll ans=0;
    for(int i=0;i<n-1;i++){
        ans=max(ans,a[i+1]-a[i]);
    }
    R ans;
}

Compilation message

gap.cpp: In function 'int findGap(int, int)':
gap.cpp:19:23: error: invalid conversion from 'll* {aka long long int*}' to 'll {aka long long int}' [-fpermissive]
     MinMax(x,y,&mn,&mx);
                       ^
gap.cpp:16:6: note:   initializing argument 3 of 'void MinMax(ll, ll, ll, ll)'
 void MinMax(ll s,ll t,ll mn,ll mx);
      ^
gap.cpp:19:23: error: invalid conversion from 'll* {aka long long int*}' to 'll {aka long long int}' [-fpermissive]
     MinMax(x,y,&mn,&mx);
                       ^
gap.cpp:16:6: note:   initializing argument 4 of 'void MinMax(ll, ll, ll, ll)'
 void MinMax(ll s,ll t,ll mn,ll mx);
      ^
gap.cpp:23:29: error: invalid conversion from 'll* {aka long long int*}' to 'll {aka long long int}' [-fpermissive]
         MinMax(mn,mx,&mn,&mx);
                             ^
gap.cpp:16:6: note:   initializing argument 3 of 'void MinMax(ll, ll, ll, ll)'
 void MinMax(ll s,ll t,ll mn,ll mx);
      ^
gap.cpp:23:29: error: invalid conversion from 'll* {aka long long int*}' to 'll {aka long long int}' [-fpermissive]
         MinMax(mn,mx,&mn,&mx);
                             ^
gap.cpp:16:6: note:   initializing argument 4 of 'void MinMax(ll, ll, ll, ll)'
 void MinMax(ll s,ll t,ll mn,ll mx);
      ^