Submission #1062858

#TimeUsernameProblemLanguageResultExecution timeMemory
1062858Ahmed57Arranging Shoes (IOI19_shoes)C++17
10 / 100
1 ms428 KiB
#include "bits/stdc++.h" using namespace std; long long count_swaps(vector<int> s){ int n = s.size(); map<int,stack<int>> v; long long ans = 0; for(int i = 0;i<n;i++){ if(v[-s[i]].size()==0)v[s[i]].push(i); else{ ans+=(i-v[-s[i]].top()-1); v[-s[i]].pop(); if(s[i]<0)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...