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"
/*#pragma GCC optimize("O3")*/
#include<bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
//#define ordered_set tree<int, null_type,less<int >, rb_tree_tag,tree_order_statistics_node_update>
#define eps 1e-9
#define MOD1 998244353
#define MOD2 1000000007
#define INV_10 299473306
#define INF 1000000001
#define PI 3.14159265358979323846
using namespace std;
int n;
vector<pair<int, int> >v;
bool compare(pair<int, int>a, pair<int, int>b)
{
if(a.second != b.second)
return a.second < b.second;
return a.first < b.first;
}
void init(int N, int A[], int B[]) {
n=N;
for(int i = 0; i < n; i++)
v.push_back(make_pair(A[i], B[i]));
sort(v.begin(), v.end(), compare);
}
int can(int M, int K[]) {
sort(K, K+M);
int idx=n-1;
priority_queue<int>pq;
for(int i = M-1; i >= 0; i--)
{
int cu=0;
while(idx >= 0 && v[idx].second >= K[i])
{
pq.push(v[idx].first);
idx--;
}
while(!pq.empty() && cu < K[i])
{
if(pq.top() <= K[i])
cu++;
pq.pop();
}
if(cu!=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... |