Submission #916145

#TimeUsernameProblemLanguageResultExecution timeMemory
916145Trisanu_DasTeams (IOI15_teams)C++17
34 / 100
4030 ms23672 KiB
#include "teams.h" #include <bits/stdc++.h> using namespace std; typedef pair<int, int> P; P p[600000]; int n; void init(int N, int A[], int B[]) { n = N; for (int i = 0; i < N; i++) p[i] = P(A[i], B[i]); sort(p, p + N); } int can(int M, int K[]) { sort(K, K + M); priority_queue<P, vector<P>, greater<P>> que; int s = 0; for (int i = 0; i < M; i++) { int x = K[i]; while (s < n && p[s].first <= x) que.push(P(p[s].second, p[s].first)), s++; while (!que.empty() && que.top().first < x) que.pop(); if (que.size() < x) return 0; for (int i = 0; i < x; i++) que.pop(); } return 1; }

Compilation message (stderr)

teams.cpp: In function 'int can(int, int*)':
teams.cpp:24:24: warning: comparison of integer expressions of different signedness: 'std::priority_queue<std::pair<int, int>, std::vector<std::pair<int, int> >, std::greater<std::pair<int, int> > >::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   24 |         if (que.size() < x) return 0;
      |             ~~~~~~~~~~~^~~
teams.cpp:25:18: warning: declaration of 'i' shadows a previous local [-Wshadow]
   25 |         for (int i = 0; i < x; i++) que.pop();
      |                  ^
teams.cpp:20:14: note: shadowed declaration is here
   20 |     for (int i = 0; i < M; 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...