제출 #619597

#제출 시각아이디문제언어결과실행 시간메모리
619597Mounir팀들 (IOI15_teams)C++14
컴파일 에러
0 ms0 KiB
#include "teams.h"
#include <bits/stdc++.h>
#define all(x) x.begin(), x.end()
#define chmax(x, v) x = max(x, v)
#define chmin(x, v) x = min(x, v)
#define pii pair<int, int>
#define pb push_back
#define sz(x) (int)x.size()
#define x first
#define y second
//#define int long long
using namespace std;

const int N_ELEVES = 3e5;

int nInters;
vector<int> fins[N_ELEVES];

void init(int N, int A[], int B[]) {
	nInters = N;
	for (int i = 0; i < N; ++i)
		fins[A[i]].pb(B[i]);
	nInters++;
}

int can(int M, int K[]) {
	int nReqs[nInters];
	for (int i = 0; i < nInters; ++i)
		nReqs[i] = 0;
	for (int iReq = 0; iReq < M; ++iReq)
		nReqs[K[iReq]]++;
	
	priority_queue<int> actus;
	for (int i = 0; i < nInters; ++i){
		for (int fin : fins[i])
			actus.push(-fin);
		while (nReqs[i]--){
			int nb = 0;
			while (!actus.empty() && nb != i){
				nb += (-actus.top() >= i);
				actus.pop();
			}

			if (nb < i)
				return 0;
		}
	}
	return 1;
}

signed main(){
	int n; cin >> n;
	int a[n], b[n];
	for (int i = 0; i < n; ++i)	
		cin >> a[i] >> b[i];
	init(n, a, b);
	int q; cin >> q;
	for (int i = 0; i < q; ++i){
		int m; cin >> m;
		int k[m];
		for (int j = 0; j < m; ++j)
			cin >> k[j];
		cout << can(m, k) << endl;
	}
}

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

/usr/bin/ld: /tmp/ccU9WvaV.o: in function `main':
grader.c:(.text.startup+0x0): multiple definition of `main'; /tmp/ccb54paW.o:teams.cpp:(.text.startup+0x0): first defined here
collect2: error: ld returned 1 exit status