Submission #1267134

#TimeUsernameProblemLanguageResultExecution timeMemory
1267134silentloopPrisoner Challenge (IOI22_prison)C++20
0 / 100
0 ms320 KiB
#include <bits/stdc++.h> #define ll long long #define sz(x) int(x.size()) #define all(x) x.begin(),x.end() #define fr first #define se second #define pb push_back #define mp make_pair using namespace std; int con(ll x) { if(x==1) return 2; return 1; } std::vector<std::vector<int>> devise_strategy(int N) { ll i, j, ab=1, bit=7, sig=1, val, tam=25, aBit, aVal; vector<int>pot(9,1); for(i=1; i<=bit; i++) pot[i]=pot[i-1]*3; vector<vector<int>>ans(tam,vector<int>(N+1,0)); for(i=1; i<tam; i+=3) { for(j=0; j<3; j++) ans[i+j][0]=ab; ab=con(ab+1)-1; } for(i=1; i<=N; i++) { val=(i/pot[bit])%3; ans[0][i]=sig+val; } aBit=bit; bit--; sig+=3; for(j=1; j<tam; j++) { for(i=1; i<=N; i++) { val=(i/pot[aBit])%3; aVal=(j-1)%3; if(val<aVal) ans[j][i]=-(ans[j][0]+1); else if(val>aVal) ans[j][i]=-con(ans[j][0]+1); else { val=(i/pot[bit])%3; ans[j][i]=sig+val; } } if(j%3==0) { aBit=bit; bit--; sig+=3; } } for(i=1; i<=N; i++) { if(ans[24][i]>=25) ans[24][i]=-1; if(ans[23][i]>=25) ans[23][i]=-1; if(ans[22][i]>=25) ans[22][i]=-1; } /*for(i=0; i<sz(ans); i++) { for(j=0; j<sz(ans[i]); j++) cout << ans[i][j] << ' '; cout << '\n'; }*/ return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...