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;
vector<vector<int> > devise_strategy(int N){
vector<vector<int> > ans(40, vector<int>(N + 1));
ans[0][0] = 0;
for (int i = 3; i < 42; i++){
if(i % 3 == 2) ans[i - 2][0] = 0;
else ans[i - 2][0]=1;
}
for (int j = 1; j <= N; j++) ans[0][j] = 1 + ((j & (1 << 12)) != 0);
for (int i = 3; i < 42; i += 3){
for (int j = 1; j <= N; j++){
if(j & (1 << (12 - (i / 3 - 1)))) ans[i - 2][j] = -1;
else ans[i - 2][j] = i;
}
}
for (int i = 4; i < 42; i += 3){
for (int j = 1; j <= N; j++){
if((j & (1 << (12 - (i / 3 - 1)))) == 0) ans[i - 2][j]= -2;
else ans[i - 2][j] = i - 1;
}
}
for (int i = 5; i < 42; i += 3) for (int j = 1; j <= N; j++) ans[i - 2][j] = min(39, i - 1 + ((j & (1 << (12 - (i / 3)))) != 0));
return ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |