Submission #419821

#TimeUsernameProblemLanguageResultExecution timeMemory
419821MohamedAhmed04Teams (IOI15_teams)C++14
34 / 100
4081 ms53292 KiB
#include <bits/stdc++.h> #include "teams.h" //#include "grader.cpp" using namespace std ; const int MAX = 5e5 + 10 ; vector<int>v[MAX] ; int n ; void init(int N, int A[], int B[]) { n = N ; for(int i = 0 ; i < n ; ++i) v[A[i]].push_back(B[i]) ; } int can(int m, int K[]) { sort(K , K + m) ; multiset<int>s ; int last = 0 ; for(int i = 0 ; i < m ; ++i) { for(int j = last+1 ; j <= K[i] ; ++j) { for(auto &k : v[j]) s.insert(k) ; } while(s.size() && (*s.begin()) < K[i]) s.erase(s.begin()) ; if(s.size() < K[i]) return 0 ; for(int j = 0 ; j < K[i] ; ++j) s.erase(s.begin()) ; last = K[i] ; } return 1 ; }

Compilation message (stderr)

teams.cpp: In function 'int can(int, int*)':
teams.cpp:34:15: warning: comparison of integer expressions of different signedness: 'std::multiset<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   34 |   if(s.size() < K[i])
      |      ~~~~~~~~~^~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...