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;
#define ll long long
ll count_swaps(vector<int> S){
int N = S.size();
ll ans = 0;
vector<bool> v(N, false);
for(int i = 0; i < N; i++){
ll s;
if(S[i] < 0){
s = 0;
}
else{
s = 1;
}
if(v[i] == false){
for(int j = i + 1; j < N; j++){
if(v[j] == false and abs(S[j]) == abs(S[i])){
ans += s;
v[j] = true;
break;
}
if(v[j] == false){
s++;
}
}
}
}
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... |