제출 #713463

#제출 시각아이디문제언어결과실행 시간메모리
713463europiumArranging Shoes (IOI19_shoes)C++17
10 / 100
1 ms300 KiB
#include "shoes.h" #include <iostream> #include <vector> #include <algorithm> #include <string> #include <numeric> #include <cmath> #include<iterator> #include <set> #include <map> #include <math.h> #include <iomanip> #include <unordered_set> using namespace std; using ll = long long; ll count_swaps(vector<int> a) { int n = a.size(); int ans = 0; vector<bool> used(n); for (int i = 0; i < n; i++){ if (used[i]) continue; int j = i + 1; int val = 0; while (a[j] != -a[i]){ if (!used[j]) val++; j++; } if (a[i] > 0) ans += val + 1; else ans += val; used[i] = true; used[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...