제출 #1133222

#제출 시각아이디문제언어결과실행 시간메모리
1133222Math4Life2020Gap (APIO16_gap)C++20
컴파일 에러
0 ms0 KiB
#include "gap.h"
#include <bits/stdc++.h>
using namespace std;
using ll = long long; using pii = pair<ll,ll>;

ll findGap(int T, int N) {
	if (T==1) {
		vector<ll> v1;
		ll x=0; ll y=1e18; ll a=-1, ll b=-1;
		while (x <= y) {
			MinMax(x,y,a,b);
			if (a==b) {
				v1.push_back(a);
			} else {
				v1.push_back(a);
				v1.push_back(b);
			}
			x=a+1; y=b-1;
		}
		sort(v1.begin(),v1.end());
		assert(v1.size()==N);
		ll ans = 0;
		for (ll i=0;i<(N-1);i++) {
			ans = max(ans,v1[i+1]-v1[i]);
		}
		return ans;
	}
}

컴파일 시 표준 에러 (stderr) 메시지

gap.cpp: In function 'll findGap(int, int)':
gap.cpp:9:48: error: expected initializer before 'b'
    9 |                 ll x=0; ll y=1e18; ll a=-1, ll b=-1;
      |                                                ^
gap.cpp:11:38: error: 'b' was not declared in this scope
   11 |                         MinMax(x,y,a,b);
      |                                      ^
gap.cpp:28:1: warning: control reaches end of non-void function [-Wreturn-type]
   28 | }
      | ^