이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "shoes.h"
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define fi first
#define se second
#define pb push_back
typedef long long ll;
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef tree<int, null_type, greater<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;
long long count_swaps(std::vector<int> s) {
ll N = s.size() / 2;
int shoes[2 * N];
for (int i = 0; i < 2 * N; i++) {
shoes[i] = s[i];
}
int counter = 0;
for (int i = 0; i < 2 * N; i += 2) {
int find = -shoes[i];
int pos = -1;
for (int j = i + 1; j < 2 * N; j++) {
if (shoes[j] == find)
pos = j;
}
for (int j = pos; j > i; j--) {
swap(shoes[j], shoes[j + 1]);
counter++;
}
}
return counter;
}
# | 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... |