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"
using namespace std;
long long count_swaps(vector<int> a){
#define int long long
int n = a.size() ;
int ans = 0 ;
for(int i=0;i<n;i++){
if(a[i]==0) continue ;
// cout <<a[i] << " " ;
int ze = 0 ;
for(int j=i+1;j<n;j++){
if(a[j]==0) ze++ ;
if(a[j]==a[i]*-1){
ans+=(j-i-(a[i]<0)-ze) , a[j]=0 ;
cout << j << " " << a[i] << endl ;
break ;
}
//if(a[j]==a[i]*-1) break ;
}
}
// cout << 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... |