Submission #619123

#TimeUsernameProblemLanguageResultExecution timeMemory
619123mdn2002Teams (IOI15_teams)C++14
34 / 100
4053 ms49312 KiB
#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)

teams.cpp: In function 'int can(int, int*)':
teams.cpp:38:17: warning: declaration of 'k' shadows a global declaration [-Wshadow]
   38 |             int k = i;
      |                 ^
teams.cpp:4:39: note: shadowed declaration is here
    4 | int n , a [500005] , b [500005] , m , k [500005] , num [500005];
      |                                       ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...