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>
#define rep(i,a,b) for(int i=(a);i<=(b);++i)
#define fi first
#define se second
using namespace std;
int n;
int main(){
cin>>n;
int ans=0;
for(int p=1;p<n;p<<=1){
ans++;
}
ans=ans*(ans+1)/2;
cout<<ans<<"\n";
for(int p=1;p<n;p<<=1){
for(int k=p;k;k>>=1){
for(int j=k%p;j<=n-k-1;j+=2*k){
rep(i,0,min(k-1,n-j-k-1)){
if((i+j)/(2*p)==(i+j+k)/(2*p))
cout<<"CMPSWP R"<<i+j+1<<" R"<<i+j+k+1<<" ";
}
}
puts("");
}
}
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |