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 <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <numeric>
#include <cmath>
#include<iterator>
#include <set>
#include <map>
#include <math.h>
#include <iomanip>
#include <unordered_set>
using namespace std;
using ll = long long;
// subtask 4 - 15 points
// ll count_swaps(vector<int> s) {
// ll n = s.size() / 2;
// return n * (n - 1) / 2;
// }
// subtask 3
ll count_swaps(vector<int> a) {
ll n = a.size();
ll closest = 0;
ll ans = 0;
for (ll i = 0; i < n; i++){
if (a[i] < 0){
ans += abs(i - closest);
closest +=2 ;
}
}
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... |