Submission #1020135

#TimeUsernameProblemLanguageResultExecution timeMemory
1020135coolboy19521Xor Sort (eJOI20_xorsort)C++17
25 / 100
5 ms1608 KiB
#include "bits/stdc++.h" #define int long long using namespace std; const int sz = 155; int a[sz]; signed main() { cin.tie(nullptr)->sync_with_stdio(false); int n, s; cin >> n >> s; for (int i = 1; i <= n; i ++) cin >> a[i]; vector<pair<int,int>> v; for (int i = 1; i <= n; i ++) for (int j = n-1; i <= j; j --) if (a[j+1] < a[j]) { v.push_back(make_pair(j, j+1)); v.push_back(make_pair(j+1, j)); v.push_back(make_pair(j, j+1)); swap(a[j], a[j+1]); } cout << v.size() << '\n'; for (auto& p : v) cout << p.first << ' ' << p.second << '\n'; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...