Submission #1076958

#TimeUsernameProblemLanguageResultExecution timeMemory
1076958Lalic죄수들의 도전 (IOI22_prison)C++17
0 / 100
4 ms688 KiB
#include "prison.h" #include <bits/stdc++.h> using namespace std; #define fi first #define se second #define pb push_back #define all(x) x.begin(), x.end() #define allr(x) x.rbegin(), x.rend() #define mp make_pair typedef long long ll; typedef pair<int, int> pii; typedef pair<ll, ll> pll; typedef complex<double> cd; vector<vector<int>> devise_strategy(int N) { vector<vector<int>> ans(27, vector<int>(N+1)); vector<int> pot(9); pot[0]=1; for(int i=1;i<=8;i++) pot[i]=3*pot[i-1]; for(int i=0;i<=25;i++){ if((i%8)&1) ans[i][0]=1; else ans[i][0]=0; int val=i/8, p=7-(i%9); for(int j=1;j<=N;j++){ int curr=(j/pot[p+1])%3; if(curr<val){ if((i%8)&1) ans[i][j]=-2; else ans[i][j]=-1; continue; } else if(curr>val){ if((i%8)&1) ans[i][j]=-1; else ans[i][j]=-2; continue; } if(p>=1) ans[i][j]=(7-p+1)+8*((j/pot[p])%3); else if(p>=0) ans[i][j]=8*((j/pot[p])%3); else ans[i][j]=1; } } //~ for(int i=0;i<=23;i++) //~ for(int j=0;j<=N;j++) //~ cout << i << " " << j << " -> " << ans[i][j] << "\n"; return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...