Submission #1317281

#TimeUsernameProblemLanguageResultExecution timeMemory
1317281belmostefaArranging Shoes (IOI19_shoes)C++20
50 / 100
1095 ms1936 KiB
#include<vector> using namespace std; long long c=0; long long count_swaps(vector<int>S){ long long n=S.size(); int l=0,r=0; while(l<n){ r++; int k=-1*S[l]; if(k==S[r]){ c+=r-l-1; for(int i=r;i>l+1;i--){ swap(S[i],S[i-1]); } if(S[l]>0){ c++; swap(S[l],S[l+1]); } l+=2; r=l; } } return c; }
#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...