Submission #487001

#TimeUsernameProblemLanguageResultExecution timeMemory
487001ssenseArranging Shoes (IOI19_shoes)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> //#include "shoes.h" #define startt ios_base::sync_with_stdio(false);cin.tie(0); typedef long long ll; using namespace std; #define vint vector<int> #define all(v) v.begin(), v.end() #define MOD 1000000007 #define MOD2 998244353 #define MX 1000000000 #define MXL 1000000000000000000 #define PI (ld)2*acos(0.0) #define nax 200005 #define pb push_back #define sc second #define fr first //#define int long long #define endl '\n' #define ld long double #define NO cout << "NO" << endl #define YES cout << "YES" << endl long long count_swaps(vector<int> s) { ll n = s.size()/2; if(n > 1000) { return n*(n-1)/2; } int ans = 0; while(s.size() > 0) { int i = 0; while(s[i] > 0) { i++; } ans+=i; int sz = -s[i]; s.erase(s.begin()+i); i = 0; while(s[i] != sz) { i++; } ans+=i; s.erase(s.begin()+i); } return ans; } int main() { int n; cin >> n; vint a(2*n); for(int i = 0; i < 2*n; i++) { cin >> a[i]; } cout << count_swaps(a); }

Compilation message (stderr)

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