QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#526449 | #4565. Rarest Insects | green_gold_dog# | 0 | 5ms | 4076kb | C++20 | 1.1kb | 2024-08-21 16:07:28 | 2024-08-21 16:07:28 |
answer
#include "insects.h"
#include<bits/stdc++.h>
using namespace std;
typedef int ll;
random_device rd;
mt19937 rnd(rd());
ll min_cardinality(ll n) {
vector<ll> fir, sec;
for (ll i = 0; i < n; i++) {
move_inside(i);
if (press_button() == 2) {
move_outside(i);
sec.push_back(i);
} else {
fir.push_back(i);
}
}
bool b = rnd() % 4 == 0;
ll cr = fir.size();
ll l = 1, r = n / cr + 1;
while (r - l > 1) {
ll mid = (l + r) / 2;
vector<ll> nfir, nsec;
vector<ll> nnfir;
for (auto i : sec) {
if (nfir.size() + fir.size() < mid * cr) {
nnfir.push_back(i);
continue;
}
move_inside(i);
if (press_button() == mid + 1) {
move_outside(i);
nsec.push_back(i);
} else {
nfir.push_back(i);
}
}
if (nfir.size() + fir.size() == mid * cr) {
sec = nsec;
for (auto i : nfir) {
fir.push_back(i);
}
l = mid;
} else {
for (auto i : nfir) {
move_outside(i);
}
sec = nfir;
for (auto i : nnfir) {
sec.push_back(i);
}
r = mid;
}
r = min(r, (ll)(fir.size() + sec.size()) / cr + 1);
}
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: 1ms
memory: 3776kb
input:
6 1 1 1 2 2 2
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 3 1
result:
ok
Test #2:
score: 0
Wrong Answer
time: 1ms
memory: 4076kb
input:
2 1 2
output:
8 0 0 8 2 8 0 1 8 2 8 1 1 8 3 1
result:
wrong answer Wrong answer.
Subtask #2:
score: 0
Wrong Answer
Test #24:
score: 0
Wrong Answer
time: 5ms
memory: 3816kb
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
output:
8 0 0 8 2 8 0 1 8 2 8 1 1 8 3 1
result:
wrong answer Wrong answer.