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 "shoes.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MAXN = 2e5 + 10;
int n;
vector<int> pos[MAXN];
ll count_swaps(vector<int> s) {
n = s.size() / 2; ll ans = 0;
for(int i = 0 ; i < n * 2 ; i += 2){
int p = -1;
for(int j = i ; j < n * 2 ; j++){
if(s[i] + s[j] == 0){
p = j;
break;
}
}
for(int j = p ; j > i + 1 ; j--){
swap(s[j] , s[j - 1]);
ans++;
}
if(s[i] > 0) ans++;
}
return ans;
}
# | 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... |