Submission #837781

#TimeUsernameProblemLanguageResultExecution timeMemory
837781BaytoroPrisoner Challenge (IOI22_prison)C++17
80 / 100
10 ms980 KiB
#include "prison.h" #include <bits/stdc++.h> //#include "grader.cpp" using namespace std; #define ll long long #define sc second #define fr first #define pb push_back vector<vector<int>> devise_strategy(int n) { vector<vector<int>> a(23,vector<int>(n+1,-3)); a[0][0]=0; for(int i=1;i<=n;i++){ int tmp=i; for(int j=0;j<7;j++) tmp/=3; a[0][i]=19+tmp%3; } for(int i=1;i+1<(int)a.size();i++){ if(((i-1)/3)%2==0){ a[i][0]=1; for(int j=1;j<=n;j++){ int tmp=j; for(int k=0;k<=(i-1)/3;k++) tmp/=3; if(tmp%3>(i-1)%3) a[i][j]=-1; else if(tmp%3<(i-1)%3) a[i][j]=-2; else{ int tmp=j; for(int k=0;k<=(i-1)/3-1;k++) tmp/=3; if((i-1)/3==0){//<- if(tmp%3==0) a[i][j]=-2; else if(tmp%3==2) a[i][j]=-1; else a[i][j]=22; } else{ a[i][j]=((i-1)/3-1)*3+tmp%3+1; } } } } else{ a[i][0]=0; for(int j=1;j<=n;j++){ int tmp=j; for(int k=0;k<=(i-1)/3;k++) tmp/=3;//<- if(tmp%3>(i-1)%3) a[i][j]=-2; else if(tmp%3<(i-1)%3) a[i][j]=-1; else{ int tmp=j; for(int k=0;k<(i-1)/3;k++) tmp/=3; a[i][j]=((i-1)/3-1)*3+tmp%3+1; } } } } a[22][0]=0; for(int i=1;i<=n;i++){ if(i%3==0) a[22][i]=-1; else if(i%3==2) a[22][i]=-2; else a[22][i]=0; } return a; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...