답안 #1020135

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1020135 2024-07-11T15:27:53 Z coolboy19521 Xor Sort (eJOI20_xorsort) C++17
25 / 100
5 ms 1608 KB
#include "bits/stdc++.h"
#define int long long

using namespace std;

const int sz = 155;

int a[sz];

signed main() {
    cin.tie(nullptr)->sync_with_stdio(false);

    int n, s;
    cin >> n >> s;

    for (int i = 1; i <= n; i ++)
        cin >> a[i];

    vector<pair<int,int>> v;

    for (int i = 1; i <= n; i ++)
        for (int j = n-1; i <= j; j --)
            if (a[j+1] < a[j]) {
                v.push_back(make_pair(j, j+1));
                v.push_back(make_pair(j+1, j));
                v.push_back(make_pair(j, j+1));
                swap(a[j], a[j+1]);
            }

    cout << v.size() << '\n';

    for (auto& p : v)
        cout << p.first << ' ' << p.second << '\n';
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 2 ms 736 KB Output is correct
5 Correct 2 ms 992 KB Output is correct
6 Correct 2 ms 992 KB Output is correct
7 Correct 2 ms 992 KB Output is correct
8 Correct 2 ms 992 KB Output is correct
9 Correct 2 ms 992 KB Output is correct
10 Correct 2 ms 992 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 4 ms 1608 KB Output is correct
13 Correct 5 ms 1500 KB Output is correct
14 Correct 4 ms 1496 KB Output is correct
15 Correct 4 ms 1500 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 2 ms 736 KB Output is correct
5 Correct 2 ms 992 KB Output is correct
6 Correct 2 ms 992 KB Output is correct
7 Correct 2 ms 992 KB Output is correct
8 Correct 2 ms 992 KB Output is correct
9 Correct 2 ms 992 KB Output is correct
10 Correct 2 ms 992 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 4 ms 1608 KB Output is correct
13 Correct 5 ms 1500 KB Output is correct
14 Correct 4 ms 1496 KB Output is correct
15 Correct 4 ms 1500 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 2 ms 992 KB Output is correct
18 Runtime error 4 ms 1244 KB Execution killed with signal 11
19 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Runtime error 4 ms 1244 KB Execution killed with signal 11
5 Halted 0 ms 0 KB -