Submission #685167

# Submission time Handle Problem Language Result Execution time Memory
685167 2023-01-23T16:05:33 Z alexdd Costinland (info1cup19_costinland) C++17
0 / 100
1 ms 340 KB
#pragma GCC optimize("O3,unroll-loops")
#include<bits/stdc++.h>
using namespace std;
//ofstream fout("costin.out");
#define int long long
const int INF = 1000000007;
char mat[51][51];
int put(int a, int exp)
{
    if(exp==0) return 1;
    if(exp%2==0) return put(a*a,exp/2);
    return put(a*a,exp/2)*a;
}
void solve(int clin, int ccol, int k)
{
    if(k==0)
        return;
    int x=clin,y=ccol;
    for(int i=0;put(2,i)<=k;i++)
    {
        x++;
        y++;
        mat[clin+i][ccol+i]='X';
        if(put(2,i+1)<=k)
        {
            mat[clin+i+1][ccol+i]='r';
            mat[clin+i][ccol+i+1]='d';
        }
        else
        {
            k-=put(2,i);
            break;
        }
    }
    solve(x,y,k);
}
signed main()
{
    ios_base::sync_with_stdio(0);cin.tie(0);

    for(int i=1;i<=49;i++)
        for(int j=1;j<=49;j++)
            mat[i][j]='.';

    int k;
    cin>>k;
    solve(1,1,k);
    /*for(int i=1;i<=50;i++)
    {
        if(put(2,i-1)>k)
            break;
        mat[i][i]='X';
        mat[i-1][i]='d';
        mat[i][i-1]='r';
    }*/
    for(int i=1;i<=49;i++)
    {
        mat[i][49]='d';
        mat[49][i]='r';
    }
    mat[49][49]='.';
    cout<<49<<" "<<49<<"\n";
    for(int i=1;i<=49;i++)
    {
        for(int j=1;j<=49;j++)
        {
            cout<<mat[i][j];
        }
        cout<<"\n";
    }
    return 0;
}
/**

*/

# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB The matrix does not generate the required number of Costins
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 340 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -