Submission #486849

# Submission time Handle Problem Language Result Execution time Memory
486849 2021-11-13T01:30:48 Z ETK MalnaRISC (COI21_malnarisc) C++14
100 / 100
1 ms 296 KB
#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
1 Correct 0 ms 204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 288 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 288 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 296 KB Output is correct