# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
896990 | ozner77 | Arranging Shoes (IOI19_shoes) | C++17 | 1067 ms | 3164 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>
#include <vector>
#include <iostream>
#include <string>
using namespace std;
long long count_swaps(std::vector<int> s) {
int a,b,c,d,e=s.size(),xd,jsjs=0;
bool fua=false,fuo=true;
long long swaps=0;
for(int i=0;i<e;i+=2){
a=s[i];
b=s[i];
for(int j=i;j<e;j++){
if(s[j]<0){
for(int k=j;k<e;k++){
if(s[k]+s[j]==0){
fua=true;
xd=k-j;
}
}
if(fua){
if(xd>j-i){
swaps+=(j-i);
s[i]=s[j];
s[j]=a;
}
}else{
swaps++;
}
}
}
}
return swaps;
}
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... |