Submission #231122

#TimeUsernameProblemLanguageResultExecution timeMemory
231122peijarArranging Shoes (IOI19_shoes)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; #define SZ(v) ((int)(v).size()) using ll = long long; ll count_swaps(vector<int> shoes) { int nb_chaussures = SZ(shoes); ll nb_swaps(0); for (int i(1); i < nb_chaussures; ++i) { for (int j(0); j < i; ++j) if (shoes[i] + shoes[j] == 0) { int cur = i; while (cur > j+1) { swap(shoes[cur], shoes[cur-1]); --cur; ++nb_swaps; } if (shoes[j] > 0) { ++nb_swaps; swap(shoes[j], shoes[j+1]); } shoes[j] = shoes[j+1] = 0; break; } } return nb_swaps;

Compilation message (stderr)

shoes.cpp: In function 'll count_swaps(std::vector<int>)':
shoes.cpp:33:17: error: expected '}' at end of input
  return nb_swaps;
                 ^