답안 #1090007

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1090007 2024-09-17T14:13:24 Z 12345678 Xor Sort (eJOI20_xorsort) C++17
25 / 100
7 ms 860 KB
#include <bits/stdc++.h>

using namespace std;

const int nx=2e3+5;

int s, n, a[nx], tmp[nx];
vector<int> res;

int main()
{
    cin.tie(NULL)->sync_with_stdio(false);
    cin>>n>>s;
    for (int i=1; i<=n; i++) cin>>a[i], tmp[i]=a[i];
    if (s==1)
    {
        for (int i=1; i<=n; i++)
        {
            for (int j=1; j<n; j++)
            {
                if (a[j]>a[j+1])
                {
                    res.push_back(j);
                    tmp[j]^=tmp[j+1];
                    tmp[j+1]^=tmp[j];
                    tmp[j]^=tmp[j+1];
                    swap(a[j], a[j+1]);
                }
            }
        }
        cout<<3*res.size()<<'\n';
        for (auto x:res)
        {
            cout<<x<<' '<<x+1<<'\n';
            cout<<x+1<<' '<<x<<'\n';
            cout<<x<<' '<<x+1<<'\n';
        }
    }
    else
    {
        return 0;
    }
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 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 604 KB Output is correct
5 Correct 2 ms 604 KB Output is correct
6 Correct 2 ms 600 KB Output is correct
7 Correct 2 ms 604 KB Output is correct
8 Correct 2 ms 604 KB Output is correct
9 Correct 2 ms 604 KB Output is correct
10 Correct 2 ms 600 KB Output is correct
11 Correct 0 ms 604 KB Output is correct
12 Correct 3 ms 604 KB Output is correct
13 Correct 4 ms 600 KB Output is correct
14 Correct 3 ms 600 KB Output is correct
15 Correct 4 ms 632 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 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 604 KB Output is correct
5 Correct 2 ms 604 KB Output is correct
6 Correct 2 ms 600 KB Output is correct
7 Correct 2 ms 604 KB Output is correct
8 Correct 2 ms 604 KB Output is correct
9 Correct 2 ms 604 KB Output is correct
10 Correct 2 ms 600 KB Output is correct
11 Correct 0 ms 604 KB Output is correct
12 Correct 3 ms 604 KB Output is correct
13 Correct 4 ms 600 KB Output is correct
14 Correct 3 ms 600 KB Output is correct
15 Correct 4 ms 632 KB Output is correct
16 Correct 0 ms 344 KB Output is correct
17 Correct 2 ms 604 KB Output is correct
18 Correct 3 ms 604 KB Output is correct
19 Correct 3 ms 600 KB Output is correct
20 Correct 3 ms 608 KB Output is correct
21 Correct 6 ms 608 KB Output is correct
22 Correct 3 ms 604 KB Output is correct
23 Correct 3 ms 604 KB Output is correct
24 Correct 4 ms 600 KB Output is correct
25 Correct 4 ms 604 KB Output is correct
26 Incorrect 7 ms 860 KB Integer 59568 violates the range [0, 40000]
27 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 344 KB Unexpected end of file - int32 expected
2 Halted 0 ms 0 KB -