#include<bits/stdc++.h>
using namespace std;
#define rep(a, b) for(int a = 0; a < (b); ++a)
#define pb push_back
#define st first
#define nd second
const int LIM=1e3+7;
int T[LIM], n;
void solve2() {
vector<pair<int,int>>ans;
for(int i=19; i>=0; --i) {
if(!n) break;
rep(j, n-1) {
if(T[j]&(1<<i)) {
if(!(T[j+1]&(1<<i))) {
ans.pb({j+1, j});
T[j+1]^=T[j];
}
ans.pb({j, j+1});
T[j]^=T[j+1];
}
}
}
cout << ans.size() << '\n';
for(auto i : ans) cout << i.st+1 << " " << i.nd+1 << '\n';
}
int main() {
ios_base::sync_with_stdio(0); cin.tie(0);
int typ;
cin >> n >> typ;
rep(i, n) cin >> T[i];
if(typ==2) solve2();
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
204 KB |
Unexpected end of file - int32 expected |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
204 KB |
Unexpected end of file - int32 expected |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
204 KB |
Not sorted |
2 |
Halted |
0 ms |
0 KB |
- |