Submission #990963

# Submission time Handle Problem Language Result Execution time Memory
990963 2024-05-31T21:10:59 Z alexdd MalnaRISC (COI21_malnarisc) C++17
0 / 100
1 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=7;p>0;p--)
    {
        int d = (1<<p)-1;
        if(d>=n) continue;
        for(int i=1;i<=n;i++)
            visited[i]=0;
        cnts++;
        bool bl=0;
        for(int i=1;i+d<=n;i++)
        {
            if(!visited[i])
            {
                sol[cnts].push_back({i,i+d});
                visited[i+d]=1;
            }
            else
                bl=1;
        }
        if(!bl)
            continue;
        cnts++;
        for(int i=1;i+d<=n;i++)
        {
            if(visited[i])
            {
                sol[cnts].push_back({i,i+d});
            }
        }
    }
    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 1 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 1 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 1 ms 344 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 1 ms 348 KB not sorted
2 Halted 0 ms 0 KB -