# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1089525 | Has2008 | Xor Sort (eJOI20_xorsort) | C++17 | 64 ms | 1500 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "bits/stdc++.h"
using namespace std;
#define int long long
#define endl endl
const int mod = 1e9 + 7;
const int maxn = 1e6;
int n, s, arr[maxn];
vector < pair < int, int >> ans;
void s1()
{
for (int i = n - 1; i >= 0; i--)
{
int p = -1;
for (int j = 0; j <= i; j++)
{
if (p == -1 || arr[p] < arr[j]) p = j;
if (j) ans.push_back({j - 1, j});
}
for (int j = p + 1; j <= i; j++) ans.push_back({j, j - 1});
for (int j = p - 2; j >= 0; j--) ans.push_back({j, j + 1});
for (int j = p; j + 1 < n; j++) swap(arr[j], arr[j + 1]);
}
for (int i = n - 2; i >= 0; --i) ans.push_back({i, i + 1});
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |