이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "prison.h"
#include <bits/stdc++.h>
//#pragma GCC optimize("O1,O2,O3,Ofast,unroll-loops")
#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 all(v) v.begin(), v.end()
#define ld long double
#define ull unsigned long long
using namespace std;
const int maxn=2e5+10,LOG=17,mod=1e9+7;
int block = 650, timer = 0;
const double eps = 1e-9;
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 long long inf=2e18;
#define y1 yy
#define pii pair <int, int>
int etot(int x)
{
return (x == 0 ? -1 : -2);
}
int oppo(int x)
{
return (x == 0 ? -2 : -1);
}
vector <vector <int> > devise_strategy(int n)
{
vector <vector <int> > turn(25);
forn(0, i, 24)
{
turn[i].assign(n+1, 0);
}
turn[0][0] = 0;
forn(1, x, n)
{
turn[0][x] = ((x>>12)&1)+1;
}
forn(1, i, 24)
{
turn[i][0] = ((i + 1) / 2 % 2 == 1 ? 1 : 0);
int btn = 12 - (i - 1) / 2;
int prevbit = (i % 2 == 1 ? 0 : 1);
forn(1, x, n)
{
int bit = ((x>>btn)&1);
if(bit > prevbit)
turn[i][x] = oppo(turn[i][0]);
else
if(bit < prevbit)
turn[i][x] = etot(turn[i][0]);
else
{
int nxtbit = ((x>>(btn-1))&1);
if(btn == 1)
{
if(nxtbit == 0)
turn[i][x] = etot(turn[i][0]);
else
turn[i][x] = oppo(turn[i][0]);
}
else
turn[i][x] = ((i-1)/2+1)*2+1+nxtbit;
}
}
}
return turn;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |