# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
466049 | 2021-08-17T15:48:20 Z | gagik_2007 | Xor Sort (eJOI20_xorsort) | C++17 | 1 ms | 204 KB |
#include <iostream> #include <cmath> #include <algorithm> #include <vector> #include <string> #include <set> #include <map> #include <queue> #include <deque> #include <stack> #include <iomanip> #include <unordered_set> using namespace std; #define ll long long #define ff first #define ss second ll n, m, m1, m2, k; ll MOD = 1e9 + 7; ll INF = 1e18 + 7; ll ttt; ll a[1007]; vector<pair<ll, ll>>ans; int main() { cin >> n >> m; for (int i = 0; i < n; i++) { cin >> a[i]; } for (int i = 0; i < n - 1; i++) { for (int j = 0; j < n - i - 1; j++) { if (a[j] > a[j + 1]) { ans.push_back({ j + 1,j }); ans.push_back({ j,j + 1 }); ans.push_back({ j + 1,j }); ll tmp = a[j]; a[j] = a[j + 1]; a[j + 1] = tmp; } } } cout << ans.size() << endl; for (int i = 0; i < ans.size(); i++) { cout << ans[i].ff << " " << ans[i].ss << endl; } return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 204 KB | Integer 0 violates the range [1, 5] |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 204 KB | Integer 0 violates the range [1, 5] |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 204 KB | Integer 0 violates the range [1, 5] |
2 | Halted | 0 ms | 0 KB | - |