답안 #23449

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
23449 2017-05-09T16:38:41 Z ztrong Gap (APIO16_gap) C++14
컴파일 오류
0 ms 0 KB
#include <bits/stdc++.h>
#include "gap.h"

using namespace std;

#define FOR(i, a, b) for (int i = a, _b = b; i <= _b; ++i)
#define FORD(i, a, b) for (int i = a, _b = b; i >= _b; --i)
#define REP(i, a) for (int i = 0, _a = a; i < _a; ++i)
#define llint long long
#define sz(x) (x.size())
#define LL(x) (x * 2)
#define RR(x) (x * 2 + 1)
#define fi first
#define se second
#define db(x) cout << #x << " = " << x << endl;
#define BIT(x, i) ((x >> i) & 1)
#define MASK(i) (1ll << i)
#define times clock() * 1.0 / CLOCKS_PER_SEC

void openFile() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	#ifdef Tr___
	freopen("test.inp", "r", stdin);
	freopen("test.out", "w", stdout);
	#endif
}

const int maxN = 1e5 + 5;
const int maxM = 1e6 + 5;
const llint INF = 1e18;

llint findGap(int T, int N) {
	if (T == 1) {
		llint l = 0, r = INF;
		llint nl, nr;
		llint res = 0;
		FOR(i, 1, (N + 1) / 2) {
			MinMax(l + 1, r - 1, nl, nr);
			if (l != 0) {
				res = max(res, max(nl - l, r - nr));
			}
			else if (N == 2) {
				res = nr - nl;
				break;
			}
			l = nl; r = nr;
		}
		return res;
	}
	else {
		llint l, r;
		MinMax(0, INF, l, r);
		if (N == 2) {
			return r - l;
		}
		llint lower = (r - l) / (N - 1);
		llint res = lower;
		llint nl, nr;
		do {
			llint x = 0;
			nl = nr = -1;
			while (nl == -1) {
				++x;
				MinMax(l + 1, l + lower * x, nl, nr);
			}

			res = max(res, nl - l);
			l = nr;
		} while (l != r);
		return res;
	}
}

Compilation message

gap.cpp: In function 'long long int findGap(int, int)':
gap.cpp:39:31: error: invalid conversion from 'long long int' to 'long long int*' [-fpermissive]
    MinMax(l + 1, r - 1, nl, nr);
                               ^
In file included from gap.cpp:2:0:
gap.h:1:6: note:   initializing argument 3 of 'void MinMax(long long int, long long int, long long int*, long long int*)'
 void MinMax(long long, long long, long long*, long long*);
      ^
gap.cpp:39:31: error: invalid conversion from 'long long int' to 'long long int*' [-fpermissive]
    MinMax(l + 1, r - 1, nl, nr);
                               ^
In file included from gap.cpp:2:0:
gap.h:1:6: note:   initializing argument 4 of 'void MinMax(long long int, long long int, long long int*, long long int*)'
 void MinMax(long long, long long, long long*, long long*);
      ^
gap.cpp:53:22: error: invalid conversion from 'long long int' to 'long long int*' [-fpermissive]
   MinMax(0, INF, l, r);
                      ^
In file included from gap.cpp:2:0:
gap.h:1:6: note:   initializing argument 3 of 'void MinMax(long long int, long long int, long long int*, long long int*)'
 void MinMax(long long, long long, long long*, long long*);
      ^
gap.cpp:53:22: error: invalid conversion from 'long long int' to 'long long int*' [-fpermissive]
   MinMax(0, INF, l, r);
                      ^
In file included from gap.cpp:2:0:
gap.h:1:6: note:   initializing argument 4 of 'void MinMax(long long int, long long int, long long int*, long long int*)'
 void MinMax(long long, long long, long long*, long long*);
      ^
gap.cpp:65:40: error: invalid conversion from 'long long int' to 'long long int*' [-fpermissive]
     MinMax(l + 1, l + lower * x, nl, nr);
                                        ^
In file included from gap.cpp:2:0:
gap.h:1:6: note:   initializing argument 3 of 'void MinMax(long long int, long long int, long long int*, long long int*)'
 void MinMax(long long, long long, long long*, long long*);
      ^
gap.cpp:65:40: error: invalid conversion from 'long long int' to 'long long int*' [-fpermissive]
     MinMax(l + 1, l + lower * x, nl, nr);
                                        ^
In file included from gap.cpp:2:0:
gap.h:1:6: note:   initializing argument 4 of 'void MinMax(long long int, long long int, long long int*, long long int*)'
 void MinMax(long long, long long, long long*, long long*);
      ^