# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
734828 | 2023-05-03T06:51:24 Z | rahidilbayramli | Xor Sort (eJOI20_xorsort) | C++17 | 1 ms | 212 KB |
#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
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 212 KB | Not sorted |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 212 KB | Not sorted |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 212 KB | Unexpected end of file - int32 expected |
2 | Halted | 0 ms | 0 KB | - |