Submission #628090

#TimeUsernameProblemLanguageResultExecution timeMemory
628090jwvg0425Prisoner Challenge (IOI22_prison)C++17
10 / 100
7 ms724 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) {

	vector<vector<int>> res(31, vector<int>(N + 1, 0));

	for (int num = 0; num <= 9; num++)
	{
		int bit = (1 << (9 - num));
		res[num][0] = 0;

		for (int a = 1; a <= N; a++)
		{
			if ((a & bit) != 0)
				res[num][a] = 10 + num * 2 + 1;
			else
				res[num][a] = 10 + num * 2;
		}
	}

	for (int num = 10; num < 30; num++)
	{
		res[num][0] = 1;

		int ahas = num % 2;
		int bit = 1 << (9 - (num - 10) / 2);

		for (int b = 1; b <= N; b++)
		{
			int bhas = (b & bit) != 0 ? 1 : 0;

			if (ahas == bhas)
				res[num][b] = (num - 10) / 2 + 1;
			else if (ahas > bhas)
				res[num][b] = -2;
			else
				res[num][b] = -1;
		}
	}

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