Submission #532194

#TimeUsernameProblemLanguageResultExecution timeMemory
532194bonkArranging Shoes (IOI19_shoes)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; using ll = long long; const int N = 1e5 + 2; const int sus = 1e5; ll count_swaps(vector<int>v){ ll n = v.size(); bool st2 = true; ll ans = 0; for(int i = 0; i < n/2; i++){ if(v[i] != -v[n/2 + i]){ st2 = false; break; } } if(st2){ ll x = (n/2)*(n/2 - 1)/2; return x; } for(int i = 0; i < n; i++){ int cur = v[i]; int l = 1e9; for(int j = i - 1; j >= 0; j--){ if(v[j] == -cur) l = j; } if(l != 1e9){ ans += (i - l) - (v[i] > 0); for(int j = i; j > l; j--) swap(v[j], v[j - 1]); v[l] = v[l + 1] = 0; } } return ans; } int main(){ int n; cin >> n; vector<int>arr(n); for(int i = 0; i < n; i++) cin >> arr[i]; cout << count_swaps(arr) << endl; return 0; }

Compilation message (stderr)

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