Submission #1114593

#TimeUsernameProblemLanguageResultExecution timeMemory
1114593lftroqArranging Shoes (IOI19_shoes)C++14
10 / 100
92 ms134988 KiB
#include<bits/stdc++.h> #include "shoes.h" typedef long long ll; using namespace std; queue<int> ql[100005],qr[100005]; long long count_swaps(std::vector<int> s) { ll ans=0; for(int i=0;i<(int)s.size();i++) { if(s[i]<0) { s[i]*=-1; if(qr[s[i]].empty()) ql[s[i]].push(i); else { ans+=i-qr[s[i]].front(); qr[s[i]].pop(); } } else { if(ql[s[i]].empty()) qr[s[i]].push(i); else { ans+=i-ql[s[i]].front()-1; ql[s[i]].pop(); } } } 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...