Submission #294914

#TimeUsernameProblemLanguageResultExecution timeMemory
294914ASDF123Arranging Shoes (IOI19_shoes)C++17
Compilation error
0 ms0 KiB

#include "shoes.h"
#include <bits/stdc++.h>
#define ll long long
#define szof(s) (int)s.size()

using namespace std;

const int N = (int)2e5 + 5;

ll count_swaps(vector<int> s) {
  ll ans = 0;
  int n = szof(s) / 2;
  for (int i = 0; i < n * 2; i += 2) {
    int pos = -1;
    for (int j = i + 1; j < n * 2; j++) {
      if (s[j] == -s[i]) {
        pos = j;
        break;
      }
    }
    while (pos > i + 1) {
      swap(s[pos], s[pos - 1]);
      pos--;
      ans++;
    }
    if (s[pos] < 0) {
      swap(s[pos], s[pos - 1]);
      ans++;
    }
  }
  return ans;
}

//signed main() {
  
}

Compilation message (stderr)

shoes.cpp:37:1: error: expected declaration before '}' token
   37 | }
      | ^