#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=62; m=62;
cin>>k;
if (k<=19) {
n=6; m=6;
}
k--;
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';
arr[1][1]='d'; arr[2][1]='X';
int p=0,k1=k;
while (k1) {
k1/=2; p++;
}
for (int i=2; i<=n; i++) {
for (int j=2; j<=m; j++) {
if ((i+j-2)<=p) arr[i][j]='X';
}
}
for (int i=p-2; i>=0; i--) {
if (k&(1ll<<i)) {
int ind=((p-2)-i)+3;
arr[ind][1]='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:59:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
59 | main () {
| ^~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Partially correct |
0 ms |
344 KB |
Partially Correct! Your size: 6 |
2 |
Partially correct |
0 ms |
348 KB |
Partially Correct! Your size: 6 |
3 |
Partially correct |
0 ms |
348 KB |
Partially Correct! Your size: 6 |
4 |
Partially correct |
0 ms |
348 KB |
Partially Correct! Your size: 6 |
5 |
Partially correct |
1 ms |
348 KB |
Partially Correct! Your size: 6 |
6 |
Partially correct |
0 ms |
348 KB |
Partially Correct! Your size: 6 |
7 |
Partially correct |
1 ms |
344 KB |
Partially Correct! Your size: 6 |
8 |
Partially correct |
0 ms |
348 KB |
Partially Correct! Your size: 6 |
9 |
Partially correct |
0 ms |
348 KB |
Partially Correct! Your size: 6 |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Partially correct |
1 ms |
348 KB |
Partially Correct! Your size: 62 |
2 |
Partially correct |
1 ms |
348 KB |
Partially Correct! Your size: 62 |
3 |
Partially correct |
0 ms |
348 KB |
Partially Correct! Your size: 62 |
4 |
Partially correct |
1 ms |
348 KB |
Partially Correct! Your size: 62 |
5 |
Partially correct |
0 ms |
348 KB |
Partially Correct! Your size: 62 |
6 |
Partially correct |
1 ms |
348 KB |
Partially Correct! Your size: 62 |
7 |
Partially correct |
0 ms |
348 KB |
Partially Correct! Your size: 62 |
8 |
Partially correct |
1 ms |
344 KB |
Partially Correct! Your size: 62 |