이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "prison.h"
#include <bits/stdc++.h>
#define MAX 300001
#define INF LLONG_MAX
#define MOD 1000000007
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define ins insert
#define ff first
#define ss second
#define gett(x,m) get<m>(x)
#define all(a) a.begin(),a.end()
#define lb(a,b) lower_bound(all(a),b)
#define ub(a,b) upper_bound(all(a),b)
#define sortv(a) sort(all(a))
#define sorta(a,sz) sort(a,a+sz)
#define inputar(a,b){\
for(int i=0;i<b;i++){\
cin >> a[i];\
}\
}
#define inputvec(a,b){\
for(int i=0;i<b;i++){\
ll num;\
cin >> num;\
a.pb(num);\
}\
}
#define outputar(a,b){\
for(int i=0;i<b;i++){\
cout << a[i] << " ";\
}\
cout << "\n";\
}
#define outputvec(a){\
for(auto x:a){\
cout << x << " ";\
}\
cout << "\n";\
}
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef tuple<ll,ll,ll> tll;
typedef pair<ll,ll> pll;
typedef double db;
typedef long double ldb;
inline void USACO(string filename){
freopen((filename+".in").c_str(),"r",stdin);
freopen((filename+".out").c_str(),"w",stdout);
}
vector<vector<int>> devise_strategy(int N) {
vector<vector<int>> v(23,vector<int>(N+1,0));
v[0][0]=0;
for(int i=1;i<=N;i++){
int d[10];
d[9]=0;
int num=i;
for(int z=8;z>=1;z--){
d[z]=num%3;
num/=3;
}
v[0][i]=d[1]*7+1;
}
for(int i=1;i<=22;i++){
int h,h2;
h=0;
if(i>14){
h=2;
}
else if(i>7){
h=1;
}
h2=i-h*7;
if(i==22){
h=1;
h2=8;
}
v[i][0]=h2%2;
for(int j=1;j<=N;j++){
int d[10];
d[9]=0;
int num=j;
for(int z=8;z>=1;z--){
d[z]=num%3;
num/=3;
}
if(h==d[h2]){
if(h2+1==8){
if(d[h2+1]==0){
v[i][j]=-h2%2-1;
}
else if(d[h2+1]==1){
v[i][j]=22;
}
else{
v[i][j]=h2%2-2;
}
}
else{
v[i][j]=h2+1+d[h2+1]*7;
}
}
else if(h>d[h2]){
v[i][j]=-h2%2-1;
}
else{
v[i][j]=h2%2-2;
}
}
}
return v;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |