QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#527927 | #4565. Rarest Insects | arbuzick# | 0 | 25ms | 4140kb | C++20 | 1.2kb | 2024-08-22 22:55:34 | 2024-08-22 22:55:34 |
Judging History
answer
#include "insects.h"
#include <bits/stdc++.h>
using namespace std;
int min_cardinality(int n) {
set<int> nw;
for (int i = 0; i < n; ++i) {
move_inside(i);
nw.insert(i);
if (press_button() != 1) {
move_outside(i);
nw.erase(i);
}
}
int cnt_of_types = nw.size();
if (cnt_of_types == 1) {
return n;
}
int l = 1, r = n;
while (l < r - 1) {
int m = (l + r) / 2;
vector<int> added;
for (int i = 0; i < n; ++i) {
if (!nw.count(i)) {
move_inside(i);
nw.insert(i);
if (press_button() > m) {
move_outside(i);
nw.erase(i);
} else {
added.push_back(i);
}
}
}
if (nw.size() != cnt_of_types * m) {
int diff = cnt_of_types * m - (int)nw.size() - 1;
r = m - diff / (cnt_of_types - 1);
for (auto insect : added) {
move_outside(insect);
nw.erase(insect);
}
} else {
l = m;
}
}
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: 4112kb
input:
6 1 1 1 2 2 2 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 0 3 8 2 8 0 4 8 2 8 0 5 8 2 8 1 3 8 1 4 8 1 5 8 3 1
result:
ok
Test #2:
score: 10
Accepted
time: 0ms
memory: 3896kb
input:
2 1 2
output:
8 0 0 8 2 8 0 1 8 2 8 1 1 8 3 2
result:
ok
Test #3:
score: 10
Accepted
time: 0ms
memory: 4116kb
input:
2 1 1
output:
8 0 0 8 2 8 0 1 8 2 8 3 1
result:
ok
Test #4:
score: 10
Accepted
time: 0ms
memory: 3860kb
input:
3 1 1 2 2
output:
8 0 0 8 2 8 0 1 8 2 8 0 2 8 2 8 1 2 8 0 2 8 2 8 1 2 8 3 1
result:
ok
Test #5:
score: 10
Accepted
time: 1ms
memory: 3824kb
input:
5 1 1 2 2 2 2 2 3 2 2 3
output:
8 0 0 8 2 8 0 1 8 2 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 2 8 2 8 0 3 8 2 8 0 4 8 2 8 1 2 8 1 3 8 1 4 8 0 2 8 2 8 0 3 8 2 8 0 4 8 2 8 1 4 8 3 2
result:
ok
Test #6:
score: 10
Accepted
time: 1ms
memory: 4112kb
input:
8 1 1 2 2 2 2 2 1 2 3 4 5 4
output:
8 0 0 8 2 8 0 1 8 2 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 0 2 8 2 8 0 3 8 2 8 0 4 8 2 8 0 5 8 2 8 1 5 8 0 6 8 2 8 1 2 8 1 3 8 1 4 8 1 6 8 3 1
result:
ok
Test #7:
score: 10
Accepted
time: 2ms
memory: 3820kb
input:
199 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:
ok
Test #8:
score: 10
Accepted
time: 1ms
memory: 3824kb
input:
200 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...
output:
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 0 6 8 2 8 0 7 8 2 8 0 8 8 2 8 0 9 8 2 8 0 10 8 2 8 0 11 8 2 8 0 12 8 2 8 0 13 8 2 8 0 14 8 2 8 0 15 8 2 8 0 16 8 2 8 0 17 8 2 8 0 18 8 2 8 0 19 8 2 8 0 20 8 2 8 0 21 8 2 8 0 22 8 2 8 0 23 8 2 8 0 24 8 2 8 0 25 8 2 8 0 26 8 2 8 0 27 8 2 8 ...
result:
ok
Test #9:
score: 0
Wrong Answer
time: 6ms
memory: 4132kb
input:
200 1 1 1 2 1 2 1 2 2 2 1 1 1 1 1 2 2 2 2 2 2 2 2 1 2 2 2 2 2 2 2 2 2 1 1 2 2 2 2 2 2 2 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 ...
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 0 5 8 2 8 1 5 8 0 6 8 2 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 0 11 8 2 8 0 12 8 2 8 0 13 8 2 8 0 14 8 2 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 0 18 8 2 8 1 18 8 0 19 8 2 8 1 19 8 0 20 8 2 8 1 20 8 0 21 ...
result:
wrong answer Wrong answer.
Subtask #2:
score: 0
Wrong Answer
Test #24:
score: 15
Accepted
time: 2ms
memory: 4084kb
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:
ok
Test #25:
score: 15
Accepted
time: 3ms
memory: 3864kb
input:
1000 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1...
output:
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 0 6 8 2 8 0 7 8 2 8 0 8 8 2 8 0 9 8 2 8 0 10 8 2 8 0 11 8 2 8 0 12 8 2 8 0 13 8 2 8 0 14 8 2 8 0 15 8 2 8 0 16 8 2 8 0 17 8 2 8 0 18 8 2 8 0 19 8 2 8 0 20 8 2 8 0 21 8 2 8 0 22 8 2 8 0 23 8 2 8 0 24 8 2 8 0 25 8 2 8 0 26 8 2 8 0 27 8 2 8 ...
result:
ok
Test #26:
score: 0
Wrong Answer
time: 25ms
memory: 4140kb
input:
999 1 1 1 1 1 1 1 1 1 2 1 1 1 1 2 2 1 1 1 1 1 1 2 2 2 2 2 2 2 2 1 2 2 1 2 2 2 2 1 1 1 1 2 2 1 2 1 1 2 2 2 1 2 2 2 2 2 2 2 2 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 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 ...
output:
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 0 6 8 2 8 0 7 8 2 8 0 8 8 2 8 0 9 8 2 8 1 9 8 0 10 8 2 8 0 11 8 2 8 0 12 8 2 8 0 13 8 2 8 0 14 8 2 8 1 14 8 0 15 8 2 8 1 15 8 0 16 8 2 8 0 17 8 2 8 0 18 8 2 8 0 19 8 2 8 0 20 8 2 8 0 21 8 2 8 0 22 8 2 8 1 22 8 0 23 8 2 8 1 23 8 0 24 8 2 8...
result:
wrong answer Wrong answer.
Subtask #3:
score: 0
Wrong Answer
Test #43:
score: 75
Accepted
time: 1ms
memory: 4124kb
input:
2 1 2
output:
8 0 0 8 2 8 0 1 8 2 8 1 1 8 3 2
result:
ok
Test #44:
score: 75
Accepted
time: 1ms
memory: 3820kb
input:
2 1 1
output:
8 0 0 8 2 8 0 1 8 2 8 3 1
result:
ok
Test #45:
score: 75
Accepted
time: 1ms
memory: 3904kb
input:
3 1 1 2 2
output:
8 0 0 8 2 8 0 1 8 2 8 0 2 8 2 8 1 2 8 0 2 8 2 8 1 2 8 3 1
result:
ok
Test #46:
score: 75
Accepted
time: 1ms
memory: 3816kb
input:
6 1 2 1 2 2 2 2 3 4 4
output:
8 0 0 8 2 8 0 1 8 2 8 1 1 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 0 1 8 2 8 0 3 8 2 8 0 4 8 2 8 1 4 8 0 5 8 2 8 1 5 8 1 1 8 1 3 8 3 1
result:
ok
Test #47:
score: 75
Accepted
time: 1ms
memory: 4116kb
input:
10 1 1 2 2 2 2 2 2 2 2 2 3 3 3 4 4 5 6 2 3 3 3 4 4 4 4 4 4 5 5
output:
8 0 0 8 2 8 0 1 8 2 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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 2 8 0 24 8 2 8...
result:
wrong answer Wrong answer.