Submission #990961

# Submission time Handle Problem Language Result Execution time Memory
990961 2024-05-31T21:08:19 Z alexdd MalnaRISC (COI21_malnarisc) C++17
0 / 100
0 ms 348 KB
#include<bits/stdc++.h>
using namespace std;
int n;
bool visited[105];
void afis(int x, int y)
{
    cout<<"CMPSWP R"<<x<<" R"<<y<<" ";
}
vector<pair<int,int>> sol[100];
vector<pair<int,int>> aux;
int cnts;
signed main()
{
    cin>>n;
    for(int p=0;(1<<p)<n;p++)
    {
        for(int i=1;i<=n;i++)
        {
            visited[i]=0;
        }
        cnts++;
        bool bl=0;
        for(int i=1;i+(1<<p)<=n;i++)
        {
            if(!visited[i])
            {
                sol[cnts].push_back({i,i+(1<<p)});
                visited[i+(1<<p)]=1;
            }
            else
                bl=1;
        }
        if(!bl)
            continue;
        cnts++;
        for(int i=1;i+(1<<p)<=n;i++)
        {
            if(visited[i])
            {
                sol[cnts].push_back({i,i+(1<<p)});
            }
        }
    }
    cout<<cnts<<"\n";
    for(int i=1;i<=cnts;i++)
    {
        for(auto x:sol[i])
            afis(x.first,x.second);
        cout<<"\n";
    }
    return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB not sorted
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB not sorted
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB not sorted
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB not sorted
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB not sorted
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB not sorted
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB not sorted
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB not sorted
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB not sorted
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB not sorted
2 Halted 0 ms 0 KB -