# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
43470 | PowerOfNinjaGo | Teams (IOI15_teams) | C++14 | 4083 ms | 21036 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.
//Power Of Ninja Go
#include <bits/stdc++.h>
#ifdef atom
#include "grader.cpp"
#else
#include "teams.h"
#endif
using namespace std;
typedef long long ll; typedef pair<int, int> ii;
#define X first
#define Y second
#define vi vector<int>
#define vii vector< ii >
#define pb push_back
const int maxn = 1e5+5;
int n;
int a[maxn], b[maxn];
void init(int N, int A[], int B[])
{
n = N;
for(int i = 1; i<= N; i++) a[i] = A[i-1], b[i] = B[i-1];
}
int can(int M, int K[])
{
int sum = 0;
for(int i = 0; i< M; i++) sum += K[i];
if(sum> n) return 0;
vii vec;
for(int i = 1; i<= n; i++) vec.pb(ii(a[i], b[i]));
sort(vec.begin(), vec.end());
sort(K, K+M);
vi bag;
int ptr = 0;
for(int i = 0; i< M; i++)
{
int here = K[i];
while(ptr< n && vec[ptr].X<= here) bag.pb(vec[ptr++].Y);
sort(bag.begin(), bag.end());
//printf("quest %d\n", i);
//for(auto v : bag) printf("%d ", v);
//printf("\n");
int pos = lower_bound(bag.begin(), bag.end(), here)-bag.begin();
if(((int)bag.size())-pos< here) return 0;
bag.erase(bag.begin()+pos, bag.begin()+pos+here);
}
return 1;
}
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... |