답안 #1012761

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1012761 2024-07-02T14:48:24 Z Nika533 Costinland (info1cup19_costinland) C++14
100 / 100
1 ms 348 KB
#pragma gcc diagnostic "-std=c++1z"
#include <bits/stdc++.h>
#define int long long
#define pb push_back
#define f first
#define s second
#define MOD 1000000007
#define pii pair<int,int>
#define all(x) (x).begin(),(x).end()
#define allr(x) (x).rbegin(),(x).rend()
using namespace std;
int n,m,T,k;
void test_case() {
     n=49; m=49;
     cin>>k; 
     if (k<=19) {
          n=5; m=5;
     }
     char arr[n+5][m+5];
     for (int i=1; i<=n; i++) {
          for (int j=1; j<=m; j++) {
               arr[i][j]='.';
          }
     }
     for (int i=1; i<=n-1; i++) arr[i][m]='d';
     for (int i=1; i<=m-1; i++) arr[n][i]='r';

     vector<int> v; v.pb(1e9);
     while (k) {
          v.pb(k%6); k/=6;
     }
     int sz=v.size()-1;

     for (int i=1; i<sz; i++) {
          int j=1+(i-1)*2;
          arr[j][j]='X';
          arr[j+1][j]='X';
          arr[j][j+1]='X';
          arr[j+1][j+1]='X';
          arr[j][j+2]='d';
          arr[j+1][j+2]='d';
          arr[j+2][j]='r';
          arr[j+2][j+1]='r';
          if (v[i]==1) {
               arr[j][j+2]='X';
          }
          if (v[i]==2) {
               arr[j][j+2]='X';
               arr[j+2][j]='X';
          }
          if (v[i]==3) {
               arr[j+1][j+2]='X';
          }
          if (v[i]==4) {
               arr[j][j+2]='X';
               arr[j+1][j+2]='X';
          }
          if (v[i]==5) {
               arr[j][j+2]='X';
               arr[j+2][j]='X';
               arr[j+1][j+2]='X';
          }
     }

     int j=1+(sz-1)*2;
     if (v[sz]==2) {
          arr[j][j]='X';
     }
     if (v[sz]==3) {
          arr[j][j]='X';
          arr[j][j+1]='X';
     }
     if (v[sz]==4) {
          arr[j][j]='X';
          arr[j][j+1]='X';
          arr[j+1][j]='X';
     }
     if (v[sz]==5) {
          arr[j][j]='X';
          arr[j][j+1]='X';
          arr[j+1][j]='X';
          arr[j+2][j]='X';
     }


     cout<<n<<" "<<m<<endl;
     for (int i=1; i<=n; i++) {
          for (int j=1; j<=m; j++) {
               cout<<arr[i][j];
          }
          cout<<endl;
     }
}
main () {
	ios :: sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
	T=1; 
	while (T--) test_case();
}

Compilation message

costinland.cpp:1: warning: ignoring '#pragma gcc diagnostic' [-Wunknown-pragmas]
    1 | #pragma gcc diagnostic "-std=c++1z"
      | 
costinland.cpp:94:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   94 | main () {
      | ^~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Correct! Your size: 5
2 Correct 0 ms 348 KB Correct! Your size: 5
3 Correct 0 ms 348 KB Correct! Your size: 5
4 Correct 0 ms 348 KB Correct! Your size: 5
5 Correct 0 ms 348 KB Correct! Your size: 5
6 Correct 0 ms 348 KB Correct! Your size: 5
7 Correct 0 ms 348 KB Correct! Your size: 5
8 Correct 0 ms 348 KB Correct! Your size: 5
9 Correct 0 ms 348 KB Correct! Your size: 5
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Correct! Your size: 49
2 Correct 0 ms 348 KB Correct! Your size: 49
3 Correct 0 ms 348 KB Correct! Your size: 49
4 Correct 0 ms 348 KB Correct! Your size: 49
5 Correct 1 ms 344 KB Correct! Your size: 49
6 Correct 0 ms 348 KB Correct! Your size: 49
7 Correct 0 ms 348 KB Correct! Your size: 49
8 Correct 0 ms 348 KB Correct! Your size: 49