Submission #1233141

#TimeUsernameProblemLanguageResultExecution timeMemory
1233141santi3223Ancient Books (IOI17_books)C++20
0 / 100
0 ms328 KiB
#include <bits/stdc++.h>
#include "books.h"
using namespace std;
#define ll long long
#define vb vector<bool>
#define pb push_back
#define ff(aa, bb, cc) for(ll aa = bb; aa < cc; aa++)
#define vl vector<ll>
#define pll pair<ll, ll>
#define fi first
#define se second
#define ed "\n"
#define all(aaa) aaa.begin(), aaa.end()
#define rall(aaa) aaa.rbegin(), aaa.rend()
ll MOD = 1e9+7;
 

long long minimum_walk(std::vector<int> P, int s){
	vl p;
	ll n = P.size();
	ff(i, 0, n){
		p.pb(P[i]);
	}
	if(n == 1){
		return 0;
	}
	
	if(n == 2){
		vl x = {1, 0};
		if(p == x){
			return 2;
		}
		return 0;
	}
	
	if(n == 3){
		vl x = {0, 1, 2};
		if(p == x){
			return 0;
		}
		x = {1, 0, 2};
		if(p == x){
			return 2;
		}
		return 4;
	}
	
	if(n == 4){
		vl x = {0, 1, 2, 3};
		if(p == x){
			return 0;
		}
		x = {1, 0, 2, 3};
		if(p == x){
			return 2;
		}
		x = {3, 2, 1, 0};
		if(p == x){
			return 10;
		}
		x = {1, 0, 3, 2};
		vl y = {2, 3, 1, 0};
		vl z = {3, 2, 0, 1}, aa = {2, 3, 0, 1};
		if(p == x || p == y || p == z || p == aa){
			return 8;
		}
		vector<vl> c4;
		c4.pb({0, 2, 1, 3});
		c4.pb({1, 2, 0, 3});
		c4.pb({2, 0, 1, 3});
		c4.pb({2, 1, 0, 3});
		ff(i, 0, c4.size()){
			if(p == c4[i]){
				return 4;
			}
		}
		return 6;
	}
	return 0;
	
}
/*
int main() {
	int n, s;
	assert(2 == scanf("%d %d", &n, &s));

	vector<int> p((unsigned) n);
	for(int i = 0; i < n; i++)
		assert(1 == scanf("%d", &p[(unsigned) i]));

	long long res = minimum_walk(p, s);
	printf("%lld\n", res);

	return 0;
}
*/
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...