# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1017871 | parsadox2 | Teams (IOI15_teams) | C++17 | 4078 ms | 31676 KiB |
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>
#include "teams.h"
using namespace std;
#define F first
#define S second
const int N = 1e5 + 10;
int n;
vector <pair <int , int>> all;
void init(int nn , int A[] , int B[])
{
n = nn;
for(int i = 0 ; i < n ; i++)
all.push_back(make_pair(A[i] , B[i]));
sort(all.begin() , all.end());
}
int can(int m , int k[])
{
sort(k , k + m);
int flg = 1;
multiset <int> st;
int pos = 0;
for(int i = 0 ; i < n ; i++)
{
if(pos == m)
break;
if(k[pos] < all[i].F)
{
while(!st.empty() && *st.begin() < k[pos])
st.erase(st.begin());
if(st.size() < k[pos])
{
flg = 0;
break;
}
for(int j = 0 ; j < k[pos] ; j++)
st.erase(st.begin());
pos++;
i--;
continue;
}
st.insert(all[i].S);
}
if(flg == 0)
return flg;
while(pos != m)
{
while(!st.empty() && *st.begin() < k[pos])
st.erase(st.begin());
if(st.size() < k[pos])
{
flg = false;
break;
}
for(int j = 0 ; j < k[pos] ; j++)
st.erase(st.begin());
pos++;
}
return flg;
}
Compilation message (stderr)
# | 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... |