Submission #591172

#TimeUsernameProblemLanguageResultExecution timeMemory
591172jpabloamezcuaArranging Shoes (IOI19_shoes)C++17
0 / 100
1 ms300 KiB
#include "shoes.h" #include <vector> #include <bits/stdc++.h> long long count_swaps(std::vector<int> arr) { int n=arr.size(); long long cnt=0; for(int k=0;k<n*2;k+=2) { int sal=0; for(int i=k+1;i<n*2;i++) { if(arr[i]*-1==arr[k]) { sal=i; break; } } for(int i=sal;i>k;i--) { int l1=arr[i-1]; arr[i-1]=arr[i]; arr[i]=l1; cnt++; } if(arr[k]>arr[k+1]) { int l1=arr[k]; arr[k]=arr[k+1]; arr[k+1]=l1; cnt++; } } return cnt; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...