#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 |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
2 ms |
340 KB |
Output is correct |
5 |
Correct |
2 ms |
340 KB |
Output is correct |
6 |
Correct |
2 ms |
340 KB |
Output is correct |
7 |
Correct |
0 ms |
212 KB |
Output is correct |
8 |
Correct |
1 ms |
340 KB |
Output is correct |
9 |
Correct |
2 ms |
340 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
292 KB |
Output is correct |
5 |
Correct |
2 ms |
340 KB |
Output is correct |
6 |
Correct |
2 ms |
340 KB |
Output is correct |
7 |
Correct |
1 ms |
212 KB |
Output is correct |
8 |
Correct |
1 ms |
212 KB |
Output is correct |
9 |
Correct |
2 ms |
296 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Partially correct |
0 ms |
212 KB |
Output is partially correct |
3 |
Partially correct |
0 ms |
212 KB |
Output is partially correct |
4 |
Partially correct |
5 ms |
596 KB |
Output is partially correct |
5 |
Partially correct |
10 ms |
948 KB |
Output is partially correct |
6 |
Partially correct |
11 ms |
1064 KB |
Output is partially correct |
7 |
Partially correct |
12 ms |
1092 KB |
Output is partially correct |
8 |
Partially correct |
1 ms |
212 KB |
Output is partially correct |
9 |
Partially correct |
2 ms |
340 KB |
Output is partially correct |
10 |
Partially correct |
2 ms |
340 KB |
Output is partially correct |
11 |
Partially correct |
7 ms |
596 KB |
Output is partially correct |
12 |
Partially correct |
12 ms |
812 KB |
Output is partially correct |