Submission #1188752

#TimeUsernameProblemLanguageResultExecution timeMemory
1188752rhm_ganArranging Shoes (IOI19_shoes)C++20
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; #ifdef LOCAL #include "debug.h" #else #define dbg(...) 42 #endif long long count_swaps(vector<int> a) { int n = a.size(); long long res = 0; vector<int> c(n + 1); for (int i = 0; i < n; i++) { if (a[i] < 0) { c[-a[i]]++; continue; } c[a[i]]--; if (c[a[i]] < 0) { int id = -1; for (int j = i + 1; j < n; j++) { if (a[j] == -a[i]) { id = j; break; } } if (id != -1) { res += id - i; } for (int j = id; j >= i; j--) { swap(a[j], a[j - 1]); } c[a[i]] = 0; i++; } } return res; } int main() {dbg(count_swaps({-2, 2, 2, -2, -2, 2}));}

Compilation message (stderr)

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