Submission #407392

# Submission time Handle Problem Language Result Execution time Memory
407392 2021-05-18T21:15:27 Z peuch Ancient Books (IOI17_books) C++17
Compilation error
0 ms 0 KB
#include "books.h"
#include<bits/stdc++.h>

int n = 0;
vector<int> p;

bool caso(int a, int b, int c, int d){
	return p[0] == a && p[1] == b && p[2] == c && p[3] == d;
}

long long minimum_walk(vector<int> _p, int s) {
	p = _p;
	n = p.size();
	
	if(caso(0, 1, 2, 3)) return 0;
	if(caso(0, 1, 3, 2)) return 6;
	if(caso(0, 2, 1, 3)) return 4;
	if(caso(0, 2, 3, 1)) return 6;
	if(caso(0, 3, 1, 2)) return 6;
	if(caso(0, 3, 2, 1)) return 6;
	
	if(caso(1, 0, 2, 3)) return 2;
	if(caso(1, 0, 3, 2)) return 6;
	if(caso(1, 2, 0, 3)) return 4;
	if(caso(1, 2, 3, 0)) return 6;
	if(caso(1, 3, 0, 2)) return 6;
	if(caso(1, 3, 2, 0)) return 6;
	
	if(caso(2, 0, 1, 3)) return 4;
	if(caso(2, 0, 3, 1)) return 6;
	if(caso(2, 1, 0, 3)) return 4;
	if(caso(2, 1, 3, 0)) return 6;
	if(caso(2, 3, 0, 1)) return 8;
	if(caso(2, 3, 1, 0)) return 8;
	
	if(caso(3, 0, 1, 2)) return 6;
	if(caso(3, 0, 2, 1)) return 6;
	if(caso(3, 1, 0, 2)) return 6;
	if(caso(3, 1, 2, 0)) return 6;
	if(caso(3, 2, 0, 1)) return 8;
	if(caso(3, 2, 1, 0)) return 8;
	return 0;
}

Compilation message

books.cpp:5:1: error: 'vector' does not name a type
    5 | vector<int> p;
      | ^~~~~~
books.cpp: In function 'bool caso(int, int, int, int)':
books.cpp:8:9: error: 'p' was not declared in this scope
    8 |  return p[0] == a && p[1] == b && p[2] == c && p[3] == d;
      |         ^
books.cpp: At global scope:
books.cpp:11:24: error: 'long long int minimum_walk' redeclared as different kind of entity
   11 | long long minimum_walk(vector<int> _p, int s) {
      |                        ^~~~~~
In file included from books.cpp:1:
books.h:3:11: note: previous declaration 'long long int minimum_walk(std::vector<int>, int)'
    3 | long long minimum_walk(std::vector<int> p, int s);
      |           ^~~~~~~~~~~~
books.cpp:11:24: error: 'vector' was not declared in this scope
   11 | long long minimum_walk(vector<int> _p, int s) {
      |                        ^~~~~~
books.cpp:11:24: note: suggested alternatives:
In file included from /usr/include/c++/10/vector:67,
                 from books.h:1,
                 from books.cpp:1:
/usr/include/c++/10/bits/stl_vector.h:389:11: note:   'std::vector'
  389 |     class vector : protected _Vector_base<_Tp, _Alloc>
      |           ^~~~~~
In file included from books.h:1,
                 from books.cpp:1:
/usr/include/c++/10/vector:86:13: note:   'std::pmr::vector'
   86 |       using vector = std::vector<_Tp, polymorphic_allocator<_Tp>>;
      |             ^~~~~~
books.cpp:11:31: error: expected primary-expression before 'int'
   11 | long long minimum_walk(vector<int> _p, int s) {
      |                               ^~~
books.cpp:11:40: error: expected primary-expression before 'int'
   11 | long long minimum_walk(vector<int> _p, int s) {
      |                                        ^~~