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 <stdio.h>
#include <vector>
#include <queue>
#include <algorithm>
#include <iostream>
#include <string>
#include <bitset>
#include <map>
#include <set>
#include <tuple>
#include <string.h>
#include <math.h>
#include <random>
#include <functional>
#include <assert.h>
#include <math.h>
#define all(x) (x).begin(), (x).end()
#define xx first
#define yy second
using namespace std;
template<typename T, typename Pr = less<T>>
using pq = priority_queue<T, vector<T>, Pr>;
using i64 = long long int;
using ii = pair<int, int>;
using ii64 = pair<i64, i64>;
vector<vector<int>> devise_strategy(int N) {
const int BIT_SIZE = 13;
vector<vector<int>> res(BIT_SIZE * 3 + 1, vector<int>(N + 1, 0));
for (int b = 0; b <= BIT_SIZE; b++)
{
res[b * 3][0] = 0;
for (int ai = 1; ai <= N; ai++)
{
if (b == BIT_SIZE)
{
if ((ai & (1 << (BIT_SIZE - b))) == 0)
res[b * 3][ai] = -1;
else
res[b * 3][ai] = -2;
}
else
{
if ((ai & (1 << (BIT_SIZE - b))) == 0)
res[b * 3][ai] = b * 3 + 1;
else
res[b * 3][ai] = b * 3 + 2;
}
}
if (b == BIT_SIZE)
break;
res[b * 3 + 1][0] = res[b * 3 + 2][0] = 1;
for (int bi = 1; bi <= N; bi++)
{
res[b * 3 + 1][bi] = (bi & (1 << (BIT_SIZE - b))) ? -1 : (b + 1) * 3;
res[b * 3 + 2][bi] = (bi & (1 << (BIT_SIZE - b))) ? (b + 1) * 3 : -2;
}
}
return res;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |