QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#47467 | #4565. Rarest Insects | zhouhuanyi | 0 | 36ms | 3820kb | C++11 | 1.1kb | 2022-09-10 09:22:35 | 2022-09-10 09:22:37 |
Judging History
answer
#include "insects.h"
#include <iostream>
#include <vector>
#include <algorithm>
#define SN 2000
using namespace std;
int scnt,ans;
bool used[SN+1];
void solve(int l,int r,vector<int>p,int op)
{
if (l==r)
{
ans=l;
return;
}
vector<int>A;
vector<int>B;
int mid=(l+r)>>1,res,ps=0;
if (op)
{
for (int j=0;j<op;++j) A.push_back(p[j]);
}
for (int i=op;i<p.size();++i)
{
move_inside(p[i]),res=press_button();
if (res>mid-l+1) move_outside(p[i]),B.push_back(p[i]);
else
{
A.push_back(p[i]);
if (res<((mid-l+1)>>1)) ps=A.size();
}
}
for (int i=(int)(A.size())-1;i>=ps;--i) move_outside(A[i]);
if (A.size()<scnt*(mid-l+1)) solve(l,mid,A,ps);
else move_outside(A[0]),solve(mid+1,r,B,0);
return;
}
int min_cardinality(int N)
{
vector<int>p;
int res;
for (int i=0;i<N;++i)
{
move_inside(i),res=press_button();
if (res>1) move_outside(i),p.push_back(i);
else scnt++,used[i]=1;
}
for (int i=0;i<N;++i)
if (used[i])
move_outside(i);
solve(1,N/scnt,p,0);
return ans;
}
Details
Tip: Click on the bar to expand more detailed information
Subtask #1:
score: 0
Wrong Answer
Test #1:
score: 10
Accepted
time: 3ms
memory: 3796kb
input:
6 1 1 1 2 2 2 1 1 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 1 0 8 1 1 8 1 2 8 0 3 8 2 8 0 4 8 2 8 0 5 8 2 8 1 5 8 1 4 8 1 3 8 3 1
result:
ok
Test #2:
score: 0
Accepted
time: 2ms
memory: 3696kb
input:
2 1 2 1
output:
8 0 0 8 2 8 0 1 8 2 8 1 1 8 1 0 8 0 1 8 2 8 1 1 8 1 1 8 3 2
result:
ok
Test #3:
score: 0
Accepted
time: 2ms
memory: 3680kb
input:
2 1 1
output:
8 0 0 8 2 8 0 1 8 2 8 1 0 8 1 1 8 3 1
result:
ok
Test #4:
score: 0
Accepted
time: 0ms
memory: 3680kb
input:
3 1 1 2
output:
8 0 0 8 2 8 0 1 8 2 8 0 2 8 2 8 1 2 8 1 0 8 1 1 8 3 1
result:
ok
Test #5:
score: 0
Accepted
time: 0ms
memory: 3700kb
input:
5 1 1 2 2 2 1 1 2
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 1 0 8 1 1 8 0 2 8 2 8 0 3 8 2 8 0 4 8 2 8 1 4 8 1 3 8 1 2 8 1 2 8 3 2
result:
ok
Test #6:
score: 0
Accepted
time: 2ms
memory: 3780kb
input:
8 1 1 2 2 2 2 2 1 1 2 2 2 1
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 0 8 1 1 8 1 7 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 6 8 2 8 1 6 8 1 2 8 3 1
result:
ok
Test #7:
score: -10
Wrong Answer
time: 10ms
memory: 3768kb
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:
wrong answer Wrong answer.
Subtask #2:
score: 0
Wrong Answer
Test #24:
score: 0
Wrong Answer
time: 28ms
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: 75
Accepted
time: 3ms
memory: 3732kb
input:
2 1 2 1
output:
8 0 0 8 2 8 0 1 8 2 8 1 1 8 1 0 8 0 1 8 2 8 1 1 8 1 1 8 3 2
result:
ok
Test #44:
score: 75
Accepted
time: 1ms
memory: 3780kb
input:
2 1 1
output:
8 0 0 8 2 8 0 1 8 2 8 1 0 8 1 1 8 3 1
result:
ok
Test #45:
score: 75
Accepted
time: 0ms
memory: 3776kb
input:
3 1 1 2
output:
8 0 0 8 2 8 0 1 8 2 8 0 2 8 2 8 1 2 8 1 0 8 1 1 8 3 1
result:
ok
Test #46:
score: 75
Accepted
time: 2ms
memory: 3624kb
input:
6 1 2 1 2 2 2 1 2 3 3 1 2
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 1 0 8 1 2 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 3 8 1 1 8 0 1 8 2 8 0 3 8 2 8 1 3 8 1 1 8 3 1
result:
ok
Test #47:
score: 75
Accepted
time: 2ms
memory: 3684kb
input:
10 1 1 2 2 2 2 2 2 2 2 1 2 2 2 3 3 4 4 1 2
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 8 8 0 9 8 2 8 1 9 8 1 0 8 1 1 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 1 8 8 0 9 8 2 8 1 9 8 1 7 8 1 6 8 1 5 8 1 4 8 1 3 8 1 2 8 1 2 8 0 8 ...
result:
ok
Test #48:
score: 0
Wrong Answer
time: 36ms
memory: 3820kb
input:
2000 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