# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1135151 | RaduM | Xor Sort (eJOI20_xorsort) | C++20 | 4 ms | 972 KiB |
#include <bits/stdc++.h>
using namespace std;
int v[1005];
map <int, int> mp;
vector < pair <int, int> > sol;
void divide(int st, int dr){
if(st == dr) return;
int b2 = -1, p = 0;
for(int i = st; i <= dr; i++){
if(31 - __builtin_clz(v[i]) > b2){
b2 = 31 - __builtin_clz(v[i]);
p = i;
}
}
if(b2 < 0) return;
for(int i = p; i < dr; i++){
if((1 << b2) & v[i + 1]){
sol.push_back({i, i + 1});
v[i] ^= v[i + 1];
}
else{
sol.push_back({i + 1, i});
v[i + 1] ^= v[i];
sol.push_back({i, i + 1});
v[i] ^= v[i + 1];
}
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |