#include<bits/stdc++.h>
#define ll long long
using namespace std;
ll N,S,niz[1005],prefiks[1005];
int broj[1005],tosort[1005];
struct slog{
int x,y;
}pp;
queue<slog> Q;
void dodaj(int a,int b){
pp.x=a;
pp.y=b;
Q.push(pp);
}
void swapuj(int a,int b){
if(a>b)
swap(a,b);
pp.x=a;
pp.y=b;
Q.push(pp);
pp.x=b+1;
pp.y=b;
Q.push(pp);
return;
}
void ispis(){
cout<<Q.size()<<endl;
while(Q.size()){
pp=Q.front();
Q.pop();
cout<<pp.x<<" "<<pp.y<<endl;
}
exit(0);
}
int main(){
cin>>N>>S;
for(int i=1;i<=N;i++)
cin>>niz[i];
if(S==1){
return 0;
}
for(int step=(1<<19);step>=1;step/=2){
bool nemoj=true;
for(int i=1;i<=N;i++)
if(niz[i]&step)
nemoj=false;
if(nemoj)
continue;
for(int i=1;i<N;i++)
if((niz[i]&step)>0 and (niz[i+1]&step)==0){
niz[i+1]^=niz[i];
dodaj(i+1,i);
}
for(int i=1;i<N;i++){
if(niz[i]&step){
niz[i]^=niz[i+1];
dodaj(i,i+1);
}
}
N--;
}
ispis();
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
308 KB |
Unexpected end of file - int32 expected |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
308 KB |
Unexpected end of file - int32 expected |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
340 KB |
Output is correct |
3 |
Correct |
2 ms |
304 KB |
Output is correct |
4 |
Correct |
8 ms |
340 KB |
Output is correct |
5 |
Correct |
37 ms |
720 KB |
Output is correct |
6 |
Correct |
47 ms |
772 KB |
Output is correct |
7 |
Correct |
37 ms |
728 KB |
Output is correct |
8 |
Correct |
45 ms |
792 KB |
Output is correct |
9 |
Correct |
37 ms |
784 KB |
Output is correct |
10 |
Correct |
38 ms |
768 KB |
Output is correct |
11 |
Correct |
39 ms |
680 KB |
Output is correct |
12 |
Correct |
39 ms |
704 KB |
Output is correct |
13 |
Correct |
40 ms |
760 KB |
Output is correct |
14 |
Correct |
43 ms |
844 KB |
Output is correct |
15 |
Correct |
56 ms |
992 KB |
Output is correct |