제출 #958847

#제출 시각아이디문제언어결과실행 시간메모리
95884712345678팀들 (IOI15_teams)C++17
34 / 100
4075 ms12344 KiB
#include "teams.h"
#include <bits/stdc++.h>

using namespace std;

const int nx=1e5+5;
int n, cur;
vector<pair<int, int>> v;

void init(int N, int A[], int B[]) {
	n=N;
	for (int i=0; i<N; i++) v.push_back({A[i], B[i]});
	sort(v.begin(), v.end());
}

int can(int M, int K[]) {
	sort(K, K+M);
	cur=0;
    priority_queue<int, vector<int>, greater<int>> pq;
    for (int i=0; i<M; i++)
    {
        while (cur<n&&v[cur].first<=K[i]) pq.push(v[cur++].second);
        while (!pq.empty()&&pq.top()<K[i]) pq.pop();
        if (pq.size()<K[i]) return 0;
        while (K[i]--) pq.pop();
    }
	return 1;
}

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

teams.cpp: In function 'int can(int, int*)':
teams.cpp:24:22: 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]
   24 |         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...