Submission #1179567

#TimeUsernameProblemLanguageResultExecution timeMemory
1179567catch_me_if_you_canPrisoner Challenge (IOI22_prison)C++20
0 / 100
0 ms320 KiB
#include<bits/stdc++.h>
using namespace std;
#define in array<int, 2>
#define pb push_back
#define pob pop_back

vector<vector<int>> devise_strategy(int N)
{
	int X = 24;
	vector<vector<int>> s(X+1);
	vector<int> p3(9, 1);
	for(int i = 1; i <= 8; i++)
		p3[i] = 3*p3[i-1];
	//0 ? -> 0
	//1 ? -> 1
	//2 ? -> 2
	//0, 1, 2, 3, 4, 5, 6, 7
	s[0][0] = 0;//Check A.
	for(int i = 1; i <= N; i++)
		s[0][i] = 22 + ((i/p3[7])%3); 
	for(int i = 0; i < X; i++)
	{
		//Stuff in here goes into s[i+1]
		s[i+1].resize(N+1);
		int b = (i/3);
		int v = i%3;
		s[i+1][0] = b%2;
		//         A B
		//b odd -> v ?
		//b even-> ? v
		for(int j = 1; j <= N; j++)
		{
			int vp = (j/p3[b])%3;
			if(vp > v)
				s[i+1][j] = -2 + (b%2);
			else if(vp < v)
				s[i+1][j] = -1 - (b%2);
			else if(b == 0)
				s[i+1][j] = 0;//this should never happen in real life play-through
			else
				s[i+1][j] = 3*(b-1) + ((j/p3[b-1])%3) + 1;
		}
	}
	return s;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...