답안 #96453

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
96453 2019-02-09T14:13:37 Z rajarshi_basu 지구 온난화 (NOI13_gw) C++14
컴파일 오류
0 ms 0 KB
#include <iostream>
#include <vector>
#include <set>
#include <iomanip>
#include <algorithm>
#include <functional>
#include <stdio.h>
#include <cmath>
#include <queue>
#include <string>
#include <map>
#include <complex>
#include <stack>
#include <set>

#define FOR(i,n) for (int i = 0;i<n;i++)
#define FORE(i, a, b) for (int i = a;i<= b;i++)
#define ll long long int
#define ff first
#define ss second
#define ii pair<int,int>
#define pb push_back
#define mp make_pair

using namespace std;

int* arr;
int N;

// sl == sealevel
int query(int sl){
	int cnt = 0;
	FOR(i,N){
		if(i == 0){
			if(arr[i] > sl){
				cnt++;
			}
		}else{
			if(arr[i] > sl){
				if(arr[i-1] <= sl)cnt++;
			}
		}
	}
	return cnt;
}

int gw(int N,int *H){
	::N = N;
	ii crdcmprs[N];
	FOR(i,N)crdcmprs[i].ff = H[i],crdcmprs[i].ss = i;
	sort(crdcmprs,crdcmprs+N);
	arr = new int[N];
	FOR(i,N)arr[crdcmprs[i].ss] = crdcmprs[i].ff;
	int mx = 0;
	FOR(i,N+5){
		mx = max(mx,query(i));
	}
	cout << mx << endl;
	return 0;
}

/*
int main(){
	int n;
	cin >> n;
	int h[n];
	FOR(i,n)cin >> h[i];
	cout << gw(n,h) << endl;
	return 0;
}
*/

Compilation message

/usr/lib/gcc/x86_64-linux-gnu/7/../../../x86_64-linux-gnu/crt1.o: In function `_start':
(.text+0x20): undefined reference to `main'
collect2: error: ld returned 1 exit status