# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
916134 | Aiperiii | Arranging Shoes (IOI19_shoes) | C++14 | 22 ms | 4972 KiB |
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;
#define all(x) x.begin(),x.end()
#define ff first
#define ss second
#define pb push_back
long long count_swaps(vector<int> s) {
int x=abs(s[0]);
vector <long long> v1,v2;
for(int i=0;i<s.size();i++){
if(i%2==0 && s[i]==x)v1.pb(i);
if(i%2==1 && s[i]==-x)v2.pb(i);
}
long long ans=0;
for(int i=0;i<v1.size();i++){
ans+=abs(v1[i]-v2[i]);
}
return ans;
}
Compilation message (stderr)
# | 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... |