QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#429952 | #7281. How to Avoid Disqualification in 75 Easy Steps | AdamGS | 0 | 1ms | 3740kb | C++23 | 1.5kb | 2024-06-03 07:16:32 | 2024-06-03 07:16:32 |
answer
#include "avoid.h"
using namespace std;
typedef long long ll;
#define rep(a, b) for(int a = 0; a < (b); ++a)
#define st first
#define nd second
#define pb push_back
#define all(a) a.begin(), a.end()
pair<int,int>solve1(int x) {
int po=x, ko=1001;
while(po<ko) {
int sr=(po+ko)/2;
vector<int>P;
for(int i=po; i<=sr; ++i) P.pb(i);
send(P);
vector<int>T=wait();
if(T[0]) ko=sr; else po=sr+1;
}
return {po, po};
}
pair<int,int>solve2() {
int a=solve1(1).st;
int b=solve1(a+1).st;
if(b==1001) b=a;
return {a, b};
}
pair<int,int>solve3() {
rep(i, 10) {
vector<int>A, B;
for(int j=1; j<=1000; ++j) if(j&(1<<i)) B.pb(j); else A.pb(j);
send(A);
send(B);
}
int x=0;
vector<int>T=wait(), P;
rep(i, 10) if(T[2*i] && T[2*i+1]) P.pb(i); else if(T[2*i+1]) x+=1<<i;
if(P.size()==0) return {x, x};
int a=x+(1<<P[0]), b=x;
if(P.size()==1) return {a, b};
rep(i, P.size()-1) {
vector<int>A;
for(int j=1; j<=1000; ++j) {
if((j&(1<<P[i])) && (j&(1<<P[i-1]))) A.pb(j);
if(!(j&(1<<P[i])) && !(j&(1<<P[i-1]))) A.pb(j);
}
send(A);
}
T=wait();
rep(i, T.size()) {
if(T[i]) {
if(a&(1<<P[i])) a+=1<<P[i+1]; else b+=1<<P[i+1];
} else {
if(a&(1<<P[i])) b+=1<<P[i+1]; else a+=1<<P[i+1];
}
}
return {a, b};
}
pair<int,int>scout(int r, int h) {
return solve1(1);
if(r==10) return solve1(1);
if(r==20) return solve2();
if(r==30) return solve3();
return {0, 0};
}
Details
Tip: Click on the bar to expand more detailed information
Subtask #1:
score: 0
Wrong Answer
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3484kb
input:
output:
result:
wrong answer Not correct
Subtask #2:
score: 0
Wrong Answer
Test #11:
score: 0
Wrong Answer
time: 1ms
memory: 3740kb
input:
\x14
output:
result:
wrong answer Not correct
Subtask #3:
score: 0
Wrong Answer
Test #66:
score: 0
Wrong Answer
time: 1ms
memory: 3532kb
input:
\x1e
output:
result:
wrong answer Not correct
Subtask #4:
score: 0
Wrong Answer
Test #120:
score: 0
Wrong Answer
time: 0ms
memory: 3544kb
input:
K
output:
result:
wrong answer Not correct