Submission #608598

#TimeUsernameProblemLanguageResultExecution timeMemory
608598loctildoreTeams (IOI15_teams)C++14
0 / 100
4093 ms16676 KiB
#include "teams.h"
#include <bits/stdc++.h>
using namespace std;
// trans rights
#define ll long long
#define f first
#define s second
#define endl '\n'
#define all(x) begin(x), end(x)
int n;
vector<pair<int,int>> vctr;
void init(int N, int A[], int B[]) {
	n=N;
	for (int i = 0; i < n; i++) {
		vctr.push_back({A[i],B[i]});
	}
	sort(all(vctr));
}

priority_queue<int,vector<int>,greater<int>> pq;
int can(int M, int K[]) {
	int cur=0;
	for (int i = 0; i < M; i++) {
		while (cur<n&&vctr[cur].f<=K[i]) {
			pq.push(vctr[cur++].s);
		}
		while (pq.size()&&pq.top()<K[i]) {
			pq.pop();
		}
		if (pq.size()<K[i]) {
			return 0;
		}
		for (int j = 0; j < K[i]; j++) {
			pq.pop();
		}
	}
	return 1;
}

Compilation message (stderr)

teams.cpp: In function 'int can(int, int*)':
teams.cpp:30:16: warning: comparison of integer expressions of different signedness: 'std::priority_queue<int, std::vector<int>, std::greater<int> >::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   30 |   if (pq.size()<K[i]) {
      |       ~~~~~~~~~^~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...