이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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 = 23;
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)
{
if(i == 22)
{
forn(1, j, n)
{
int t = j % 3;
if(t == 0) ans[i][j] = -(ans[i][0] + 1);
else ans[i][j] = -((ans[i][0] ^ 1) + 1);
}
continue;
}
if(i == 23)
{
forn(1, j, n)
{
int t = j % 3;
if(t <= 1) ans[i][j] = -((ans[i][0]) + 1);
else ans[i][j] = -((ans[i][0]) + 1);
}
continue;
}
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
{
int put = ((i - 1) / 3 + 1) * 3 + t2 + 1;
if(put <= 21) ans[i][j] = put;
else
if(put == 23) ans[i][j] = 22;
else if(put == 24) ans[i][j] = 23;
else ans[i][j] = -(ans[i][0] + 1);
}
}
}
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... |