Submission #314200

#TimeUsernameProblemLanguageResultExecution timeMemory
314200ShiftyBlockArranging Shoes (IOI19_shoes)C++14
50 / 100
1091 ms2176 KiB
#include <bits/stdc++.h> #include "shoes.h" #define rep(i,a,b) for(int i=a; i<b; i++) #define long long long using namespace std; long count_swaps(vector<int> arr){ int N=arr.size(); int total=0; for (int i = 0; i < N; ++i) { if(arr[i]==0) continue; int free=0; int end=-1; rep(j,i+1,N){ if(arr[j]==-arr[i]){ end=j; break; } if(arr[j]==0) free++; } if(arr[i]<0) total--; arr[i]=0; arr[end]=0; total+=end-i-free; } return total; }
#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...