# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1040493 | byunjaewoo | How to Avoid Disqualification in 75 Easy Steps (CEOI23_avoid) | C++17 | 1 ms | 344 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "avoid.h"
#include <bits/stdc++.h>
using namespace std;
pair<int, int> scout(int R, int H) {
int a=0, b=0;
for(int i=0; i<10; i++) {
vector<int> T;
for(int j=1; j<=1000; j++) if(!(j&(1<<i))) T.push_back(j);
send(T);
}
for(int i=0; i<10; i++) {
vector<int> T;
for(int j=1; j<=1000; j++) if(j&(1<<i)) T.push_back(j);
send(T);
}
vector<int> T=wait();
vector<int> V;
int X[10][2]={0};
for(int i=0; i<10; i++) {
if(T[i]) X[i][0]=1;
if(T[10+i]) X[i][1]=1;
if(X[i][0] && X[i][1]) V.push_back(i);
if(!X[i][0]) a|=(1<<i), b|=(1<<i);
}
if(V.empty()) return {a, b};
for(int i=0; i<V.size()-1; i++) {
vector<int> t;
for(int j=1; j<=1000; j++) if((!(j&(1<<V[i]))) && (j&(1<<V[i+1]))) t.push_back(j);
send(t);
}
vector<int> T2=wait();
b|=(1<<V[0]);
for(int i=0; i<V.size()-1; i++) {
if(a&(1<<V[i])) {
if(!T2[i]) a|=(1<<V[i+1]);
else b|=(1<<V[i+1]);
}
else {
if(T2[i]) a|=(1<<V[i+1]);
else b|=(1<<V[i+1]);
}
}
return {a, b};
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |