Submission #1362709

#TimeUsernameProblemLanguageResultExecution timeMemory
1362709maya_sAncient Books (IOI17_books)C++20
Compilation error
0 ms0 KiB
#include "books.h"
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;

long long minimum_walk(vector<int> p, int s) {
	ll n = p.size();
	vector<int> v(n);
	for(ll i = 0; i < n; i++) v[i] = i;
	if(p == v) return 0;
	if(n == 2) return 2;
	if(n == 3){
		if(p[2] == 2) return 2;
		return 4;
	}
	if(p[3] == 3){
		if(p[2] == 2) return 2;
		return 4;
	}
	if(p[0] == 0 || p[1] == 1 || p[2] == 2 || p == {3, 0, 1, 2}) return 6;
	return 8;
}

Compilation message (stderr)

books.cpp: In function 'long long int minimum_walk(std::vector<int>, int)':
books.cpp:20:56: error: expected primary-expression before '{' token
   20 |         if(p[0] == 0 || p[1] == 1 || p[2] == 2 || p == {3, 0, 1, 2}) return 6;
      |                                                        ^
books.cpp:20:55: error: expected ')' before '{' token
   20 |         if(p[0] == 0 || p[1] == 1 || p[2] == 2 || p == {3, 0, 1, 2}) return 6;
      |           ~                                           ^~
      |                                                       )