답안 #685219

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
685219 2023-01-23T17:13:44 Z alexdd Costinland (info1cup19_costinland) C++17
71.589 / 100
2 ms 724 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];
void afisare()
{
    int undex=0,undey=0;
    for(int i=1;i<=500;i++)
    {
        for(int j=1;j<=500;j++)
        {
            if(mat[i][j]=='X')
            {
                undex=i;
                undey=max(undey,j);
            }
        }
    }
    undex++;
    undey++;
    for(int i=1;i<=undex;i++)
        mat[i][undey]='d';
    for(int i=1;i<=undey;i++)
        mat[undex][i]='r';

    mat[undex][undey]='.';
    cout<<undex<<" "<<undey<<"\n";
    for(int i=1;i<=undex;i++)
    {
        for(int j=1;j<=undey;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,sca=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+1][i+2] = 'X';
                mat[i+2][i+1] = 'r';
            }
            cate*=2;
        }
        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:47:18: warning: variable 'unde' set but not used [-Wunused-but-set-variable]
   47 |     int k,cate=1,unde=0,sca=0;
      |                  ^~~~
costinland.cpp:47:25: warning: unused variable 'sca' [-Wunused-variable]
   47 |     int k,cate=1,unde=0,sca=0;
      |                         ^~~
costinland.cpp: In function 'void afisare()':
costinland.cpp:29:22: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=]
   29 |     mat[undex][undey]='.';
      |     ~~~~~~~~~~~~~~~~~^~~~
costinland.cpp:7:6: note: at offset 0 to object 'mat' with size 1000000 declared here
    7 | char mat[1000][1000];
      |      ^~~
# 결과 실행 시간 메모리 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: 3
4 Correct 1 ms 724 KB Correct! Your size: 4
5 Correct 1 ms 724 KB Correct! Your size: 4
6 Correct 1 ms 724 KB Correct! Your size: 4
7 Correct 1 ms 724 KB Correct! Your size: 4
8 Correct 1 ms 724 KB Correct! Your size: 5
9 Correct 1 ms 724 KB Correct! Your size: 5
# 결과 실행 시간 메모리 Grader output
1 Partially correct 1 ms 724 KB Partially Correct! Your size: 59
2 Partially correct 1 ms 724 KB Partially Correct! Your size: 59
3 Partially correct 2 ms 724 KB Partially Correct! Your size: 60
4 Partially correct 1 ms 724 KB Partially Correct! Your size: 60
5 Partially correct 1 ms 724 KB Partially Correct! Your size: 60
6 Partially correct 1 ms 724 KB Partially Correct! Your size: 61
7 Partially correct 1 ms 724 KB Partially Correct! Your size: 61
8 Partially correct 1 ms 724 KB Partially Correct! Your size: 58