Submission #285439

#TimeUsernameProblemLanguageResultExecution timeMemory
285439OzyTeams (IOI15_teams)C++17
0 / 100
4083 ms12908 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; struct x{ int ini; int fin; bool operator < (const x &a) const { //duda return ini > a.ini; } }; vector<x> 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) { 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:37:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<x>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   37 |         while(cont < inicios.size() && inicios[cont].ini <= K[i]) {
      |               ~~~~~^~~~~~~~~~~~~~~~
teams.cpp:44:25: warning: comparison of integer expressions of different signedness: 'std::priority_queue<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   44 |         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...