Submission #742821

#TimeUsernameProblemLanguageResultExecution timeMemory
742821Abrar_Al_SamitTeams (IOI15_teams)C++17
34 / 100
4081 ms19844 KiB
#include "teams.h" #include <bits/stdc++.h> using namespace std; const int nax = 100; int n; vector<pair<int,int>>a; void init(int N, int A[], int B[]) { n = N; for(int i=0; i<n; ++i) { a.emplace_back(A[i], B[i]); } sort(a.begin(), a.end()); } int can(int M, int K[]) { int at = 0; sort(K, K+M); multiset<int>res; for(int i=0; i<M; ++i) { while(at < n && a[at].first<=K[i]) { if(a[at].second >= K[i]) { res.insert(a[at].second); } ++at; } while(!res.empty() && *res.begin()<K[i]) { res.erase(res.begin()); } if(res.size() < K[i]) return 0; while(K[i]--) { res.erase(res.begin()); } } return 1; }

Compilation message (stderr)

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