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 int long long
using namespace std;
vector <int> a(1005);
signed main() {
int n, s;
cin >> n >> s;
for (int i = 1; i <= n; i++) {
cin >> a[i];
}
queue <pair <int, int>> q;
for (int i = 1; i < n; i++) {
if (a[i] >= a[i+1]) {
int check = a[i] ^ a[i+1];
if (check < a[i]) {
a[i] = check;
q.push({i, i+1});
}
else {
a[i+1] = check;
q.push({i+1, i});
}
}
else if (a[i] <= a[i-1]) {
a[i] ^= a[i-1];
q.push({i, i-1});
}
}
cout << q.size() << "\n";
while (!q.empty()) {
cout << q.front().first << " " << q.front().second << "\n";
q.pop();
}
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |