Submission #778264

#TimeUsernameProblemLanguageResultExecution timeMemory
778264Jarif_RahmanTeams (IOI15_teams)C++17
34 / 100
4080 ms28816 KiB
#include "teams.h" #include <bits/stdc++.h> #define pb push_back #define f first #define sc second using namespace std; typedef long long int ll; typedef string str; int n; int *A, *B; void init(int _n, int _A[], int _B[]){ swap(n, _n); swap(A, _A); swap(B, _B); } int can(int m, int K[]){ vector<vector<int>> rl(n+1); for(int i = 0; i < n; i++) rl[A[i]].pb(i); vector<int> projects(n+1, 0); for(int i = 0; i < m; i++) projects[K[i]]++; priority_queue<int, vector<int>, greater<int>> pq; for(int i = 1; i <= n; i++){ for(int j: rl[i]) pq.push(B[j]); int k = projects[i]*i; if(k > pq.size()) return 0; while(k--) pq.pop(); while(!pq.empty() && pq.top() == i) pq.pop(); } return 1; }

Compilation message (stderr)

teams.cpp: In function 'int can(int, int*)':
teams.cpp:31:14: warning: comparison of integer expressions of different signedness: 'int' and 'std::priority_queue<int, std::vector<int>, std::greater<int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   31 |         if(k > pq.size()) 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...