Submission #290992

#TimeUsernameProblemLanguageResultExecution timeMemory
290992arayiTeams (IOI15_teams)C++17
34 / 100
4058 ms16632 KiB
#include <bits/stdc++.h> #include "teams.h" #define ad push_back using namespace std; const int N = 1e5 + 30; int l[N], r[N], n; vector <int> fp[N]; void init(int N, int A[], int B[]) { n = N; for (int i = 0; i < n; i++) { l[i] = A[i]; r[i] = B[i]; fp[l[i]].ad(r[i]); } } int col[N]; int can(int m, int k[]) { for (int i = 0; i <= n; i++) col[i] = 0; //cout << "SM" << endl; for (int i = 0; i < m; i++) col[k[i]] += k[i]; //cout << "SM" << endl; priority_queue <int, vector<int>, greater<int> > q; //cout << "SM" << endl; for (int i = 1; i <= n; i++) { //cout << "SM" << endl; for(auto p : fp[i]) q.push(p); while(!q.empty() && q.top() < i) q.pop(); if(q.size() < col[i]) return 0; while(col[i]--) q.pop(); } return 1; }

Compilation message (stderr)

teams.cpp: In function 'void init(int, int*, int*)':
teams.cpp:8:34: warning: declaration of 'N' shadows a global declaration [-Wshadow]
    8 | void init(int N, int A[], int B[])
      |                                  ^
teams.cpp:5:11: note: shadowed declaration is here
    5 | const int N = 1e5 + 30;
      |           ^
teams.cpp: In function 'int can(int, int*)':
teams.cpp:32:18: warning: comparison of integer expressions of different signedness: 'std::priority_queue<int, std::vector<int>, std::greater<int> >::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   32 |      if(q.size() < col[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...