Submission #719163

#TimeUsernameProblemLanguageResultExecution timeMemory
719163AndrijaMArranging Shoes (IOI19_shoes)C++14
50 / 100
1088 ms3244 KiB
#include <bits/stdc++.h> using ll=long long; using namespace std; ll count_swaps(vector<int> a) { ll n = a.size(); ll ans = 0; bool vis[n]; memset(vis,0,sizeof vis); for(int i=0;i<n;i++) { if(vis[i])continue; ll j=i+1; ll val=0; while(a[j]!=-a[i] || vis[j]) { if(!vis[j])val++; j++; } if(a[i]>0) { ans+=val+1; } else { ans+=val; } vis[i]=vis[j]=true; } 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...