Submission #518797

# Submission time Handle Problem Language Result Execution time Memory
518797 2022-01-24T16:32:05 Z lucri Costinland (info1cup19_costinland) C++17
100 / 100
1 ms 336 KB
#include <iostream>
using namespace std;
long long m[60][60],k;
char r[60][60];
int main()
{
    cin>>k;
    r[1][1]='X';
    m[1][1]=1;
    for(long long i=1;i<=48;++i)
        for(long long j=1;j<=48;++j)
        {
            if(i<=j)
            {
                if(j-i<=2)
                {
                    r[i][j]='X';
                    m[i+1][j]+=m[i][j];
                    m[i][j+1]+=m[i][j];
                }
                else
                {
                    r[i][j]='.';
                    m[i][j+1]+=m[i][j];
                }
            }
            else
            {
                if(i-j==1)
                {
                    r[i][j]='X';
                    m[i][j+1]+=m[i][j];
                    m[i+1][j]+=m[i][j];
                }
                else
                {
                    r[i][j]='.';
                    m[i+1][j]+=m[i][j];
                }
            }
        }
    long long n=46;
    while(m[n][n]>k)
        --n;
    cout<<n+1<<' '<<n+1<<'\n';
    k-=m[n][n];
    r[n][n]='.';
    for(long long i=n-1;i>=1;--i)
    {
        if(m[i][n]>k)
            r[i][min(i+2,n)]='d';
        else
            k-=m[i][n];
        if(m[n][i]>k)
            r[i+1][i]='r';
        else
            k-=m[n][i];
    }
    for(long long i=1;i<=n;++i)
    {
        for(long long j=1;j<=n;++j)
            cout<<r[i][j];
        cout<<'d'<<'\n';
    }
    for(long long i=1;i<=n;++i)
        cout<<'r';
    cout<<'.';
    //cout<<k;
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Correct! Your size: 3
2 Correct 1 ms 208 KB Correct! Your size: 3
3 Correct 1 ms 208 KB Correct! Your size: 4
4 Correct 1 ms 208 KB Correct! Your size: 4
5 Correct 1 ms 300 KB Correct! Your size: 4
6 Correct 1 ms 208 KB Correct! Your size: 4
7 Correct 1 ms 208 KB Correct! Your size: 4
8 Correct 1 ms 208 KB Correct! Your size: 5
9 Correct 1 ms 336 KB Correct! Your size: 5
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Correct! Your size: 44
2 Correct 0 ms 204 KB Correct! Your size: 44
3 Correct 1 ms 336 KB Correct! Your size: 45
4 Correct 1 ms 208 KB Correct! Your size: 44
5 Correct 1 ms 208 KB Correct! Your size: 45
6 Correct 1 ms 208 KB Correct! Your size: 45
7 Correct 1 ms 300 KB Correct! Your size: 45
8 Correct 0 ms 208 KB Correct! Your size: 43