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;
int N;
vector < pii > S;
void init ( int _n, int _a[], int _b[] )
{
N = _n;
for ( int i = 0; i < N; i++ )
S.push_back ( {_a[i], _b[i]} );
sort ( S.begin(), S.end() );
}
priority_queue < int > PQ;
int can ( int M, int K[] )
{
int cnt = 0, tmp;
while ( !PQ.empty() )
PQ.pop();
sort ( K, K + M );
for ( int i = 0; i < M; i++ )
{
for ( ; S[cnt].first <= K[i] && cnt < N; cnt++ ) PQ.push ( -S[cnt].second );
tmp = 0;
while ( tmp < K[i] && !PQ.empty() )
{
if ( -PQ.top() >= K[i] )
tmp++;
PQ.pop();
}
if ( tmp < K[i] )
return 0;
}
return 1;
}
# | 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... |