Submission #785221

#TimeUsernameProblemLanguageResultExecution timeMemory
785221ono_de206Prisoner Challenge (IOI22_prison)C++17
0 / 100
1 ms212 KiB
#include "prison.h"

#include<bits/stdc++.h>
using namespace std;

#define in insert
#define all(x) x.begin(),x.end()
#define pb push_back
#define eb emplace_back
#define ff first
#define ss second

//#define int long long
 
typedef long long ll;
typedef vector<int> vi;
typedef set<int> si;
typedef multiset<int> msi;
typedef pair<int, int> pii;
typedef vector<pii> vpii;

vector<vector<int>> devise_strategy(int n) {
	vector<vector<int>> ret(39, vector<int>(n + 1));
	for(int i = 0; i < 39; i += 3) {
		int bit = 12 - (i / 3);
		ret[i][0] = 0;
		ret[i + 1][0] = 1;
		ret[i + 2][0] = 1;
		for(int j = 1; j <= n; j++) {
			int val = (j >> bit) & 1;
			if(val) {
				ret[i][j] = i + 2;
				ret[i + 1][j] = -2;
				ret[i + 2][j] = (i + 3 >= 39 ? -1 : i + 3);
			} else {
				ret[i][j] = i + 1;
				ret[i + 1][j] = (i + 3 >= 39 ? -1 : i + 3);
				ret[i + 2][j] = -1;
			}
		}
	}
	return ret;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...