제출 #1012960

#제출 시각아이디문제언어결과실행 시간메모리
1012960HappyCapybaraArranging Shoes (IOI19_shoes)C++17
10 / 100
0 ms348 KiB
#include "shoes.h" #include<bits/stdc++.h> using namespace std; #define ll long long ll count_swaps(vector<int> s){ int n = s.size()/2; map<int,queue<int>> m; for (int i=0; i<2*n; i++) m[s[i]].push(i); ll res = 0; int x = 0; vector<bool> done(2*n, false); for (int i=0; i<2*n; i++){ if (done[i]){ x--; continue; } int j = m[-s[i]].front(); m[-s[i]].pop(); m[s[i]].pop(); res += j-i; if (s[i] < 0) res--; done[i] = true; done[j] = true; x++; } return res; }
#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...