Submission #297015

# Submission time Handle Problem Language Result Execution time Memory
297015 2020-09-11T07:45:34 Z Gurban Ancient Books (IOI17_books) C++17
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>
#include "books.h"
using namespace std;

long long minimum_walk(vector<int> p, int s) {
	if(s == 0){
		if(p.size()==1) return 0;
		else if(p.size()==2){
			if(p[0] != 0) return 1;
			return 0;
		}
		else if(p.size()==3){
			if(p=={0,1,2}) return 0;
			if(p=={0,2,1}) return 4;
			if(p=={1,0,2}) return 2;
			if(p=={1,2,0}) return 4;
			if(p=={2,0,1}) return 4;
			if(p=={2,1,0}) return 4;
		}
		else {
			if(p=={0,1,2,3}) return 0;
			if(p=={0,1,3,2}) return 6;
			if(p=={0,2,1,3}) return 4;
			if(p=={0,2,3,1}) return 6;
			if(p=={0,3,1,2}) return 6;
			if(p=={0,3,2,1}) return 6;
			if(p=={1,0,2,3}) return 2;
			if(p=={1,0,3,2}) return 8;
			if(p=={1,2,0,3}) return 4;
			if(p=={1,2,3,0}) return 6;
			if(p=={1,3,0,2}) return 6;
			if(p=={1,3,2,0}) return 6;
			if(p=={2,0,1,3}) return 4;
			if(p=={2,0,3,1}) return 6;
			if(p=={2,1,0,3}) return 4;
			if(p=={2,1,3,0}) return 6;
			if(p=={2,3,0,1}) return 10;
			if(p=={2,3,1,0}) return 8;
			if(p=={3,0,1,2}) return 6;
			if(p=={3,0,2,1}) return 6;
			if(p=={3,1,0,2}) return 6;
			if(p=={3,1,2,0}) return 6;
			if(p=={3,2,0,1}) return 8;
			if(p=={3,2,1,0}) return 8;
		}
	}
	return 0;
}

Compilation message

books.cpp: In function 'long long int minimum_walk(std::vector<int>, int)':
books.cpp:13:10: error: expected primary-expression before '{' token
   13 |    if(p=={0,1,2}) return 0;
      |          ^
books.cpp:13:10: error: expected ')' before '{' token
   13 |    if(p=={0,1,2}) return 0;
      |      ~   ^
      |          )
books.cpp:14:10: error: expected primary-expression before '{' token
   14 |    if(p=={0,2,1}) return 4;
      |          ^
books.cpp:14:10: error: expected ')' before '{' token
   14 |    if(p=={0,2,1}) return 4;
      |      ~   ^
      |          )
books.cpp:15:10: error: expected primary-expression before '{' token
   15 |    if(p=={1,0,2}) return 2;
      |          ^
books.cpp:15:10: error: expected ')' before '{' token
   15 |    if(p=={1,0,2}) return 2;
      |      ~   ^
      |          )
books.cpp:16:10: error: expected primary-expression before '{' token
   16 |    if(p=={1,2,0}) return 4;
      |          ^
books.cpp:16:10: error: expected ')' before '{' token
   16 |    if(p=={1,2,0}) return 4;
      |      ~   ^
      |          )
books.cpp:17:10: error: expected primary-expression before '{' token
   17 |    if(p=={2,0,1}) return 4;
      |          ^
books.cpp:17:10: error: expected ')' before '{' token
   17 |    if(p=={2,0,1}) return 4;
      |      ~   ^
      |          )
books.cpp:18:10: error: expected primary-expression before '{' token
   18 |    if(p=={2,1,0}) return 4;
      |          ^
books.cpp:18:10: error: expected ')' before '{' token
   18 |    if(p=={2,1,0}) return 4;
      |      ~   ^
      |          )
books.cpp:21:10: error: expected primary-expression before '{' token
   21 |    if(p=={0,1,2,3}) return 0;
      |          ^
books.cpp:21:10: error: expected ')' before '{' token
   21 |    if(p=={0,1,2,3}) return 0;
      |      ~   ^
      |          )
books.cpp:22:10: error: expected primary-expression before '{' token
   22 |    if(p=={0,1,3,2}) return 6;
      |          ^
books.cpp:22:10: error: expected ')' before '{' token
   22 |    if(p=={0,1,3,2}) return 6;
      |      ~   ^
      |          )
books.cpp:23:10: error: expected primary-expression before '{' token
   23 |    if(p=={0,2,1,3}) return 4;
      |          ^
books.cpp:23:10: error: expected ')' before '{' token
   23 |    if(p=={0,2,1,3}) return 4;
      |      ~   ^
      |          )
books.cpp:24:10: error: expected primary-expression before '{' token
   24 |    if(p=={0,2,3,1}) return 6;
      |          ^
books.cpp:24:10: error: expected ')' before '{' token
   24 |    if(p=={0,2,3,1}) return 6;
      |      ~   ^
      |          )
books.cpp:25:10: error: expected primary-expression before '{' token
   25 |    if(p=={0,3,1,2}) return 6;
      |          ^
books.cpp:25:10: error: expected ')' before '{' token
   25 |    if(p=={0,3,1,2}) return 6;
      |      ~   ^
      |          )
books.cpp:26:10: error: expected primary-expression before '{' token
   26 |    if(p=={0,3,2,1}) return 6;
      |          ^
