# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
301910 | NicolaAbusaad2014 | Arranging Shoes (IOI19_shoes) | C++14 | 1074 ms | 3704 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 "shoes.h"
#include <bits/stdc++.h>
using namespace std;
long long count_swaps(std::vector<int> s) {
long n=s.size();
long long arr[n]={},x,z,ans=0;
bool ok[n]={};
for(long i=0;i<n;i++){
if(!ok[i]){
for(long j=i+1;j<n;j++){
if(s[j]==(-s[i])&&(!ok[j])){
ok[j]=true;
x=j;
break;
}
arr[j]++;
}
ans+=(x+arr[x])-(i+arr[i])-1;
if(s[i]>0){
ans++;
}
}
}
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... |