Submission #1232160

#TimeUsernameProblemLanguageResultExecution timeMemory
1232160ssafarovPrisoner Challenge (IOI22_prison)C++20
36.50 / 100
20 ms1732 KiB
// #include "prison.h"
#include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define en '\n'
#define all(a) a.begin() , a.end()
#define fi first
#define se second

using namespace std;

vector<vector<int>> devise_strategy(int N) {
	vector<vector<int>> v(40, vector<int> (N + 1));
	for(ll i = 0; i <= 39; ++i){
		if(i < 10){
			v[i][0] = 0;
		}else v[i][0] = 1;
	}
	for(ll i = 0; i <= 39; ++i){
		for(ll j = 1; j <= N; ++j){
			int x = j;
			deque<int> tv;
			while(x){
				tv.push_back(x % 3 + 1);
				x /= 3;
			}
			int ind = i % 10;
			reverse(all(tv));
			while(tv.size() < 8) tv.push_front(1);
			if(ind >= tv.size()){
				if(i < 10) v[i][j] = -2;
				else v[i][j] = -1;
				continue;
			}
			int nd = tv[ind];
			if(i >= 10){
				int pind = i / 10;
				if(pind == 9) pind = 0;
				if(nd == 9) nd = 0;
				if(nd > pind) v[i][j] = -1;
				else if(nd < pind) v[i][j] = -2;
				else{
					v[i][j] = ind + 1;
				}
			}else{
				v[i][j] = nd * 10 + ind;
			}
		}
	}
	return v;
}


// int main(){
	// int n; cin >> n;
	// int a, b; cin >> a >> b;
	// vector<vector<int>> v = devise_strategy(n);
// }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...