# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
619123 | mdn2002 | Teams (IOI15_teams) | C++14 | 4053 ms | 49312 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 "teams.h"
#include<bits/stdc++.h>
using namespace std;
int n , a [500005] , b [500005] , m , k [500005] , num [500005];
vector < int > l [500005];
void init(int N, int A[], int B[]) {
n = N;
for ( int i = 0 ; i < n ; i ++ )
{
a [i] = A [i] , b [i] = B [i];
l [ a [i] ] . push_back ( b [i] );
}
}
int can(int M, int K[]) {
m = M;
vector < int > v;
for ( int i = 0 ; i < m ; i ++ )
{
k [i] = K [i];
num [ k [i] ] ++;
}
multiset < int > s;
int f = 1;
for ( int i = 0 ; i <= n ; i ++ )
{
while ( s . size () )
{
if ( * s . begin () < i ) s . erase ( s . begin () );
else break;
}
for ( auto x : l [i] ) s . insert ( x );
while ( num [i] -- )
{
int k = i;
while ( k -- )
{
if ( s . size () == 0 ) f = 0;
if ( f == 0 ) break;
s . erase ( s . begin () );
}
if ( f == 0 ) break;
}
if ( f == 0 ) break;
}
for ( int i = 0 ; i <= n ; i ++ ) num [i] = 0;
return f;
}
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... |