# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
957749 | suren | Arranging Shoes (IOI19_shoes) | C++14 | 17 ms | 2000 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define mk make_pair
#define S second
#define F first
using namespace std;
long long count_swaps(std::vector<int> a) {
if( a.size() <= 2000 ){
ll ans = 0, srch;
for(int i = 0; i < a.size(); i ++ ){
if( a[i] == 0 )
continue;
for(int j = i+1; j < a.size(); j ++ ){
if( a[j] == -a[i] ){
ans += j-i;
if( a[i] < 0 )
ans --;
a[j] = 0;
break;
}
if( a[j] == 0 ){
ans --;
}
}
}
return ans;
}
ll n = a.size()/2;
ll ans = 0, r = n-1;
for(int i = 0; i < n; i ++ ){
ans += r-i-1;
}
return ans;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |