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>
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();
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |