# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
808635 | KemalK | Arranging Shoes (IOI19_shoes) | C++17 | 1 ms | 300 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "shoes.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
int n;
long long count_swaps(std::vector<int> s) {
n = s.size();
if (n == 2){
if (s[0] < 0){
return 0;
}
return 1;
}
map <int, vector<int>> pos_right;
map <int, vector<int>> pos_left;
for (int i = 0; i < n; i++){
if (s[i] > 0){
pos_right[s[i]].push_back(i);
}
else{
pos_left[s[i]].push_back(i);
}
}
ll ans = 0;
for (auto x: pos_right){
for (int i = 0; i < x.second.size(); i++){
if (x.second[i] > pos_left[-x.first][i]){
ans += x.second[i] - pos_left[-x.first][i] - 1ll;
}
else{
ans += abs(x.second[i] - pos_left[-x.first][i]);
}
}
}
return ans;
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |