이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#define int long long
#define pii pair<int,int>
#define pll pair<ll,ll>
using namespace std;
int n,m,k,i,j,ans,x,y;
char a[600][600];
signed main() {
cin>>m;
i=1;
while(i*6<=m){
i*=6;
n++;
}
n*=2;
n+=3;
int p=m%6;
for(i = 1; i <= n; i++) for(j = 1; j <= n; j++)a[i][j]='.';
for(i=1; i<n; i++){a[i][n]='d'; a[n][i]='r';}
if(n)
for(i=1;i<n-3;i+=2){
a[i][i]=a[i+1][i]=a[i+1][i+1]=a[i][i+1]='X';
a[i+2][i]=a[i+2][i+1]='r';
a[i][i+2]=a[i+1][i+2]='d';
if(m%6==1)a[i+2][i]='X';
if(m%6==2)a[i+2][i]=a[i][i+2]='X';
if(m%6==3)a[i+2][i+1]='X';
if(m%6==4)a[i+2][i+1]=a[i+2][i]='X';
if(m%6==5)a[i+2][i+1]=a[i+2][i]=a[i][i+2]='X';
m/=6;
}
i=n-2;
if(m==2)a[i][i]='X';
if(m==3)a[i][i]=a[i+1][i]='X';
if(m==4)a[i][i]=a[i+1][i]=a[i][i+1]='X';
if(m==5){a[i][i]=a[i+1][i]=a[i+1][i+1]='X'; a[i][i+1]='d'; }
cout<<n<<" "<<n<<"\n";
for(i = 1; i <= n; i++){
for(j = 1; j <= n; j++){
cout<< a[i][j];
}
cout<<"\n";
}
}
컴파일 시 표준 에러 (stderr) 메시지
costinland.cpp: In function 'int main()':
costinland.cpp:17:9: warning: unused variable 'p' [-Wunused-variable]
17 | int p=m%6;
| ^
costinland.cpp:36:43: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=]
36 | if(m==5){a[i][i]=a[i+1][i]=a[i+1][i+1]='X'; a[i][i+1]='d'; }
| ~~~~~~~~~~~^~~~
costinland.cpp:7:6: note: at offset 0 to object 'a' with size 360000 declared here
7 | char a[600][600];
| ^
costinland.cpp:36:31: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=]
36 | if(m==5){a[i][i]=a[i+1][i]=a[i+1][i+1]='X'; a[i][i+1]='d'; }
| ~~~~~~~~~^~~~~~~~~~~~~~~~
costinland.cpp:7:6: note: at offset 0 to object 'a' with size 360000 declared here
7 | char a[600][600];
| ^
costinland.cpp:36:21: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=]
36 | if(m==5){a[i][i]=a[i+1][i]=a[i+1][i+1]='X'; a[i][i+1]='d'; }
| ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
costinland.cpp:7:6: note: at offset 0 to object 'a' with size 360000 declared here
7 | char a[600][600];
| ^
costinland.cpp:36:58: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=]
36 | if(m==5){a[i][i]=a[i+1][i]=a[i+1][i+1]='X'; a[i][i+1]='d'; }
| ~~~~~~~~~^~~~
costinland.cpp:7:6: note: at offset 0 to object 'a' with size 360000 declared here
7 | char a[600][600];
| ^
costinland.cpp:35:40: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=]
35 | if(m==4)a[i][i]=a[i+1][i]=a[i][i+1]='X';
| ~~~~~~~~~^~~~
costinland.cpp:7:6: note: at offset 0 to object 'a' with size 360000 declared here
7 | char a[600][600];
| ^
costinland.cpp:35:30: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=]
35 | if(m==4)a[i][i]=a[i+1][i]=a[i][i+1]='X';
| ~~~~~~~~~^~~~~~~~~~~~~~
costinland.cpp:7:6: note: at offset 0 to object 'a' with size 360000 declared here
7 | char a[600][600];
| ^
costinland.cpp:35:20: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=]
35 | if(m==4)a[i][i]=a[i+1][i]=a[i][i+1]='X';
| ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
costinland.cpp:7:6: note: at offset 0 to object 'a' with size 360000 declared here
7 | char a[600][600];
| ^
costinland.cpp:34:30: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=]
34 | if(m==3)a[i][i]=a[i+1][i]='X';
| ~~~~~~~~~^~~~
costinland.cpp:7:6: note: at offset 0 to object 'a' with size 360000 declared here
7 | char a[600][600];
| ^
costinland.cpp:34:20: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=]
34 | if(m==3)a[i][i]=a[i+1][i]='X';
| ~~~~~~~^~~~~~~~~~~~~~
costinland.cpp:7:6: note: at offset 0 to object 'a' with size 360000 declared here
7 | char a[600][600];
| ^
costinland.cpp:33:20: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=]
33 | if(m==2)a[i][i]='X';
| ~~~~~~~^~~~
costinland.cpp:7:6: note: at offset 0 to object 'a' with size 360000 declared here
7 | char a[600][600];
| ^
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |