Submission #70231

#TimeUsernameProblemLanguageResultExecution timeMemory
70231E869120Ancient Books (IOI17_books)C++14
Compilation error
0 ms0 KiB
#include "books.h" #include <bits/stdc++.h> int n;bool used[1009]; long long minimum_walk(std::vector<int> p, int s) { if(p==vector<int>{3,2,1,0}) return 8; n=p.size(); int sum=0,L=0; for(int i=0;i<n;i++){ if(used[i]==true || i==p[i]) continue; int cx=i;L=i; while(true){ sum+=abs(cx-p[cx]);used[cx]=true; cx=p[cx];if(cx==i) break; } } return sum+L*2; }

Compilation message (stderr)

books.cpp: In function 'long long int minimum_walk(std::vector<int>, int)':
books.cpp:7:8: error: 'vector' was not declared in this scope
  if(p==vector<int>{3,2,1,0}) return 8;
        ^~~~~~
books.cpp:7:8: note: suggested alternative:
In file included from /usr/include/c++/7/vector:64:0,
                 from books.h:1,
                 from books.cpp:1:
/usr/include/c++/7/bits/stl_vector.h:216:11: note:   'std::vector'
     class vector : protected _Vector_base<_Tp, _Alloc>
           ^~~~~~
books.cpp:7:15: error: expected primary-expression before 'int'
  if(p==vector<int>{3,2,1,0}) return 8;
               ^~~
books.cpp:7:15: error: expected ')' before 'int'