Submission #540855

#TimeUsernameProblemLanguageResultExecution timeMemory
540855GioChkhaidzeTeams (IOI15_teams)C++14
0 / 100
4034 ms59276 KiB
#include <bits/stdc++.h> #include "teams.h" #define pb push_back using namespace std; const int Nn = 5e5 + 5; int n, a[Nn], b[Nn], f[Nn]; vector < int > G[Nn]; void init(int N, int A[], int B[]) { n = N; for (int i = 0; i < n; ++i) { a[i] = A[i], b[i] = B[i]; } for (int i = 0; i < N; ++i) { G[A[i]].pb(i); } } int can(int M, int K[]) { for (int i = 0; i < M; ++i) { f[K[i]]++; } multiset < int > st; bool ok = true; for (int i = 1; i <= n; ++i) { for (int j = 0; j < G[i].size(); ++j) { int id = G[i][j]; st.insert(b[id]); } for (int j = 1; j <= f[i] * i; ++j) { if (!st.size()) { ok = false; break; } if ((*st.begin()) < i) { ok = false; break; } st.erase(st.find(*st.begin())); } if(!ok) break; } for (int i = 0; i < M; ++i) { f[K[i]] = 0; } return ok; }

Compilation message (stderr)

teams.cpp: In function 'int can(int, int*)':
teams.cpp:30:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   30 |   for (int j = 0; j < G[i].size(); ++j) {
      |                   ~~^~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...