제출 #390924

#제출 시각아이디문제언어결과실행 시간메모리
390924BlagojceGap (APIO16_gap)C++11
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h>
#define fr(i, n, m) for(int i = (n); i < (m); i ++)
#define pb push_back
#define st first
#define nd second
#define pq priority_queue
#define all(x) begin(x), end(x)


using namespace std;
typedef long long Int64;
typedef long double ld;
typedef pair<int,int> pii;
const int i_inf = 1e9;
const ll inf = 1e18;
const ll mod = 1e9+7;
const ld eps = 1e-13;
const ld pi  = 3.14159265359;


const int mxn = 1e5;
#include "gap.h"

/*
int n;
ll A[mxn];

void MinMax(ll s, ll t, ll &mn, ll &mx){
	mn = -1;
	mx = -1;
	fr(i, 0, n){
		if(A[i] >= s){
			if(A[i] <= t) mn = A[i];
			break;
		}
	}
	for(int i = n-1; i >= 0; i --){
		if(A[i] <= t){
			if(A[i] >= s) mx = A[i];
			break;
		}
	}
}
*/

long long findGap(int T, int N)
{
	ll a1, an;
	MinMax(0, inf, a1, an);
	
	
	ll d = (an - a1)/(N-1);
	
	
	ll pr = a1;
	
	ll ans = 0;
	for(int i = 0; i*d <= an; i++){
		ll ai, aj;
		MinMax(i*d, min((i+1)*d, an), ai, aj);
		
		if(ai != -1){
			ans = max(ans, ai-pr);
			pr = aj;
		}
	}
	
	return ans;
}
/*
int main(){
	cin >> n;
	fr(i, 0, n) cin >> A[i];
	cout<<findGap(2, n)<<endl;

}*/

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

gap.cpp:15:7: error: 'll' does not name a type; did you mean 'ld'?
   15 | const ll inf = 1e18;
      |       ^~
      |       ld
gap.cpp:16:7: error: 'll' does not name a type; did you mean 'ld'?
   16 | const ll mod = 1e9+7;
      |       ^~
      |       ld
gap.cpp: In function 'long long int findGap(int, int)':
gap.cpp:48:2: error: 'll' was not declared in this scope; did you mean 'ld'?
   48 |  ll a1, an;
      |  ^~
      |  ld
gap.cpp:49:12: error: 'inf' was not declared in this scope; did you mean 'ynf'?
   49 |  MinMax(0, inf, a1, an);
      |            ^~~
      |            ynf
gap.cpp:49:17: error: 'a1' was not declared in this scope; did you mean 'y1'?
   49 |  MinMax(0, inf, a1, an);
      |                 ^~
      |                 y1
gap.cpp:49:21: error: 'an' was not declared in this scope; did you mean 'yn'?
   49 |  MinMax(0, inf, a1, an);
      |                     ^~
      |                     yn
gap.cpp:52:4: error: expected ';' before 'd'
   52 |  ll d = (an - a1)/(N-1);
      |    ^~
      |    ;
gap.cpp:55:4: error: expected ';' before 'pr'
   55 |  ll pr = a1;
      |    ^~~
      |    ;
gap.cpp:57:4: error: expected ';' before 'ans'
   57 |  ll ans = 0;
      |    ^~~~
      |    ;
gap.cpp:58:19: error: 'd' was not declared in this scope
   58 |  for(int i = 0; i*d <= an; i++){
      |                   ^
gap.cpp:59:5: error: expected ';' before 'ai'
   59 |   ll ai, aj;
      |     ^~~
      |     ;
gap.cpp:60:33: error: 'ai' was not declared in this scope; did you mean 'i'?
   60 |   MinMax(i*d, min((i+1)*d, an), ai, aj);
      |                                 ^~
      |                                 i
gap.cpp:60:37: error: 'aj' was not declared in this scope
   60 |   MinMax(i*d, min((i+1)*d, an), ai, aj);
      |                                     ^~
gap.cpp:63:4: error: 'ans' was not declared in this scope; did you mean 'abs'?
   63 |    ans = max(ans, ai-pr);
      |    ^~~
      |    abs
gap.cpp:63:22: error: 'pr' was not declared in this scope; did you mean 'pi'?
   63 |    ans = max(ans, ai-pr);
      |                      ^~
      |                      pi
gap.cpp:68:9: error: 'ans' was not declared in this scope; did you mean 'abs'?
   68 |  return ans;
      |         ^~~
      |         abs