Submission #892670

#TimeUsernameProblemLanguageResultExecution timeMemory
892670Trisanu_DasPrisoner Challenge (IOI22_prison)C++17
36.50 / 100
16 ms1628 KiB
#include <bits/stdc++.h>
using namespace std;
 
vector<vector<int> > devise_strategy(int N){
	vector<vector<int> > ans(40, vector<int>(N + 1));
	ans[0][0] = 0;
	for (int i = 3; i < 42; i++){
		if(i % 3 == 2) ans[i - 2][0] = 0;
		else ans[i - 2][0]=1;
	}
	for (int j = 1; j <= N; j++) ans[0][j] = 1 + ((j & (1 << 12)) != 0);
	for (int i = 3; i < 42; i += 3){
		for (int j = 1; j <= N; j++){
			if(j & (1 << (12 - (i / 3 - 1)))) ans[i - 2][j] = -1;
			else ans[i - 2][j] = i;
		}
	}
	for (int i = 4; i < 42; i += 3){
		for (int j = 1; j <= N; j++){
			if((j & (1 << (12 - (i / 3 - 1)))) == 0) ans[i - 2][j]= -2;
			else ans[i - 2][j] = i - 1;
		}
	}
	for (int i = 5; i < 42; i += 3) for (int j = 1; j <= N; j++) ans[i - 2][j] = min(39, i - 1 + ((j & (1 << (12 - (i / 3)))) != 0));
	return ans;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...