QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#462295 | #4565. Rarest Insects | q258233q | 0 | 66ms | 4068kb | C++14 | 1.6kb | 2024-07-03 17:10:03 | 2024-07-03 17:10:04 |
Judging History
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((int)vis.count()>=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: 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 3 8 1 4 8 3 1
result:
ok
Test #2:
score: 0
Accepted
time: 1ms
memory: 3800kb
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 3 2
result:
ok
Test #3:
score: 0
Accepted
time: 0ms
memory: 3728kb
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: 4056kb
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: 1ms
memory: 3768kb
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 2 8 1 3 8 3 2
result:
ok
Test #6:
score: 0
Accepted
time: 1ms
memory: 3792kb
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 2 8 1 6 8 3 1
result:
ok
Test #7:
score: -10
Wrong Answer
time: 39ms
memory: 3864kb
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 Too many queries.
Subtask #2:
score: 0
Wrong Answer
Test #24:
score: 0
Wrong Answer
time: 47ms
memory: 3776kb
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 Too many queries.
Subtask #3:
score: 0
Wrong Answer
Test #43:
score: 75
Accepted
time: 1ms
memory: 4068kb
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 3 2
result:
ok
Test #44:
score: 75
Accepted
time: 1ms
memory: 4068kb
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: 1ms
memory: 3792kb
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: 0
Wrong Answer
time: 66ms
memory: 3776kb
input:
6 1 2 1 2 2 2 1 2 3 3 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 ...
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 1 8 1 3 8 0 1 8 2 8 0 3 8 2 8 1 1 8 1 3 8 0 1 8 2 8 0 3 8 2 8 1 1 8 1 3 8 0 1 8 2 8 0 3 8 2 8 1 1 8 1 3 8 0 1 8 2 8 0 3 8 2 8 1 1 8 1 3 8 0 1 8 2 8 ...
result:
wrong answer Too many queries.