Submission #628111

#TimeUsernameProblemLanguageResultExecution timeMemory
628111jwvg0425Prisoner Challenge (IOI22_prison)C++17
36.50 / 100
19 ms1620 KiB
#include <stdio.h>
#include <vector>
#include <queue>
#include <algorithm>
#include <iostream>
#include <string>
#include <bitset>
#include <map>
#include <set>
#include <tuple>
#include <string.h>
#include <math.h>
#include <random>
#include <functional>
#include <assert.h>
#include <math.h>
#define all(x) (x).begin(), (x).end()
#define xx first
#define yy second

using namespace std;

template<typename T, typename Pr = less<T>>
using pq = priority_queue<T, vector<T>, Pr>;
using i64 = long long int;
using ii = pair<int, int>;
using ii64 = pair<i64, i64>;

vector<vector<int>> devise_strategy(int N) {

	const int BIT_SIZE = 13;
	vector<vector<int>> res(BIT_SIZE * 3 + 1, vector<int>(N + 1, 0));

	for (int b = 0; b <= BIT_SIZE; b++)
	{
		res[b * 3][0] = 0;
		for (int ai = 1; ai <= N; ai++)
		{
			if (b == BIT_SIZE)
			{
				if ((ai & (1 << (BIT_SIZE - b))) == 0)
					res[b * 3][ai] = -1;
				else
					res[b * 3][ai] = -2;
			}
			else
			{
				if ((ai & (1 << (BIT_SIZE - b))) == 0)
					res[b * 3][ai] = b * 3 + 1;
				else
					res[b * 3][ai] = b * 3 + 2;
			}
		}

		if (b == BIT_SIZE)
			break;

		res[b * 3 + 1][0] = res[b * 3 + 2][0] = 1;

		for (int bi = 1; bi <= N; bi++)
		{
			res[b * 3 + 1][bi] = (bi & (1 << (BIT_SIZE - b))) ? -1 : (b + 1) * 3;
			res[b * 3 + 2][bi] = (bi & (1 << (BIT_SIZE - b))) ? (b + 1) * 3 : -2;
		}
	}

	return res;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...