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 <bits/stdc++.h>
#include <vector>
#define pb push_back
using namespace std;
std::vector<std::vector<int>> devise_strategy(int N) {
int n=N;
std::vector<std::vector<int>> v;
vector<int> newv;
// 0 1-9
newv.pb(0);
/*1-9
10-18
19-26*/
for(int i=1;i<=n;i++){
int s=256;
if((s&i))
newv.pb(9);
else
newv.pb(18);
}
v.pb(newv);
newv.clear();
for(int k=1;k<=9;k++){
newv.pb(1);
for(int i=1;i<=n;i++){
int y=pow(2,k-1);
if((y&i))
newv.pb(18+k-1);
else
newv.pb(-2);
}
v.pb(newv);
newv.clear();
}
for(int k=10;k<=18;k++){
newv.pb(1);
for(int i=1;i<=n;i++){
int y=pow(2,k-10);
if((y&i))
newv.pb(-1);
else
newv.pb(18+k-10);
}
v.pb(newv);
newv.clear();
}
for(int k=19;k<=26;k++){
newv.pb(0);
for(int i=1;i<=n;i++){
int y=pow(2,k-19);
if((y&i))
newv.pb(k-18);
else
newv.pb(k-9);
}
v.pb(newv);
newv.clear();
}
return v;
}
/*
8 8 16
8 8 16
*/
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |