Submission #1039321

#TimeUsernameProblemLanguageResultExecution timeMemory
1039321Marco_EscandonPrisoner Challenge (IOI22_prison)C++17
0 / 100
1 ms348 KiB
#include "prison.h" #include<bits/stdc++.h> using namespace std; typedef long long ll; vector<ll> B={3, 3, 3, 3, 3, 3, 3, 3}; int digit(int x, int y){ y--; for(int i=8; i>y; i--) x/=B[i]; return x%B[y]; } std::vector<std::vector<int>> devise_strategy(int n) { vector<vector<int>> s(42,vector<int>(n+1,0)); for(int i=0; i<42; i++) { ll t1=i;s[i][0]=t1%2; ll digito = t1%10; t1/=10; if(s[i][0]==0) { for(int j=1; j<=n; j++) { ll dig=digit(j,digito); if(digito==0) s[i][j]=digit(j,digito+1)*10+digito+1; else if(dig>t1) s[i][j]=-2; else if(dig<t1) s[i][j]=-1; else s[i][j]=digit(j,digito+1)*10+digito+1; //cerr<<s[i][j]<<" "; } } else { for(int j=1; j<=n; j++) { ll dig=digit(j,digito); if(dig>t1) s[i][j]=-1; else if(dig<t1) s[i][j]=-2; else s[i][j]=digit(j,digito+1)*10+digito+1; //cerr<<s[i][j]<<" "; } } //cerr<<"\n"; } return s; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...