# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
152511 | petar_vitorac | Arranging Shoes (IOI19_shoes) | C++14 | 1051 ms | 1920 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>
bool negative(int x){
if(abs(x)==x){
return false;
}
else{
return true;
}
}
long long count_swaps(std::vector<int> s) {
//int n=s.size()/2;
int result=0;
for(int i=0;i<s.size()-1;i++){
int found=-1;
int j=i+1;
while(found==-1){
if(s[j]==-s[i]){
found=j;
}
j++;
}
if(negative(s[i])){
result+=(found-i-1);
}
else{
result+=(found-i);
}
s.erase(s.begin()+found);
}
return result;
}
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... |