#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 |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Incorrect |
0 ms |
308 KB |
Not sorted |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Incorrect |
0 ms |
308 KB |
Not sorted |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
308 KB |
Not sorted |
2 |
Halted |
0 ms |
0 KB |
- |