Submission #1233140

#TimeUsernameProblemLanguageResultExecution timeMemory
1233140santi3223Ancient Books (IOI17_books)C++20
Compilation error
0 ms0 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;
}

Compilation message (stderr)

/usr/bin/ld: /tmp/cc2kXGxC.o: in function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/ccfVUe7X.o:books.cpp:(.text.startup+0x0): first defined here
collect2: error: ld returned 1 exit status