Submission #208325

#TimeUsernameProblemLanguageResultExecution timeMemory
208325alexxela12345Arranging Shoes (IOI19_shoes)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h>

long long count_swaps(vector<int> a) {
  int n = a.size() / 2;
  long long ans = 0;
  while (n) {
    int x = a[0];
    int ind = 1;
    while (a[ind] != -x) {
      ind++;
    }
    if (x < 0) {
      ans += ind - 1;
    } else {
      ans += ind;
    }
    a.erase(a.begin() + ind);
    a.erase(a.begin());
    n--;
  }
  return ans;
}

Compilation message (stderr)

shoes.cpp:3:23: error: 'vector' was not declared in this scope
 long long count_swaps(vector<int> a) {
                       ^~~~~~
shoes.cpp:3:23: note: suggested alternative:
In file included from /usr/include/c++/7/vector:64:0,
                 from /usr/include/c++/7/functional:61,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:71,
                 from shoes.cpp:1:
/usr/include/c++/7/bits/stl_vector.h:216:11: note:   'std::vector'
     class vector : protected _Vector_base<_Tp, _Alloc>
           ^~~~~~
shoes.cpp:3:30: error: expected primary-expression before 'int'
 long long count_swaps(vector<int> a) {
                              ^~~