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 "prison.h"
#include <algorithm>
#include <bitset>
#include <cstdint>
#include <cstring>
#include <iostream>
#include <limits.h>
#include <math.h>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
//#define int long long
#define loop(X, N) for(int X = 0; X < (N); X++)
#define all(V) V.begin(), V.end()
#define rall(V) V.rbegin(), V.rend()
using namespace std;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef vector<vector<ii>> vvii;
typedef vector<bool> vb;
typedef vector<vector<bool>> vvb;
vvi devise_strategy(int N) {
//13 + 4 + 4
//13:
//4: index of next bit to search in A
//4: highest set bit in first bag
//5000 * 13 * 13
//
vvi out(39, vi(N + 1));
loop(num, 39) {
if (num >= 13) {
out[num][0] = 1;
}
else {
out[num][0] = 0;
}
for (int value = 1; value <= N; value++) {
if (num < 13) {
int exp = 12 - num;
if (value & (1 << exp)) {
out[num][value] = 26 + num;
}
else {
out[num][value] = 13 + num;
}
}
else if (num < 26) {
int exp = 12 - (num - 13);
if (value & (1 << exp)) {
out[num][value] = -1;
}
else {
out[num][value] = num - 13 + 1;
}
}
else {
int exp = 12 - (num - 26);
if (value & (1 << exp)) {
out[num][value] = num - 26 + 1;
}
else {
out[num][value] = -2;
}
}
}
}
return out;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |