Submission #331069

#TimeUsernameProblemLanguageResultExecution timeMemory
331069monkey8Teams (IOI15_teams)C++17
34 / 100
4067 ms19292 KiB
#include "teams.h"
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <map>
#include <cstdio>
#include <utility> 
#include <queue>
#include <math.h>
#include <set>
#include <bitset>
#include <cmath>
#include <bitset>
#include <iterator>
#include <limits>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
vector<pii> students;
int N;
void init(int n, int a[], int b[]) {
	N = n;
	for(int i = 0; i < n; i++)
		students.push_back(pii(a[i], b[i]));
	sort(students.begin(), students.end());
}

int can(int m, int k[]) {
	sort(k, k + m);
	priority_queue<int> pq;
	int idx = 0;
	for(int i = 0; i < m; i++) {
		while(idx < N && students[idx].first <= k[i]) {
			pq.push(-students[idx].second);
			idx++;
		}
		while(!pq.empty() && -pq.top() < k[i])
			pq.pop();
		if(pq.size() < k[i]) return 0;
		else {
			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:40:16: warning: comparison of integer expressions of different signedness: 'std::priority_queue<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   40 |   if(pq.size() < k[i]) return 0;
      |      ~~~~~~~~~~^~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...