QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#462298#4565. Rarest Insectsq258233q0 15ms4084kbC++141.6kb2024-07-03 17:11:492024-07-03 17:11:49

Judging History

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

  • [2024-07-03 17:11:49]
  • 评测
  • 测评结果:0
  • 用时:15ms
  • 内存:4084kb
  • [2024-07-03 17:11:49]
  • 提交

answer

#include "insects.h"
#include<bits/stdc++.h>

namespace Sol{

using namespace std;
using ll=long long;
using u64=unsigned long long;
//using lll=__int128_t;
using lf=long double;
using Pr=pair<int,int>;
#define F(i,l,r) for(ll i=l;i<=ll(r);++i)
#define G(i,r,l) for(ll i=r;i>=ll(l);--i)
#define ct const
#define il inline
#define pb push_back
#define fi first
#define se second
#define mkr make_pair
template<class T>
il void tomn(T&x,T ct&y){y<x?x=y,0:0;}
template<class T>
il void tomx(T&x,T ct&y){x<y?x=y,0:0;}
#define dbg(...) fprintf(stderr,__VA_ARGS__)
#define CUT dbg("===================\n")
ct lf EPS=1e-10L;
il int dcmp(lf x){return fabs(x)<=EPS?0:(x<0?-1:1);}
ct ll INF=4e18L;
//ct int INF=1.02e9;
//il void rd(int&x){scanf("%d",&x);}
//il void rd(ll&x){scanf("%lld",&x);}

void ins(int i){move_inside(i);}
void del(int i){move_outside(i);}
int qry(){return press_button();}

ct int N=2050;
int n,m;
bitset<N>vis,res;
int qry(int lim){
	res.reset();
	int ret=0;
	F(i,0,n-1)if(vis[i]){
		ins(i);
		if(qry()>lim)del(i);
		else res[i]=1,++ret;
	}
	F(i,0,n-1)if(res[i])del(i);
	return ret;
}
void wt(){
	F(i,0,n-1)dbg("%d",(int)vis[i]);
	dbg("\n");
}
int main(){
	F(i,0,n-1)vis[i]=1;
	m=qry(1),vis^=res;
	
//	wt();
	dbg("m=%d\n",m);
	
	int ans=1;
	while(n=vis.count(),n>=m){
		int lim=n/(2*m);
		if(n-m*lim>m*(lim+1)-1)++lim;
		
//		CUT;
//		dbg("lim=%d\n",lim);
//		wt();
		
		int tmp=qry(lim);
		if(tmp<m*lim)vis=res;
		else vis^=res,ans+=lim;
		
//		wt();
//		CUT;
		
//		F(i,0,1e8);
	}
	return ans;
}

}//namespace Sol

int min_cardinality(int N) {
	Sol::n=N;
  return Sol::main();
}

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: 3824kb

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
1 0
8
1 1
8
1 2
8
3 1

result:

ok 

Test #2:

score: -10
Wrong Answer
time: 1ms
memory: 3816kb

input:

2
1
2

output:

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

result:

wrong answer Wrong answer.

Subtask #2:

score: 0
Wrong Answer

Test #24:

score: 0
Wrong Answer
time: 15ms
memory: 3904kb

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: 4084kb

input:

2
1
2

output:

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

result:

wrong answer Wrong answer.