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 + 3, vector<int>(N + 1, 0));
for (int num = 0; num <= BIT_SIZE; num++)
{
int bit = (1 << (BIT_SIZE - num));
res[num][0] = 0;
for (int a = 1; a <= N; a++)
{
if ((a & bit) != 0)
res[num][a] = BIT_SIZE + 1 + num * 2 + 1;
else
res[num][a] = BIT_SIZE + 1 + num * 2;
}
}
for (int num = BIT_SIZE + 1; num < BIT_SIZE * 3 + 3; num++)
{
res[num][0] = 1;
int ahas = num % 2;
int bit = 1 << (BIT_SIZE - (num - BIT_SIZE - 1) / 2);
for (int b = 1; b <= N; b++)
{
int bhas = (b & bit) != 0 ? 1 : 0;
if (ahas == bhas)
res[num][b] = (num - BIT_SIZE - 1) / 2 + 1;
else if (ahas > bhas)
res[num][b] = -2;
else
res[num][b] = -1;
}
}
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... |