Submission #782721

#TimeUsernameProblemLanguageResultExecution timeMemory
782721fatemetmhrTeams (IOI15_teams)C++17
34 / 100
4049 ms12408 KiB
// ~ Be Name Khoda ~ // #include "teams.h" #include <bits/stdc++.h> //#pragma GCC optimize ("O3") //#pragma GCC target("avx2") //#pragma GCC optimize("unroll-loops,Ofast") using namespace std; typedef long long ll; #define pb push_back #define mp make_pair #define all(x) x.begin(), x.end() #define fi first #define se second const int maxn = 1e6 + 10; const int maxn5 = 5e5 + 10; const int maxnt = 2e6 + 10; const int maxn3 = 1e3 + 10; const int mod = 1e9 + 7; const int lg = 21; const ll inf = 1e18; vector <pair<int, int>> av; priority_queue <int> have; int n; void init(int N, int A[], int B[]) { n = N; for(int i = 0; i < n; i++) av.pb({A[i], B[i]}); sort(all(av)); } int can(int m, int k[]) { sort(k, k + m); int ind = 0; while(have.size()) have.pop(); for(int i = 0; i < m; i++){ while(ind < av.size() && k[i] >= av[ind].fi){ have.push(-av[ind].se); ind++; } while(have.size() && have.top() * -1 < k[i]) have.pop(); if(have.size() < k[i]) return false; for(int j = 0; j < k[i]; j++) have.pop(); } return true; }

Compilation message (stderr)

teams.cpp: In function 'int can(int, int*)':
teams.cpp:44:13: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   44 |   while(ind < av.size() && k[i] >= av[ind].fi){
      |         ~~~~^~~~~~~~~~~
teams.cpp:50:18: warning: comparison of integer expressions of different signedness: 'std::priority_queue<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   50 |   if(have.size() < k[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...