답안 #1027755

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1027755 2024-07-19T09:39:31 Z Gangsta Gap (APIO16_gap) C++14
컴파일 오류
0 ms 0 KB
#include "bits/stdc++.h"
#include "gap.h"
#define ll long long
#define pb push_back
#define pii pair<ll,ll>
#define ff first
#define ss second
#define sz size()

const int N = 2e5 + 1;

using namespace std;

ll ans;

vector <ll> v, v1;

// void MinMax(ll s, ll t, ll &mn, ll &mx){
// 	int a, b;
// 	cin >> a >> b;
// 	mn = a;
// 	mx = b;
// }

ll findGap(int t, int n){
	ll mn, mx, l = -1, r = 1e18;
	r++;
	if(t == 1){
		while(l + 1 <= r - 1){
			MinMax(l + 1, r - 1, *mn, *mx);
			if(mn == -1) break;
			v.pb(mn);
			v1.pb(mx);
			l = mn;
			r = mx;
		}
		for(int i = (int)v1.sz-1; i >= 0; i--) v.pb(v1[i]);
		for(int i = 0; i < (int)v.sz-1; i++) ans = max(ans,v[i+1]-v[i]);
		return ans;
	}
}

// int main(){
//     int n, t;
//     cin >> t >> n;
//     cout << findGap(t, n);
// }

Compilation message

gap.cpp: In function 'long long int findGap(int, int)':
gap.cpp:30:25: error: invalid type argument of unary '*' (have 'long long int')
   30 |    MinMax(l + 1, r - 1, *mn, *mx);
      |                         ^~~
gap.cpp:30:30: error: invalid type argument of unary '*' (have 'long long int')
   30 |    MinMax(l + 1, r - 1, *mn, *mx);
      |                              ^~~
gap.cpp:41:1: warning: control reaches end of non-void function [-Wreturn-type]
   41 | }
      | ^