# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
629039 | Red_Inside | Prisoner Challenge (IOI22_prison) | C++17 | 0 ms | 0 KiB |
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 "prison.h"
//
#include <bits/stdc++.h>
#define ll long long
#define f first
#define s second
#define pb push_back
#define mp make_pair
#define o cout<<"BUG"<<endl;
#define FOR(i, j, n) for(int j = i; j < n; ++j)
#define forn(i, j, n) for(int j = i; j <= n; ++j)
#define nfor(i, j, n) for(int j = n; j >= i; --j)
#define sortv(vv) sort(vv.begin(), vv.end())
#define all(v) v.begin(), v.end()
#define ld long double
#define ull unsigned long long
using namespace std;
const int maxn=500+10,LOG=17, mod=1e9+7;
int block = 320, timer = 0;
const ld EPS = 1e-18;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#define IOS ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define bt(i) (1 << (i))
//#define int ll
const int inf=1e9+10;
#define y1 yy
#define prev pre
#define pii pair <int, int>
vector<vector<int> > devise_strategy(int n) {
vector <vector <int> > ans;
int x = 24
ans.assign(x+1, {});
forn(0, i, x)
{
ans[i].assign(n+ 1, 0);
}
ans[0][0] = 0;
forn(1, i, x)
{
//0 1 2 3 4 5 6 7 8 9 10
//0 1 1 1 0 0 0
if((i-1) / 3 % 2 == 0)
ans[i][0] = 1;
else
ans[i][0] = 0;
}
forn(1, j, n)
{
int t = j;
forn(1, iter, 7)
{
t /= 3;
}
t %= 3;
ans[0][j] = t + 1;
}
forn(1, i, x)
{
int num = 7 - (i - 1) / 3;
int bt = (i - 1) % 3;
forn(1, j, n)
{
int t = j;
forn(1, iter, num)
{
t /= 3;
}
t %= 3;
int t2 = j;
forn(1, iter, num - 1) t2 /= 3;
t2 %= 3;
if(t < bt) ans[i][j] = -(ans[i][0] + 1);
else if(t > bt) ans[i][j] = -((ans[i][0] ^ 1) + 1);
else if(((i - 1) / 3 + 1) * 3 + t2 + 1 <= x)
ans[i][j] = ((i - 1) / 3 + 1) * 3 + t2 + 1;
else
ans[i][j] = x;
}
}
return ans;
}