Submission #744332

#TimeUsernameProblemLanguageResultExecution timeMemory
744332baneTeams (IOI15_teams)C++17
Compilation error
0 ms0 KiB
#include "teams.h"
 
#include "bits/stdc++.h"
using namespace std;
 
vector<pair<int,int>> intervals;
void init(int N, int A[], int B[])
{
	intervals.resize(N);
	for (int i = 0; i < N; ++i)
		intervals[i] = {A[i], B[i]};
	sort(intervals.begin(), intervals.end());
}
 
int can(int M, int K[])
{
	sort(K, K + M);
	priority_queue<int, vi, greater<int>> pq; // b : end of interval
	int idx = 0;
	for (int i = 0; i < M; ++i)
	{
		int todo = K[i];
		while (idx < (int)intervals.size() && intervals[idx].first <= K[i])
			pq.push(intervals[idx++].second);
		while (todo)
		{
			if (pq.empty())
				return 0;
			if (pq.top() >= K[i])
				--todo;
			pq.pop();
		}
	}
	return 1;
}

Compilation message (stderr)

teams.cpp: In function 'int can(int, int*)':
teams.cpp:18:22: error: 'vi' was not declared in this scope
   18 |  priority_queue<int, vi, greater<int>> pq; // b : end of interval
      |                      ^~
teams.cpp:18:37: error: template argument 2 is invalid
   18 |  priority_queue<int, vi, greater<int>> pq; // b : end of interval
      |                                     ^~
teams.cpp:24:7: error: request for member 'push' in 'pq', which is of non-class type 'int'
   24 |    pq.push(intervals[idx++].second);
      |       ^~~~
teams.cpp:27:11: error: request for member 'empty' in 'pq', which is of non-class type 'int'
   27 |    if (pq.empty())
      |           ^~~~~
teams.cpp:29:11: error: request for member 'top' in 'pq', which is of non-class type 'int'
   29 |    if (pq.top() >= K[i])
      |           ^~~
teams.cpp:31:7: error: request for member 'pop' in 'pq', which is of non-class type 'int'
   31 |    pq.pop();
      |       ^~~