# | 제출 시각UTC-0 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
682095 | sharaelong | Arranging Shoes (IOI19_shoes) | C++17 | 173 ms | 13564 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "shoes.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
struct FenwickTree {
vector<int> tree;
FenwickTree(int size) {
tree.resize(size+1, 0);
}
int sum(int pos) {
int ret = 0;
for (int i=pos+1; i>0; i &= (i-1)) ret += tree[i];
return ret;
}
void add(int pos, int val) {
for (int i=pos+1; i<tree.size(); i+=(i & -i)) tree[i] += val;
}
};
ll inversion_cnt(vector<int> arr) {
int n = arr.size();
ll ret = 0;
FenwickTree fen(n);
for (int x: arr) {
ret += fen.sum(n-1) - fen.sum(x);
fen.add(x, 1);
컴파일 시 표준 에러 (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... |