# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
640178 | Benmath | Teams (IOI15_teams) | C++14 | 4046 ms | 18132 KiB |
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 <bits/stdc++.h>
#include<teams.h>
using namespace std;
int n;
int a[100001],b[100001];
void init(int N, int A[], int B[]) {
n=N;
vector<pair<int,int> >v;
for(int i=0;i<N;i++){
v.push_back({A[i],B[i]});
}
sort(v.begin(),v.end());
for(int i=0;i<N;i++){
a[i]=v[i].first;
b[i]=v[i].second;
}
}
int can(int M, int K[]) {
priority_queue<int,vector<int>,greater<int> >pq;
sort(K,K+M);
//cout<<pq.top()<<endl;
int j=0;
for(int i=0;i<M;i++){
while(!pq.empty() and pq.top()<K[i]){
pq.pop();
}
while(j<n){
if(K[i]>=a[j] and K[i]<=b[j]){
pq.push(b[j]);
}else if(K[i]<a[j]){
break;
}
j++;
}
int t1=0;
if(pq.size()<K[i]){
//cout<<i<<endl;
return 0;
}else{
for(int k1=0;k1<K[i];k1++){
pq.pop();
}
}
}
return 1;
}
/*
int main()
{
int n1;
cin>>n1;
int a1[n1],b1[n1];
for(int i=0;i<n1;i++){
cin>>a1[i]>>b1[i];
}
init(n1,a1,b1);
int q;
cin>>q;
for(int i=0;i<q;i++){
int m;
cin>>m;
int k[m];
for(int j=0;j<m;j++){
cin>>k[j];
}
cout<<can(m,k)<<endl;
}
}
*/
Compilation message (stderr)
# | 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... |