QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#141793 | #4565. Rarest Insects | valerikk# | 0 | 1ms | 4092kb | C++17 | 1.1kb | 2023-08-18 00:39:04 | 2024-07-04 01:47:11 |
answer
#include "insects.h"
#include <bits/stdc++.h>
using namespace std;
namespace {
int n;
}
int min_cardinality(int grdn) {
n = grdn;
vector<int> diff;
for (int i = 0; i < n; ++i) {
move_inside(i);
if (press_button() == 2) {
move_outside(i);
} else {
diff.push_back(i);
}
}
for (int i : diff) {
move_outside(i);
}
vector<int> kek;
for (int i = 0; i < n; ++i) {
kek.push_back(i);
}
int ret = 0;
int l = 1, r = n + 1;
while (r - l > 1 && !kek.empty()) {
int mid = (l + r) / 2;
vector<int> cur;
for (int i : kek) {
move_inside(i);
if (press_button() > mid) {
move_outside(i);
} else {
cur.push_back(i);
}
}
if ((int)cur.size() == (int)diff.size() * mid) {
vector<int> kek1;
for (int i : kek) {
if (!binary_search(cur.begin(), cur.end(), i)) {
kek1.push_back(i);
}
}
ret += mid;
kek = kek1;
if (kek.empty()) {
break;
}
l = mid + 1;
l -= mid;
r -= mid;
} else {
r = mid;
}
for (int i : cur) {
move_outside(i);
}
}
if (!kek.empty()) {
ret += l;
}
return l;
}
Details
Tip: Click on the bar to expand more detailed information
Subtask #1:
score: 0
Wrong Answer
Test #1:
score: 10
Accepted
time: 0ms
memory: 3772kb
input:
6 1 1 1 2 2 2 1 1 1 2 2 3 1 1 1 2 2 3
output:
8 0 0 8 2 8 0 1 8 2 8 0 2 8 2 8 0 3 8 2 8 1 3 8 0 4 8 2 8 1 4 8 0 5 8 2 8 1 5 8 1 0 8 1 1 8 1 2 8 0 0 8 2 8 0 1 8 2 8 0 2 8 2 8 0 3 8 2 8 0 4 8 2 8 0 5 8 2 8 1 0 8 1 1 8 1 2 8 1 3 8 1 4 8 1 5 8 0 0 8 2 8 0 1 8 2 8 0 2 8 2 8 0 3 8 2 8 0 4 8 2 8 0 5 8 2 8 1 5 8 1 0 8 1 1 8 1 2 8 1 3 8 1 4 8 3 1
result:
ok
Test #2:
score: -10
Wrong Answer
time: 1ms
memory: 4092kb
input:
2 1 2 1 2
output:
8 0 0 8 2 8 0 1 8 2 8 1 1 8 1 0 8 0 0 8 2 8 0 1 8 2 8 3 1
result:
wrong answer Wrong answer.
Subtask #2:
score: 0
Wrong Answer
Test #24:
score: 0
Wrong Answer
time: 0ms
memory: 3804kb
input:
1000 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2...
output:
8 0 0 8 2 8 0 1 8 2 8 1 1 8 0 2 8 2 8 1 2 8 0 3 8 2 8 1 3 8 0 4 8 2 8 1 4 8 0 5 8 2 8 1 5 8 0 6 8 2 8 1 6 8 0 7 8 2 8 1 7 8 0 8 8 2 8 1 8 8 0 9 8 2 8 1 9 8 0 10 8 2 8 1 10 8 0 11 8 2 8 1 11 8 0 12 8 2 8 1 12 8 0 13 8 2 8 1 13 8 0 14 8 2 8 1 14 8 0 15 8 2 8 1 15 8 0 16 8 2 8 1 16 8 0 17 8 2 8 1 17 8 ...
result:
wrong answer Wrong answer.
Subtask #3:
score: 0
Wrong Answer
Test #43:
score: 0
Wrong Answer
time: 1ms
memory: 3804kb
input:
2 1 2 1 2
output:
8 0 0 8 2 8 0 1 8 2 8 1 1 8 1 0 8 0 0 8 2 8 0 1 8 2 8 3 1
result:
wrong answer Wrong answer.