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>
#include "shoes.h"
#define I inline void
using namespace std ;
using ll = long long ;
using ld = long double ;
const int N = 3000 + 7 , mod = 1e9 + 7 ;
// How interesting!
int n;
long long count_swaps(std::vector<int> s) {
int n = (int) s.size() ;
ll ret = 0 ;
for(int i = 0 ;i < n; i+=2){
for(int j = i + 1;j < n ;j ++){
if(abs(s[i]) == abs(s[j]) && s[i] * s[j] < 0){
for(int k = j - 1; k > i ;k --){
swap(s[k] , s[k+1]) ;
ret++;
}
break ;
}
}
if(s[i] > s[i+1]){
ret++ ;
}
}
return ret;
}
# | 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... |