Submission #285440

#TimeUsernameProblemLanguageResultExecution timeMemory
285440OzyTeams (IOI15_teams)C++17
34 / 100
4089 ms12272 KiB
#include "teams.h" #include <bits/stdc++.h> using namespace std; #define rep(i,a,b) for(int i = (a); i <= (b); i++) #define debug(a) cerr << #a << " = " << a << endl; #define ini first #define fin second vector<pair<int, int> > inicios; priority_queue<int> cola; void init(int N, int A[], int B[]) { rep(i,0,N-1) inicios.push_back({A[i],B[i]}); sort(inicios.begin(), inicios.end()); } int can(int M, int K[]) { int cont; sort(K,K+M); while (!cola.empty()) cola.pop(); cont = 0; rep(i,0,M-1) { while(cont < inicios.size() && inicios[cont].ini <= K[i]) { cola.push(-inicios[cont].fin); cont++; } while (!cola.empty() && abs(cola.top()) < K[i]) cola.pop(); if (cola.size() < K[i]) return 0; else rep(j,1,K[i]) cola.pop(); } return 1; }

Compilation message (stderr)

teams.cpp: In function 'int can(int, int*)':
teams.cpp:28:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   28 |         while(cont < inicios.size() && inicios[cont].ini <= K[i]) {
      |               ~~~~~^~~~~~~~~~~~~~~~
teams.cpp:35:25: warning: comparison of integer expressions of different signedness: 'std::priority_queue<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   35 |         if (cola.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...