#include "insects.h"
#include "bits/stdc++.h"
#define SZ(s) ((int) s.size())
using namespace std;
int min_cardinality(int n) {
std::vector<int> v_ids(n);
std::iota(v_ids.begin(), v_ids.end(), 0);
std::set<int> ids(v_ids.begin(), v_ids.end());
int freq = 0;
while (true) {
++freq;
std::set<int> new_ids;
for (int id : ids) {
move_inside(id);
if (press_button() > freq) {
move_outside(id);
new_ids.insert(id);
}
}
int unique_values = SZ(ids) - SZ(new_ids);
if (unique_values > SZ(new_ids)) {
return freq;
}
ids = std::move(new_ids);
}
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
208 KB |
Output is correct |
2 |
Correct |
0 ms |
208 KB |
Output is correct |
3 |
Correct |
1 ms |
208 KB |
Output is correct |
4 |
Correct |
1 ms |
208 KB |
Output is correct |
5 |
Incorrect |
1 ms |
208 KB |
Wrong answer. |
6 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
208 KB |
Output is correct |
2 |
Correct |
0 ms |
208 KB |
Output is correct |
3 |
Correct |
1 ms |
208 KB |
Output is correct |
4 |
Correct |
1 ms |
208 KB |
Output is correct |
5 |
Incorrect |
1 ms |
208 KB |
Wrong answer. |
6 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
208 KB |
Wrong answer. |
2 |
Halted |
0 ms |
0 KB |
- |