제출 #542990

#제출 시각아이디문제언어결과실행 시간메모리
542990Mohammed_AtalahArranging Shoes (IOI19_shoes)C++17
50 / 100
1086 ms3948 KiB
#include "shoes.h" #include <bits/stdc++.h> using namespace std; long long count_swaps(std::vector<int> s) { int n = s.size(); deque<int> q; for (int i = 0; i < n; i++) { q.push_back(s[i]); } int total = 0; while (q.size() > 0) { int w = q.front(); auto it = find(q.begin(), q.end(), w * -1); int idx = distance(q.begin(), it); total += idx - 1; if (w > 0) { total ++; } q.erase(it); q.pop_front(); } return total; }
#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...