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>
#define TT 200005
#define ll long long int
#define MP make_pair
#define pb push_back
#define ppb pop_back
#define sp " "
#define endl "\n"
#define fi first
#define se second
#define ii pair<int,int>
#define lli pair<ll,ll>
#define fast cin.tie(0);cout.tie(0);ios_base::sync_with_stdio(false)
#define fast2 freopen ("in.txt","r",stdin);freopen ("out.txt","w",stdout);
#define mod 1000000007
#define fs(x,y) for(ll i=1;i<=y;i++) cin>>x[i]
#define fo(i,x,y) for(ll i=x;i<=y;i++)
#define INF 1000000000005
#define ull unsigned long long int
using namespace std;
int ar[TT],n,m,t;
ll tut1[TT],tut2[TT];
lli p[TT];
int bos[TT];
ll sum=1e18;
priority_queue<ll> pq;
void init(int N, int A[], int B[]) {
n=N;
// fo(i,0,n-1) //
// A[i]=p[i].fi,B[i]=p[i].se; //
fo(i,0,n-1)
p[i].fi=A[i],p[i].se=B[i];
sort(p,p+n);
}
int can(int M, int K[]) {
m=M;
// fo(i,0,m-1) //
// K[i]=ar[i]; //
fo(i,0,m-1)
ar[i]=K[i];
sort(ar,ar+m);
while(pq.size())
pq.pop();
int l=0;
fo(i,0,m-1)
{
while(l<n && p[l].fi<=ar[i])
pq.push(-p[l].se),l++;
while(pq.size())
{
ll x=-pq.top();
if(x>=ar[i])
break;
pq.pop();
}
// cout<<i<<sp<<ar[i]<<sp<<pq.size()<<endl;
if(pq.size()<ar[i])
return 0;
fo(j,1,ar[i])
pq.pop();
}
return 1;
}
// int main()
// {
// fast;
// // int a,b;
// // cin>>n>>a>>b;
// cin>>n;
// fo(i,0,n-1)
// cin>>p[i].fi>>p[i].se;
// init(n,bos,bos);
// cin>>t;
// while(t--)
// {
// cin>>m;
// fo(i,0,m-1)
// cin>>ar[i];
// cout<<"[d]"<<endl;
// fo(i,0,m-1)
// cout<<ar[i]<<sp;
// cout<<endl;
// cout<<can(m,bos)<<endl;
// }
// }
Compilation message (stderr)
teams.cpp: In function 'int can(int, int*)':
teams.cpp:70:15: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
if(pq.size()<ar[i])
~~~~~~~~~^~~~~~
# | 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... |