Submission #685197

# Submission time Handle Problem Language Result Execution time Memory
685197 2023-01-23T16:52:43 Z alexdd Costinland (info1cup19_costinland) C++17
56.5784 / 100
1 ms 824 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[1000][1000];
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 afisare()
{
    int unde=0;
    for(int i=1;i<=500;i++)
    {
        for(int j=1;j<=500;j++)
        {
            if(mat[i][j]=='X')
                unde=i;
        }
    }
    unde++;
    for(int i=1;i<=unde;i++)
    {
        mat[i][unde]='d';
        mat[unde][i]='r';
    }
    mat[unde][unde]='.';
    cout<<unde<<" "<<unde<<"\n";
    for(int i=1;i<=unde;i++)
    {
        for(int j=1;j<=unde;j++)
        {
            cout<<mat[i][j];
        }
        cout<<"\n";
    }
}
signed main()
{
    ios_base::sync_with_stdio(0);cin.tie(0);

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

    int k,cate=1,unde=0;
    cin>>k;
    for(int i=0;i<500;i++)
    {
        if(k==0)
            break;
        unde=i+1;
        if((k&(cate))!=0)
        {
            k-=cate;
            if(k>0)
            {
                mat[i+1][i+1] = 'X';
                mat[i+2][i+1] = 'r';
            }
        }
        else
        {
            mat[i+1][i+1] = 'X';
            mat[i+1][i+2] = 'd';
            mat[i+2][i+1] = 'r';
            cate=cate*2;
        }
    }
    afisare();

    return 0;
}
/**

*/

Compilation message

costinland.cpp: In function 'int main()':
costinland.cpp:50:18: warning: variable 'unde' set but not used [-Wunused-but-set-variable]
   50 |     int k,cate=1,unde=0;
      |                  ^~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 724 KB Correct! Your size: 3
2 Correct 1 ms 724 KB Correct! Your size: 3
3 Correct 1 ms 724 KB Correct! Your size: 4
4 Correct 1 ms 724 KB Correct! Your size: 4
5 Correct 1 ms 724 KB Correct! Your size: 5
6 Correct 1 ms 820 KB Correct! Your size: 4
7 Correct 1 ms 724 KB Correct! Your size: 5
8 Partially correct 1 ms 724 KB Partially Correct! Your size: 6
9 Partially correct 1 ms 724 KB Partially Correct! Your size: 7
# Verdict Execution time Memory Grader output
1 Partially correct 1 ms 724 KB Partially Correct! Your size: 85
2 Partially correct 1 ms 724 KB Partially Correct! Your size: 93
3 Partially correct 1 ms 724 KB Partially Correct! Your size: 92
4 Partially correct 1 ms 724 KB Partially Correct! Your size: 76
5 Partially correct 1 ms 724 KB Partially Correct! Your size: 87
6 Partially correct 1 ms 824 KB Partially Correct! Your size: 83
7 Partially correct 1 ms 724 KB Partially Correct! Your size: 80
8 Partially correct 1 ms 724 KB Partially Correct! Your size: 86