Submission #912463

#TimeUsernameProblemLanguageResultExecution timeMemory
912463agusssArranging Shoes (IOI19_shoes)C++14
Compilation error
0 ms0 KiB
long long count_swaps(std::vector<int> s) { vector<bool> used(s.size(), false); long long cnt = 0; // cout << "size:" << s.size() << "\n"; for (int i = 0; i < s.size(); i++) { int j; if (used[i]) { continue; } // cout << "to pair" << i << "\n"; for (j = i + 1; j < s.size(); j++) { if (s[j] == -s[i] and !used[j]) { used[j] = true; break; } } if (j < s.size()) { // cout << i << ", " << j << "\n"; long long distance = j - i - (s[i] < 0 ? 1 : 0); cnt += distance; } } return cnt; }

Compilation message (stderr)

shoes.cpp:1:28: error: 'vector' is not a member of 'std'
    1 | long long count_swaps(std::vector<int> s) {
      |                            ^~~~~~
shoes.cpp:1:1: note: 'std::vector' is defined in header '<vector>'; did you forget to '#include <vector>'?
  +++ |+#include <vector>
    1 | long long count_swaps(std::vector<int> s) {
shoes.cpp:1:35: error: expected primary-expression before 'int'
    1 | long long count_swaps(std::vector<int> s) {
      |                                   ^~~