QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#44167#4565. Rarest Insectsvme500 3ms3876kbC++17695b2022-08-13 12:04:132022-08-13 12:32:39

Judging History

你现在查看的是最新测评结果

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2022-08-13 12:32:39]
  • 评测
  • 测评结果:0
  • 用时:3ms
  • 内存:3876kb
  • [2022-08-13 12:04:13]
  • 提交

answer

#include "insects.h"
#include <bits/stdc++.h>
using namespace std;
const int MAXN=1e5+5;
int l,r,cnt,cnt1;bool vs[MAXN],vs1[MAXN];
void ins(int x) {move_inside(x-1);}
void dlt(int x) {move_outside(x-1);}
int qry() {return press_button();}
int min_cardinality(int n)
{
	for(int i=1;i<=n;++i) {ins(i);if(qry()>1) dlt(i);else vs[i]=1,++cnt;}l=2;r=n/cnt;
	while(l<=r)
	{
		int mid=(l+r)/2;cnt1=0;for(int i=1;i<=n;++i) vs1[i]=0;
		for(int i=1;i<=n;++i) if(!vs[i])
		{ins(i);if(qry()>mid) dlt(i);else vs1[i]=1,++cnt1;}
		if(cnt*mid<=cnt1) {l=mid+1;for(int i=1;i<=n;++i) if(vs1[i]) vs[i]=1;}
		else {r=mid-1;for(int i=1;i<=n;++i) if(vs1[i]) dlt(i),--cnt1;else vs[i]=1;}
	}return r;
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 0
Wrong Answer

Test #1:

score: 10
Accepted
time: 2ms
memory: 3876kb

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 5
8
1 3
8
1 4
8
3 1

result:

ok 

Test #2:

score: -10
Wrong Answer
time: 3ms
memory: 3864kb

input:

2
1
2
2

output:

8
0 0
8
2
8
0 1
8
2
8
1 1
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: 2ms
memory: 3852kb

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: 0ms
memory: 3684kb

input:

2
1
2
2

output:

8
0 0
8
2
8
0 1
8
2
8
1 1
8
0 1
8
2
8
1 1
8
3 1

result:

wrong answer Wrong answer.