답안 #1083400

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1083400 2024-09-03T04:51:11 Z djs100201 Gap (APIO16_gap) C++17
컴파일 오류
0 ms 0 KB
#include "gap.h"
#include <bits/stdc++.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) {
	if (T == 1) {
		vector<ll> res(N);
		ll l = 0, r = 1e18, mn, mx, lidx = 0, ridx = N - 1;
		for (int i = 0; i < (N + 1) / 2; i++) {
			MinMax(l, r, &mn, &mx);
			res[lidx++] = mn, res[ridx--] = mx;
			l = mn + 1, r = mx - 1;
		}
 
		ll ret = 0;
		for (int i = 1; i < N; i++)
			ret = max(ret, res[i] - res[i - 1]);
		return ret;
	} else {
		ll l = 0, r = 1e18, ret = 0, mn, mx;
		MinMax(l, r, &mn, &mx);
		r = mx;
		ll gap = mx - mn, new_gap = gap / N;
		vector<ll> R;
		R.push_back(mn);
		ll x = mn;
		while (1) {
			MinMax(x + 1, x + new_gap, &mn, &mx);
			if (mx == -1) {
				x += new_gap			
+1;
            } else {
				ret = max(ret, mn - R.back());
				x = mx;
                R.push_back(mx);
			}
            if(x==r)break;
		}
		return ret;
	}
}

Compilation message

gap.cpp:40:2: error: extended character   is not valid in an identifier
   40 |                 R.push_back(mx);
      |  ^
gap.cpp:40:5: error: extended character   is not valid in an identifier
   40 |                 R.push_back(mx);
      |    ^
gap.cpp:40:8: error: extended character   is not valid in an identifier
   40 |                 R.push_back(mx);
      |      ^
gap.cpp:40:11: error: extended character   is not valid in an identifier
   40 |                 R.push_back(mx);
      |        ^
gap.cpp:40:14: error: extended character   is not valid in an identifier
   40 |                 R.push_back(mx);
      |          ^
gap.cpp:40:17: error: extended character   is not valid in an identifier
   40 |                 R.push_back(mx);
      |            ^
gap.cpp:40:20: error: extended character   is not valid in an identifier
   40 |                 R.push_back(mx);
      |              ^
gap.cpp:40:23: error: extended character   is not valid in an identifier
   40 |                 R.push_back(mx);
      |                ^
gap.cpp: In function 'll findGap(int, int)':
gap.cpp:40:2: error: '\U000000a0' was not declared in this scope
   40 |                 R.push_back(mx);
      |  ^