books.cpp:26:10: error: expected ')' before '{' token
   26 |    if(p=={0,3,2,1}) return 6;
      |      ~   ^
      |          )
books.cpp:27:10: error: expected primary-expression before '{' token
   27 |    if(p=={1,0,2,3}) return 2;
      |          ^
books.cpp:27:10: error: expected ')' before '{' token
   27 |    if(p=={1,0,2,3}) return 2;
      |      ~   ^
      |          )
books.cpp:28:10: error: expected primary-expression before '{' token
   28 |    if(p=={1,0,3,2}) return 8;
      |          ^
books.cpp:28:10: error: expected ')' before '{' token
   28 |    if(p=={1,0,3,2}) return 8;
      |      ~   ^
      |          )
books.cpp:29:10: error: expected primary-expression before '{' token
   29 |    if(p=={1,2,0,3}) return 4;
      |          ^
books.cpp:29:10: error: expected ')' before '{' token
   29 |    if(p=={1,2,0,3}) return 4;
      |      ~   ^
      |          )
books.cpp:30:10: error: expected primary-expression before '{' token
   30 |    if(p=={1,2,3,0}) return 6;
      |          ^
books.cpp:30:10: error: expected ')' before '{' token
   30 |    if(p=={1,2,3,0}) return 6;
      |      ~   ^
      |          )
books.cpp:31:10: error: expected primary-expression before '{' token
   31 |    if(p=={1,3,0,2}) return 6;
      |          ^
books.cpp:31:10: error: expected ')' before '{' token
   31 |    if(p=={1,3,0,2}) return 6;
      |      ~   ^
      |          )
books.cpp:32:10: error: expected primary-expression before '{' token
   32 |    if(p=={1,3,2,0}) return 6;
      |          ^
books.cpp:32:10: error: expected ')' before '{' token
   32 |    if(p=={1,3,2,0}) return 6;
      |      ~   ^
      |          )
books.cpp:33:10: error: expected primary-expression before '{' token
   33 |    if(p=={2,0,1,3}) return 4;
      |          ^
books.cpp:33:10: error: expected ')' before '{' token
   33 |    if(p=={2,0,1,3}) return 4;
      |      ~   ^
      |          )
books.cpp:34:10: error: expected primary-expression before '{' token
   34 |    if(p=={2,0,3,1}) return 6;
      |          ^
books.cpp:34:10: error: expected ')' before '{' token
   34 |    if(p=={2,0,3,1}) return 6;
      |      ~   ^
      |          )
books.cpp:35:10: error: expected primary-expression before '{' token
   35 |    if(p=={2,1,0,3}) return 4;
      |          ^
books.cpp:35:10: error: expected ')' before '{' token
   35 |    if(p=={2,1,0,3}) return 4;
      |      ~   ^
      |          )
books.cpp:36:10: error: expected primary-expression before '{' token
   36 |    if(p=={2,1,3,0}) return 6;
      |          ^
books.cpp:36:10: error: expected ')' before '{' token
   36 |    if(p=={2,1,3,0}) return 6;
      |      ~   ^
      |          )
books.cpp:37:10: error: expected primary-expression before '{' token
   37 |    if(p=={2,3,0,1}) return 10;
      |          ^
books.cpp:37:10: error: expected ')' before '{' token
   37 |    if(p=={2,3,0,1}) return 10;
      |      ~   ^
      |          )
books.cpp:38:10: error: expected primary-expression before '{' token
   38 |    if(p=={2,3,1,0}) return 8;
      |          ^
books.cpp:38:10: error: expected ')' before '{' token
   38 |    if(p=={2,3,1,0}) return 8;
      |      ~   ^
      |          )
books.cpp:39:10: error: expected primary-expression before '{' token
   39 |    if(p=={3,0,1,2}) return 6;
      |          ^
books.cpp:39:10: error: expected ')' before '{' token
   39 |    if(p=={3,0,1,2}) return 6;
      |      ~   ^
      |          )
books.cpp:40:10: error: expected primary-expression before '{' token
   40 |    if(p=={3,0,2,1}) return 6;
      |          ^
books.cpp:40:10: error: expected ')' before '{' token
   40 |    if(p=={3,0,2,1}) return 6;
      |      ~   ^
      |          )
books.cpp:41:10: error: expected primary-expression before '{' token
   41 |    if(p=={3,1,0,2}) return 6;
      |          ^
books.cpp:41:10: error: expected ')' before '{' token
   41 |    if(p=={3,1,0,2}) return 6;
      |      ~   ^
      |          )
books.cpp:42:10: error: expected primary-expression before '{' token
   42 |    if(p=={3,1,2,0}) return 6;
      |          ^
books.cpp:42:10: error: expected ')' before '{' token
   42 |    if(p=={3,1,2,0}) return 6;
      |      ~   ^
      |          )
books.cpp:43:10: error: expected primary-expression before '{' token
   43 |    if(p=={3,2,0,1}) return 8;
      |          ^
books.cpp:43:10: error: expected ')' before '{' token
   43 |    if(p=={3,2,0,1}) return 8;
      |      ~   ^
      |          )
books.cpp:44:10: error: expected primary-expression before '{' token
   44 |    if(p=={3,2,1,0}) return 8;
      |          ^
books.cpp:44:10: error: expected ')' before '{' token
   44 |    if(p=={3,2,1,0}) return 8;
      |      ~   ^
      |          )