This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "teams.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
#define debug(x) {cerr<<#x<<"="<<x<<"\n";}
#define debug2(x, y) {cerr<<#x<<", "<<#y<<"="<<x<<", "<<y<<"\n";}
#define debugp(p) {cerr<<#p<<"={"<<p.first<<", "<<p.second<<"}\n";}
#define all(x) x.begin(), x.end()
#define pb push_back
const int MAXN=500010, SQ=320;
int n, m, k, x, y;
int A[MAXN], B[MAXN], C[MAXN];
priority_queue<int, vector<int>, greater<int>> pq;
void init(int nn, int AA[], int BB[]){
n=nn;
vector<pii> vec;
for (int i=0; i<n; i++) vec.pb({AA[i], BB[i]});
sort(all(vec));
for (int i=0; i<n; i++) A[i+1]=vec[i].first, B[i+1]=vec[i].second;
}
bool SolveBig(){
while (pq.size()) pq.pop();
int j=1;
for (int i=0; i<m; i++){
while (j<=n && A[j]<=C[i]) pq.push(B[j++]);
int t=C[i];
if (pq.size()<t) return 0;
while (t--) pq.pop();
}
return 1;
}
int can(int mm, int CC[]) {
m=mm;
for (int i=0; i<m; i++) C[i]=CC[i];
sort(C, C+m);
return SolveBig();
}
Compilation message (stderr)
teams.cpp: In function 'bool SolveBig()':
teams.cpp:32:16: 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]
32 | if (pq.size()<t) return 0;
| ~~~~~~~~~^~
# | 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... |