Submission #627218

#TimeUsernameProblemLanguageResultExecution timeMemory
627218movl228Prisoner Challenge (IOI22_prison)C++17
0 / 100
0 ms212 KiB
#include "prison.h"
#include <bits/stdc++.h>
using namespace std;
vector <vector <int> > devise_strategy(int N){
	vector <vector <int> > ans;
	for (int i=0; i<=22; i++){
		ans.push_back({});
		for (int j=0; j<=N; j++) ans.back().push_back(0);
	}
	for (int i=0; i<=22; i++){
		for (int j=0; j<=N; j++){
			if (!j){
				if (!i||i>=4&&i<=6||i>=10&&i<=12||i>=16&&i<=18) ans[i][j]=0;
				else ans[i][j]=1;
			} else if (!i){
				ans[i][j]=(j-1)/1944+1;
			} else if (i<=3){
				int th=(j-1)/1944+1;
				if (i<th) ans[i][j]=-1;
				else if (i>th) ans[i][j]=-2;
				else ans[i][j]=(j-1)/648%3+4;
			} else if (i<=6){
				int th=(j-1)/648+4;
				if (i<th) ans[i][j]=-2;
				else if (i>th) ans[i][j]=-1;
				else ans[i][j]=(j-1)/216%3+7;
			} else if (i<=9){
				int th=(j-1)/216%3+7;
				if (i<th) ans[i][j]=-1;
				else if (i>th) ans[i][j]=-2;
				else ans[i][j]=(j-1)/72%3+10;
			} else if (i<=12){
				int th=(j-1)/72%3+10;
				if (i<th) ans[i][j]=-2;
				else if (i>th) ans[i][j]=-1;
				else ans[i][j]=(j-1)/24%3+13;
			} else if (i<=15){
				int th=(j-1)/24%3+13;
				if (i<th) ans[i][j]=-1;
				else if (i>th) ans[i][j]=-2;
				else ans[i][j]=(j-1)/8%3+16;
			} else if (i<=18){
				int th=(j-1)/8%3+16;
				if (i<th) ans[i][j]=-2;
				else if (i>th) ans[i][j]=-1;
				else ans[i][j]=(j-1)/2%4+19;
			} else if (i<=22){
				int th=(j-1)/2%4+16;
				if (i<th) ans[i][j]=-1;
				else if (i>th) ans[i][j]=-2;
				else if (j%2==1) ans[i][j]=-2;
				else ans[i][j]=-1;
			}
		}
	}
	return ans;
}

Compilation message (stderr)

prison.cpp: In function 'std::vector<std::vector<int> > devise_strategy(int)':
prison.cpp:13:17: warning: suggest parentheses around '&&' within '||' [-Wparentheses]
   13 |     if (!i||i>=4&&i<=6||i>=10&&i<=12||i>=16&&i<=18) ans[i][j]=0;
      |             ~~~~^~~~~~
prison.cpp:13:30: warning: suggest parentheses around '&&' within '||' [-Wparentheses]
   13 |     if (!i||i>=4&&i<=6||i>=10&&i<=12||i>=16&&i<=18) ans[i][j]=0;
      |                         ~~~~~^~~~~~~
prison.cpp:13:44: warning: suggest parentheses around '&&' within '||' [-Wparentheses]
   13 |     if (!i||i>=4&&i<=6||i>=10&&i<=12||i>=16&&i<=18) ans[i][j]=0;
      |                                       ~~~~~^~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...