답안 #1092363

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1092363 2024-09-23T22:33:11 Z efishel Xor Sort (eJOI20_xorsort) C++17
0 / 100
1 ms 348 KB
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vll = vector <ll>;
using ii = pair <ll, ll>;
using vii = vector <ii>;

const ll MAXN = 1E3+16;
ll th[MAXN];
vii ans;
vll ve;
void fop (ll i, ll j) {
    ans.push_back({ i, j });
    ve[i] ^= ve[j];
}

int main () {
    cin.tie(nullptr) -> sync_with_stdio(false);
    ll n, s;
    cin >> n >> s;
    ve = vll(n);
    for (ll &i : ve) cin >> i;
    ll nend = n;
    for (ll bit = 19; bit >= 0; bit--) {
        vll th = ve;
        for (ll &i : th) i = i>>bit&1;
        ll j = find(th.begin(), th.begin()+nend, 1) - th.begin();
        for (ll i = j+1; i < nend; i++) {
            if (th[i]) continue;
            fop(i, i-1);
        }
        for (ll i = j+1; i < nend; i++) {
            fop(i-1, i);
        }
        if (j != nend) nend--;
    }
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 348 KB Unexpected end of file - int32 expected
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 348 KB Unexpected end of file - int32 expected
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 348 KB Unexpected end of file - int32 expected
2 Halted 0 ms 0 KB -