| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 | 
|---|---|---|---|---|---|---|---|
| 364550 | tiberiu | Arranging Shoes (IOI19_shoes) | C++14 | 363 ms | 26732 KiB | 
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "shoes.h"
#include <map>
#include <vector>
using namespace std;
const int MAX_N = 200001;
int aib[MAX_N];
void update(int pos, int val) {
    pos++;
    while (pos < MAX_N) {
        aib[pos] += val;
        pos += (pos & -pos);
    }
}
int query(int pos) {
    pos++;
    int ans = 0;
    while (pos) {
        ans += aib[pos];
        pos &= pos - 1;
    }
    return ans;
}
long long count_swaps(std::vector<int> s) {
    map<int, vector<int>> f;
    for (int i = 0; i < s.size(); i++) {
        f[s[i]].push_back(i);
    }
    long long ans = 0;
    vector<int> twin(s.size());
    for (auto x : f) {
        if (x.first < 0)
            continue;
        for (int i = 0; i < f[x.first].size(); i++) {
            twin[f[x.first][i]] = f[-x.first][i];
            twin[f[-x.first][i]] = f[x.first][i];
            if (f[-x.first][i] > f[x.first][i])
                ans++;
        }
    }
    for (int i = 0; i < s.size(); i++) {
        if (twin[i] < i) {
            ans += query(i) - query(twin[i]);
            update(i, 1);
            update(twin[i], 1);
        }
    }
    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... | ||||
