제출 #163586

#제출 시각아이디문제언어결과실행 시간메모리
163586shenxy팀들 (IOI15_teams)C++11
34 / 100
4024 ms16760 KiB
#include "teams.h"
#include <algorithm>
#include <queue>
using namespace std;
typedef pair<int, int> ii;
int n;
ii res[100000];
void init(int N, int A[], int B[]) {
	n = N;
	for (int i = 0; i < N; ++i) res[i] = ii(A[i], B[i]);
	sort(res, res + N);
}
int can(int M, int K[]) {
	priority_queue<int> pq;
	sort(K, K + M);
	int ptr = 0;
	for (int i = 0; i < M; ++i) {
		while (ptr != n && res[ptr].first <= K[i]) pq.push(-res[ptr++].second);
		while (!pq.empty() && -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;
}

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

teams.cpp: In function 'int can(int, int*)':
teams.cpp:20:17: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   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...