Submission #884452

#TimeUsernameProblemLanguageResultExecution timeMemory
884452tamir1Arranging Shoes (IOI19_shoes)C++14
50 / 100
1089 ms3244 KiB
#include "shoes.h" using namespace std; long long count_swaps(vector<int> s) { int i,j,n=s.size(),ans=0; for(i=0;i<n;i+=2){ if(s[i]<0){ for(j=i+1;j<n;j++){ if(s[j]==-1*s[i]) break; } for(;j>i+1;j--){ ans++; swap(s[j],s[j-1]); } } else{ for(j=i+1;j<n;j++){ if(s[j]==-1*s[i]) break; } for(;j>i;j--){ ans++; swap(s[j],s[j-1]); } } } return ans; }
#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...