제출 #730578

#제출 시각아이디문제언어결과실행 시간메모리
730578Huseyn123죄수들의 도전 (IOI22_prison)C++17
80 / 100
12 ms1092 KiB
#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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...