이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "teams.h"
#include <bits/stdc++.h>
using namespace std;
vector<pair<int, int> > ls;
void init(int N, int A[], int B[]) {
for(int i = 0; i < N; i++){
ls.push_back({A[i], B[i]});
}
sort(ls.begin(), ls.end(), [](pair<int, int>& lhs, pair<int, int>& rhs){
if(lhs.second == rhs.second)
return lhs.first > rhs.first;
return lhs.second > rhs.second;
});
}
int can(int M, int K[]) {
sort(K + 0, K + M, [](int& lhs ,int &rhs){
return lhs > rhs;
});
int it = 0;
priority_queue<int> pq;
for(int i = 0; i < M; i++){
while(it != ls.size() && ls[it].second >= K[i]){
pq.push(ls[it++].first);
}
while(!pq.empty() && pq.top() > K[i]) pq.pop();
while(K[i]--){
if(pq.empty()) return 0;
pq.pop();
}
}
return 1;
}
컴파일 시 표준 에러 (stderr) 메시지
teams.cpp: In function 'int can(int, int*)':
teams.cpp:25:12: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
while(it != ls.size() && ls[it].second >= K[i]){
~~~^~~~~~~~~~~~
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |