Submission #1061508

#TimeUsernameProblemLanguageResultExecution timeMemory
1061508MarwenElarbiPrisoner Challenge (IOI22_prison)C++17
36.50 / 100
13 ms1624 KiB
#include <bits/stdc++.h> #include "prison.h" using namespace std; #define pb push_back #define ll long long #define fi first #define se second std::vector<std::vector<int>> devise_strategy(int N) { vector<vector<int>> tab(40,vector<int> (N+1,0)); int n=N; tab[0][0]=tab[37][0]=tab[38][0]=tab[39][0]=0; for (int i = 1; i < n+1; ++i) { tab[0][i]=30+i/1000; if(tab[0][i]==30) tab[0][i]=36; tab[37][i]=(i%1000)/100; if(tab[37][i]==0) tab[37][i]=10; tab[38][i]=10+(i%100)/10; if(tab[38][i]==10) tab[38][i]=20; tab[39][i]=20+i%10; if(tab[39][i]==20) tab[39][i]=30; } for (int i = 31; i <= 36; ++i) { int cur=i%10; if(cur==6) cur=0; tab[i][0]=1; for (int j = 1; j < n+1; ++j) { if(j/1000>cur) tab[i][j]=-1; else if(j/1000<cur) tab[i][j]=-2; else tab[i][j]=37; } } for (int i = 1; i <= 10; ++i) { tab[i][0]=1; for (int j = 1; j < n+1; ++j) { if((j%1000)/100>i%10) tab[i][j]=-1; else if((j%1000)/100<i%10) tab[i][j]=-2; else tab[i][j]=38; } } for (int i = 11; i <= 20; ++i) { tab[i][0]=1; for (int j = 1; j < n+1; ++j) { if((j%100)/10>i%10) tab[i][j]=-1; else if((j%100)/10<i%10) tab[i][j]=-2; else tab[i][j]=39; } } for (int i = 21; i <= 30; ++i) { tab[i][0]=1; for (int j = 1; j < n+1; ++j) { if(j%10>i%10) tab[i][j]=-1; else if(j%10<i%10) tab[i][j]=-2; else tab[i][j]=-1; } } return tab; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...