Submission #1179492

#TimeUsernameProblemLanguageResultExecution timeMemory
1179492andriy57Xor Sort (eJOI20_xorsort)C++20
0 / 100
5 ms1468 KiB
#define _CRT_SECURE_NO_WARNINGS #include <bits/stdc++.h> using namespace std; #define forin for(int i = 1; i <= n; i++) #define lol long long #define lb long double #define endl '\n' #define pll pair<lol, lol> //priority_queue <pll, vector<pll>, greater<pll>> q const long long N = 210; lol ts, n, a[N], hmm, v1, v2, s, f[N], l; vector<pll> ans; void solve() { cin >> n >> s; a[0] = -1; forin cin >> a[i]; a[n + 1] = a[n] + 10; l = 40000; while (hmm == 0 && l > 0) { hmm = 1; forin if (a[i] >= a[i + 1] || a[i] <= a[i-1]) { hmm = 0; if (f[i] == 0 && i < n) { a[i] ^= a[i+1]; ans.push_back({ i, i + 1 }); } else { a[i] ^= a[i - 1]; ans.push_back({ i, i - 1 }); } f[i] = (f[i] % 2 == 0); } l--; } forin cout << a[i] << " "; cout << endl; cout << ans.size() << endl; for (auto el : ans) cout << el.first << " " << el.second << endl; } int main() { ts = 1; //cin >> ts; while(ts--) solve(); return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...