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;
#define rep(i,a,b) for(int i=a; i<int(b); i++)
#define all(x) x.begin(),x.end()
vector<int> avalible;
vector<int> lost;
vector<pair<int,int> > people;
int n;
void init(int N, int A[], int B[]) {
n=N;
rep(i,0,N) {
people.push_back(make_pair(A[i],B[i]));
}
sort(all(people));
priority_queue <int> temp;
int j=0;
int k=0;
rep (i,0,N) {
while(j<n && people[j].first<=i) {
temp.push(people[j].second);
j++;
}
while(!temp.empty() && temp.top()<i) {
temp.pop();
k++;
}
avalible.push_back(j);
lost.push_back(k);
}
}
int can(int M, int K[]) {
vector <int> v;
rep(i,0,M) {
v.push_back(K[i]);
}
priority_queue <int> temp;
sort(all(v));
int j=0;
rep (i,0,M) {
int curr=v[i];
while(j<n && people[j].first<=curr) {
temp.push(people[j].second);
j++;
}
while (!temp.empty() && temp.top()<curr) {
temp.pop();
}
if (temp.size()<curr) return false;
rep (a,0,curr) {
temp.pop();
}
}
return true;
}
Compilation message (stderr)
teams.cpp: In function 'int can(int, int*)':
teams.cpp:50:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
if (temp.size()<curr) return false;
~~~~~~~~~~~^~~~~
# | 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... |