#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
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]) {
~~~~~~~~~~~~~~~~~^~~~~~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
384 KB |
Output is correct |
2 |
Correct |
0 ms |
256 KB |
Output is correct |
3 |
Correct |
1 ms |
256 KB |
Output is correct |
4 |
Correct |
1 ms |
384 KB |
Output is correct |
5 |
Incorrect |
0 ms |
384 KB |
Output isn't correct |
6 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
55 ms |
5856 KB |
Output is correct |
2 |
Correct |
49 ms |
5752 KB |
Output is correct |
3 |
Correct |
42 ms |
5752 KB |
Output is correct |
4 |
Correct |
58 ms |
6136 KB |
Output is correct |
5 |
Correct |
70 ms |
6900 KB |
Output is correct |
6 |
Correct |
37 ms |
5752 KB |
Output is correct |
7 |
Correct |
38 ms |
5752 KB |
Output is correct |
8 |
Correct |
38 ms |
5752 KB |
Output is correct |
9 |
Correct |
57 ms |
7160 KB |
Output is correct |
10 |
Correct |
43 ms |
6896 KB |
Output is correct |
11 |
Correct |
43 ms |
6904 KB |
Output is correct |
12 |
Correct |
50 ms |
6908 KB |
Output is correct |
13 |
Correct |
38 ms |
5752 KB |
Output is correct |
14 |
Correct |
33 ms |
5752 KB |
Output is correct |
15 |
Incorrect |
51 ms |
5848 KB |
Output isn't correct |
16 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1096 ms |
6312 KB |
Output is correct |
2 |
Correct |
1947 ms |
6540 KB |
Output is correct |
3 |
Incorrect |
567 ms |
9720 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
4067 ms |
28152 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |