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;
#define SZ(x) int((x).size())
#define all(x) (x).begin() , (x).end()
#define sep ' '
const int MAXN = 2e5 + 10;
int n , mark[MAXN];
ll count_swaps(vector<int> s) {
n = SZ(s);
ll ans = 0;
for(int i = 0 ; i < n ; i++){
if(mark[i]) continue;
int cnt = 0;
mark[i] = 1;
for(int j = i + 1 ; j < n ; j++){
if(mark[j] == 0 && s[j] == s[i] * -1){
mark[j] = 1;
ans += cnt;
break;
}
cnt += (mark[j] == 0);
}
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... |