# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1087950 |
2024-09-13T15:20:55 Z |
SulA |
Xor Sort (eJOI20_xorsort) |
C++17 |
|
0 ms |
348 KB |
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define bitcount __builtin_popcountll
using namespace std;
using namespace __gnu_pbds;
using namespace chrono;
signed main() {
ios::sync_with_stdio(false);
cin.tie(nullptr), cout.tie(nullptr);
int n,s; cin >> n >> s;
int a[n]; for (int i = 0; i < n; cin >> a[i++]);
vector<pair<int,int>> operations;
auto oper = [&](int& x, int& y) {
x ^= y;
};
auto swap = [&](int i, int j) {
oper(a[i], a[j]);
oper(a[j], a[i]);
oper(a[i], a[j]);
operations.emplace_back(i, j);
operations.emplace_back(j, i);
operations.emplace_back(i, j);
};
for (int i = 0; i < n - 1; i++) {
for (int j = 0; j < n - i - 1; j++) {
if (a[j] > a[j + 1])
swap(j, j + 1);
}
}
for (int x : a) cout << x << " ";
for (auto [i, j] : operations) cout << 1+i << " " << 1+j << '\n';
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
Integer 176425 violates the range [1, 5] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
Integer 176425 violates the range [1, 5] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
344 KB |
Integer 321675 violates the range [1, 5] |
2 |
Halted |
0 ms |
0 KB |
- |