#include<bits/stdc++.h>
using namespace std;
int main () {
int n, s;
cin >> n >> s;
int a[n];
for(int i = 0;i<n;i++)cin >> a[i];
if(s==2) {
vector<pair<int,int>> op;
for(int i = 19;i>=0;i--) {
for(int j = 1;j<n;j++) {
if((a[j]&(1<<i))==0 and (a[j-1]&(1<<i))!=0) {
a[j]^=a[j-1];
op.push_back({j,j-1});
}
if((a[j-1]&(1<<i))!=0) {
if((a[j-1]^a[j])<a[j-1]) {
a[j-1]^=a[j];
op.push_back({j-1,j});
}
}
}
}
cout << op.size() << "\n";
for(auto i:op) {
cout << i.first+1 << " " << i.second+1 << "\n";
}
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
Unexpected end of file - int32 expected |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
Unexpected end of file - int32 expected |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
296 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
2 ms |
428 KB |
Output is correct |
5 |
Correct |
6 ms |
848 KB |
Output is correct |
6 |
Correct |
7 ms |
852 KB |
Output is correct |
7 |
Correct |
6 ms |
876 KB |
Output is correct |
8 |
Correct |
6 ms |
976 KB |
Output is correct |
9 |
Correct |
5 ms |
812 KB |
Output is correct |
10 |
Correct |
6 ms |
848 KB |
Output is correct |
11 |
Correct |
6 ms |
808 KB |
Output is correct |
12 |
Correct |
6 ms |
848 KB |
Output is correct |
13 |
Correct |
8 ms |
920 KB |
Output is correct |
14 |
Correct |
6 ms |
848 KB |
Output is correct |
15 |
Correct |
8 ms |
1064 KB |
Output is correct |