# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
303695 | rocks03 | Arranging Shoes (IOI19_shoes) | C++14 | 1094 ms | 2040 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>
#define ll long long
#define pii pair<int, int>
#define pll pair<ll, ll>
#define ff first
#define ss second
#define pb push_back
#define SZ(x) ((int) (x).size())
using namespace std;
long long count_swaps(vector<int> s){
int N = SZ(s);
ll ans = 0;
for(int i = 0; i < N;){
int r;
for(int j = i + 1; j < N; j++){
if(s[i] * (-1) == s[j]){
r = j;
break;
}
}
for(int j = r; j > i + 1; j--){
swap(s[j], s[j-1]);
ans++;
}
if(s[i] > 0){
swap(s[i], s[i+1]);
ans++;
}
i += 2;
}
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... |