| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 73030 | MKopchev | 팀들 (IOI15_teams) | C++14 | 0 ms | 0 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
#include "teams.h"
using namespace std;
int n;
vector< pair<int,int> > inp;
void init(int N,vector<int> A,vector<int> B)
{
n=N;
for(int i=0;i<N;i++)
inp.push_back({A[i],B[i]});
sort(inp.begin(),inp.end());
}
priority_queue<int> q,idle;
bool call(int m,vector<int> k)
{
q=idle;
sort(k.begin(),k.end());
int pos=0;
for(auto p:k)
{
while(pos<n&&
inp[pos].first<=p)
{q.push(-inp[pos].second);pos++;}
while(q.size()&&-q.top()<p)q.pop();
//cout<<p<<" -> "<<q.size()<<endl;
if(q.size()<p)return 0;
for(int i=1;i<=p;i++)
q.pop();
}
return 1;
}
/*
int main()
{
init(4,{1,2,2,2},{2,3,3,4});
cout<<call(2,{1,3})<<endl;
cout<<call(2,{1,1})<<endl;
}
*/
