# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
406033 | ngrace | Arranging Shoes (IOI19_shoes) | C++14 | 33 ms | 3108 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"
long long count_swaps(std::vector<int> s) {
int n=s.size()/2;
if(n<=1000){//sub 1, 2 and 5
long long out=0;
for(int i=0;i<n*2;i+=2){
int cur=s[i];
int ind=i+1;
while(s[ind]!=-cur) ind++;
while(ind>i+1){
int tmp=s[ind];
s[ind]=s[ind-1];
s[ind-1]=tmp;
ind--;
out++;
}
if(s[i]>s[i+1]){
out++;
}
}
return out;
}
else{
//assume sub 4
long long out=0;
for(int i=0;i<s.size()/2;i++){
out+=i;
}
return out;
}
}
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... |