Submission #299005

#TimeUsernameProblemLanguageResultExecution timeMemory
299005REALITYNBArranging Shoes (IOI19_shoes)C++14
50 / 100
1087 ms3192 KiB
#include <bits/stdc++.h> #include "shoes.h" using namespace std; long long count_swaps(vector<int> a){ #define int long long int n = a.size() ; int ans = 0 ; for(int i=0;i<n;i++){ if(a[i]==0) continue ; // cout <<a[i] << " " ; int ze = 0 ; for(int j=i+1;j<n;j++){ if(a[j]==0) ze++ ; if(a[j]==a[i]*-1){ ans+=(j-i-(a[i]<0)-ze) , a[j]=0 ; // cout << j << " " << a[i] << endl ; break ; } //if(a[j]==a[i]*-1) break ; } } // cout << ans ; 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...