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>
using namespace std ;
# include "teams.h"
vector<pair<int,int>> v;
void init( int n , int a[] , int b[])
{
for(int i= 0; i < n ; i ++)
{
v.push_back(make_pair(b[i],a[i]));
}
sort(v.begin(),v.end());
}
int can(int M, int K[])
{
set < pair <int, int> > s;
int p = 0;
sort(K, K + M);
for(int i = 0; i < M; i ++)
{
int flag = K[i];
while(p < v.size() && flag > 0)
{
s.insert({v[p].second, p});
p++;
while( flag> 0 && !s.empty())
{
pair <int, int> it = *s.begin();
if(it.first <= K[i] && K[i] <= v[it.second].first)
{
s.erase(s.begin());
flag--;
}
else if(v[it.second].first < K[i])s.erase(s.begin());
else break;
}
}
if(flag > 0) return 0;
}
return 1;
}
Compilation message (stderr)
teams.cpp: In function 'int can(int, int*)':
teams.cpp:21:21: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
while(p < v.size() && flag > 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... |