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 <bits/stdc++.h>
using namespace std;
#define ll long long
#define vll vector<ll>
#define all(x) begin(x),end(x)
std::vector<std::vector<int>> devise_strategy(int N)
{
vector<vector<int>> s;
for(int i=0;i<=51;i++)
{
s.push_back({});
if(i==0) // start by checking the bit in a
{
s[i].push_back(0);
int check=12;
for(int result=1;result<=N;result++)
{
bool p=(result&(1<<check));
// cout<<"For "<<i<<' '<<result<<' '<<(((check*2)+1)*2)+p<<endl;
s[i].push_back((((check*2)+1)*2)+p);
}
continue;
}
if(i&2) // now check bit in b
{
s[i].push_back(1);
int check=i/4;
bool oth=(i%2);
for(int result=1;result<=N;result++)
{
bool p=(result&(1<<check));
if(oth>p)
{
s[i].push_back(-2);
}
else if(oth<p)
{
s[i].push_back(-1);
}
else
{
if(check==0)
{
s[i].push_back(-1);
}
else
{
p=(result&(1<<(check-1)));
s[i].push_back(((((check-1)*2)+0)*2)+p);
}
}
}
}
else// now check bit in a
{
s[i].push_back(0);
int check=i/4;
bool oth=(i%2);
for(int result=1;result<=N;result++)
{
bool p=(result&(1<<check));
if(oth>p)
{
s[i].push_back(-1);
}
else if(oth<p)
{
s[i].push_back(-2);
}
else
{
if(check==0)
{
s[i].push_back(-1);
}
else
{
p=(result&(1<<(check-1)));
s[i].push_back(((((check-1)*2)+1)*2)+p);
}
}
}
// for(int result=1;result<=N;result++)
// {
// bool p=(result&(1<<check));
// cout<<"For "<<i<<' '<<result<<' '<<(((check*2)+1)*2)+p<<endl;
// s[i].push_back(((((check)*2)+1)*2)+p);
// }
}
}
return s;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |