이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
#include "teams.h"
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef vector<pii> vii;
//init(N, A, B) — The grader will call this function first and exactly once.
//can(M, K) — After calling init once, the grader will call this function times in a row, once for each day.
vii v;
int n;
void init(int x, int a[], int b[]){
n=x;
v=vii(n);
for (int i=0;i<n;i++){
v[i]=pii{a[i],b[i]};
}
sort(v.begin(),v.end());
}
int can(int m, int k[]){
vi q(m);
for (int i=0;i<m;i++) q[i]=k[i];
sort(q.begin(),q.end());
priority_queue<int> cola;
int i=0;
for (int s:q){
while (i<n and v[i].first<=s){
cola.push(-v[i].second);
i++;
}
while (cola.size() and -cola.top()<s) cola.pop();
if (cola.size()>=s){
while (s--) cola.pop();
}
else return 0;
}
return 1;
}
컴파일 시 표준 에러 (stderr) 메시지
teams.cpp: In function 'int can(int, int*)':
teams.cpp:38:24: warning: comparison of integer expressions of different signedness: 'std::priority_queue<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
38 | if (cola.size()>=s){
| ~~~~~~~~~~~^~~
# | 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... |