Submission #131384

#TimeUsernameProblemLanguageResultExecution timeMemory
131384antimirage팀들 (IOI15_teams)C++14
Compilation error
0 ms0 KiB
#include "teams.h"
#include <bits/stdc++.h>

using namespace std;

const int N = 1e5 + 5;

vector <int> R[N];

int cn[N], n;

void init(int N, int l[], int r[]) {
	n = N;
	for (int i = 0; i < n; i++) {
		R[r[i]].push_back(l[i]);
	}
}

int can(int m, int k[]) {
	priority_queue <pair <int, int> > q;
	sort(k, k + m);
	
	for (int i = 0; i < m; i++) {
		cn[i] = k[i];
	}
	int j = 0;
	
	for (int i = 1; i <= n; i++) {
		for (auto it : R[i])
			q.push({-it, i});
		
		while (j < m && i >= k[j] && !q.empty() && -q.top().fr <= k[j]) {
			if (q.top().sc < k[j]) {
				q.pop();
				continue;
			}
			cn[j]--;
			q.pop();
			if (cn[j] == 0)	j++;
		}
	}
	return j == m;
}

Compilation message (stderr)

teams.cpp: In function 'void init(int, int*, int*)':
teams.cpp:12:34: warning: declaration of 'N' shadows a global declaration [-Wshadow]
 void init(int N, int l[], int r[]) {
                                  ^
teams.cpp:6:11: note: shadowed declaration is here
 const int N = 1e5 + 5;
           ^
teams.cpp: In function 'int can(int, int*)':
teams.cpp:32:55: error: 'const value_type {aka const struct std::pair<int, int>}' has no member named 'fr'
   while (j < m && i >= k[j] && !q.empty() && -q.top().fr <= k[j]) {
                                                       ^~
teams.cpp:33:16: error: 'const value_type {aka const struct std::pair<int, int>}' has no member named 'sc'
    if (q.top().sc < k[j]) {
                ^~