# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
734828 | rahidilbayramli | Xor Sort (eJOI20_xorsort) | C++17 | 1 ms | 212 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>
#define ll long long
#define pll pair<ll, ll>
#define pii pair<int, int>
#define vl vector<ll>
#define sl set<ll>
#define pb push_back
#define all(v) v.begin(), v.end()
#define f first
#define s second
#define ld long double
using namespace std;
int main()
{
ll n, k, i, l = 0;
cin >> n >> k;
vl v(n);
for(ll&h : v) cin >> h;
if(k == 1)
{
vector<pll>v1;
for(i = 0; i < n - 1; i++)
{
if(v[i] > v[i+1] && v1.size() == 0)
v1.pb({i+1, i+2});
else if(v[i] > v[i+1] && v1.size() != 0)
v1.pb({i+2, i+1});
}
cout << v1.size() << "\n";
for(const pll x : v1) cout << x.f << ' ' << x.s << "\n";
}
}
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... |