#include <bits/stdc++.h>
using namespace std;
#define int long long
#define fs first
#define sc second
#define mp make_pai
#define FOR(i, j, k) for (int i = j, Z = k; i < Z; i++)
const int MXN = 70;
int x;
int n, m;
string s[MXN];
void DO(int x) {
if (x == 3) {
s[0][0] = 'X';
s[0][1] = 'X';
} else if (x == 4) {
s[0][0] = 'X';
s[0][1] = 'X';
s[0][2] = 'X';
} else if (x == 5) {
s[0][0] = 'X';
s[0][1] = 'X';
s[0][2] = 'X';
s[0][3] = 'X';
} else if (x < 10) {
s[0][0] = 'X';
s[0][1] = 'X';
s[1][0] = 'X';
s[1][1] = 'X';
if (x >= 7) s[2][0] = 'X';
if (x >= 8) s[3][0] = 'X';
if (x >= 9) s[0][2] = 'X';
} else if (x < 15) {
s[0][0] = 'X';
s[0][1] = 'X';
s[1][0] = 'X';
s[1][1] = 'X';
s[2][0] = 'X';
s[2][1] = 'X';
if (x == 11) s[0][2] = 'X';
if (x == 12) s[1][2] = 'X';
if (x >= 13) s[2][2] = 'X';
if (x == 14) s[3][0] = 'X';
} else {
s[0][0] = 'X';
s[0][1] = 'X';
s[1][0] = 'X';
s[1][1] = 'X';
s[2][0] = 'X';
s[2][1] = 'X';
s[3][0] = 'X';
s[3][1] = 'X';
if (x > 15) s[x - 16][2] = 'X';
}
}
void miku() {
cin >> x;
if (x < 20) {
cout << 5 << ' ' << 5 << '\n';
n = 5, m = 5;
FOR(i, 0, 5) s[i] = string(5, '.');
FOR(i, 0, 4) {
s[4][i] = 'r';
s[i][4] = 'd';
}
DO(x);
FOR(i, 0, n) cout << s[i] << '\n';
return;
}
m = __lg(x) + 1;
n = __lg(x) + 2;
FOR(i, 0, n) s[i] = string(m, '.');
FOR(i, 0, m - 1) {
s[i][i] = 'X';
s[i][i + 1] = 'd';
s[i + 1][i] = ((x & (1LL << i)) ? 'X' : 'r');
s[n - 1][i] = 'r';
s[i][m - 1] = 'd';
}
s[m - 1][m - 1] = 'd';
cout << n << ' ' << m << '\n';
FOR(i, 0, n) cout << s[i] << '\n';
}
int32_t main() {
cin.tie(0) -> sync_with_stdio(false);
cin.exceptions(cin.failbit);
miku();
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Correct! Your size: 5 |
2 |
Correct |
0 ms |
344 KB |
Correct! Your size: 5 |
3 |
Correct |
0 ms |
348 KB |
Correct! Your size: 5 |
4 |
Correct |
0 ms |
344 KB |
Correct! Your size: 5 |
5 |
Correct |
1 ms |
348 KB |
Correct! Your size: 5 |
6 |
Correct |
0 ms |
348 KB |
Correct! Your size: 5 |
7 |
Correct |
1 ms |
344 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 |
Partially correct |
0 ms |
348 KB |
Partially Correct! Your size: 60 |
2 |
Partially correct |
1 ms |
348 KB |
Partially Correct! Your size: 60 |
3 |
Partially correct |
1 ms |
348 KB |
Partially Correct! Your size: 61 |
4 |
Partially correct |
1 ms |
348 KB |
Partially Correct! Your size: 61 |
5 |
Partially correct |
0 ms |
348 KB |
Partially Correct! Your size: 61 |
6 |
Partially correct |
0 ms |
348 KB |
Partially Correct! Your size: 61 |
7 |
Partially correct |
0 ms |
348 KB |
Partially Correct! Your size: 61 |
8 |
Partially correct |
1 ms |
348 KB |
Partially Correct! Your size: 59 |