This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "teams.h"
#include <bits/stdc++.h>
#define FOR(i, x, y) for (int i = x; i < y; i++)
using namespace std;
multiset<pair<int, int>> students;
void init(int N, int A[], int B[]) {
FOR(i, 0, N) students.insert({B[i], A[i]});
}
int can(int M, int K[]) {
sort(K, K + M);
vector<pair<int, int>> removed;
FOR(i, 0, M) {
vector<pair<int, int>> to_remove;
for (pair<int, int> j : students) {
if (K[i] <= j.first && K[i] >= j.second) to_remove.push_back(j);
if (K[i] > j.first || to_remove.size() == K[i]) break;
}
if (to_remove.size() != K[i]) {
for (pair<int, int> j : removed) students.insert(j);
return 0;
}
for (pair<int, int> j : to_remove) {
students.erase(students.find(j));
removed.push_back(j);
}
}
for (pair<int, int> j : removed) students.insert(j);
return 1;
}
Compilation message (stderr)
teams.cpp: In function 'int can(int, int*)':
teams.cpp:19:43: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
if (K[i] > j.first || to_remove.size() == K[i]) break;
~~~~~~~~~~~~~~~~~^~~~~~~
teams.cpp:21:24: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
if (to_remove.size() != K[i]) {
~~~~~~~~~~~~~~~~~^~~~~~~
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |