# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
782721 | fatemetmhr | Teams (IOI15_teams) | C++17 | 4049 ms | 12408 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.
// ~ Be Name Khoda ~ //
#include "teams.h"
#include <bits/stdc++.h>
//#pragma GCC optimize ("O3")
//#pragma GCC target("avx2")
//#pragma GCC optimize("unroll-loops,Ofast")
using namespace std;
typedef long long ll;
#define pb push_back
#define mp make_pair
#define all(x) x.begin(), x.end()
#define fi first
#define se second
const int maxn = 1e6 + 10;
const int maxn5 = 5e5 + 10;
const int maxnt = 2e6 + 10;
const int maxn3 = 1e3 + 10;
const int mod = 1e9 + 7;
const int lg = 21;
const ll inf = 1e18;
vector <pair<int, int>> av;
priority_queue <int> have;
int n;
void init(int N, int A[], int B[]) {
n = N;
for(int i = 0; i < n; i++)
av.pb({A[i], B[i]});
sort(all(av));
}
int can(int m, int k[]) {
sort(k, k + m);
int ind = 0;
while(have.size())
have.pop();
for(int i = 0; i < m; i++){
while(ind < av.size() && k[i] >= av[ind].fi){
have.push(-av[ind].se);
ind++;
}
while(have.size() && have.top() * -1 < k[i])
have.pop();
if(have.size() < k[i])
return false;
for(int j = 0; j < k[i]; j++)
have.pop();
}
return true;
}
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... |