Submission #1019465

#TimeUsernameProblemLanguageResultExecution timeMemory
1019465NicolaikrobArranging Shoes (IOI19_shoes)C++17
10 / 100
1 ms764 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; ll count_swaps(vector<int> S) { ll n = S.size(), ans = 0; unordered_map<ll,vector<ll>> M; for(int i = 0; i < n; i++) { if(M[S[i]].size()) { ans += i-M[S[i]].back()-(S[i]>0); M[S[i]].pop_back(); } else { M[-S[i]].push_back(i); } } 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...