Submission #1305496

#TimeUsernameProblemLanguageResultExecution timeMemory
1305496ayazArranging Shoes (IOI19_shoes)C++20
Compilation error
0 ms0 KiB
#include "shoes.h" #include "grader.cpp" #include <bits/stdc++.h> using namespace std; #define isz(x) (int)x.size() long long count_swaps(std::vector<int> s) { vector<int> a = s; int n = isz(a); if (n == 2) { return (a[0] > 0); } int ans = 0; for (int i = 0; i < n; i++) { int d = 1e9; for (int j = n - 1; j >= 0; j--) { if (a[i] + a[j] == 0 && abs(d - i) >= abs(j - i)) { d = j; } } if (d == i + 1 || d == i - 1) continue; int v = a[d]; a.erase(a.begin() + d); if (d < i) a.insert(a.begin() - 1 + i, v); else a.insert(a.begin() + 1 + i, v); ans += (d > i ? d - (i + 1) : (i - 1) - d); // for( auto j : a) cout << j << ' '; // cout << '\n'; } for (int i = 0; i < n; i += 2) { ans += (a[i] > 0); } return ans; }

Compilation message (stderr)

/usr/bin/ld: /tmp/ccCH9cPm.o: in function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/cckBP0Hg.o:shoes.cpp:(.text.startup+0x0): first defined here
collect2: error: ld returned 1 exit status