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>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<string> vs;
#define PB push_back
#define pb pop_back
#define in insert
#define endl "\n"
const unsigned int M = 1000000007;
ll count_swaps(vi a){
ll n = (int)a.size()/2, ans=0;
while(n--){
int x = a[0], ind = 1;
while(a[ind]!= -x) ind++;
if(x<0) ans+=ind-1;
else ans+=ind;
a.erase(a.begin()+ind);
a.erase(a.begin());
}
return ans;
return ans;
}
//int main(){
// vi v;
// v.PB(-2);
// v.PB(2);
// v.PB(2);
// v.PB(-2);
// cout<<count_swaps(v);
//}
# | 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... |