#include <bits/stdc++.h>
using namespace std;
#define EmiliaMyWife ios::sync_with_stdio(0); cin.tie(0);
using ll = int64_t;
using ull = uint64_t;
using uint = uint32_t;
using ld = long double;
const int INF = 0x3f3f3f3f;
const int MOD = 1e9 + 7;
const ll LINF = ll(2e18) + ll(1e15);
const double EPS = 1e-8;
static auto LamyIsCute = []() {
EmiliaMyWife
return 48763;
}();
signed main() {
ll k;
cin >> k;
const int n = __lg(k) + 1, m = __lg(k) + 2;
vector<string> arr(n, string(m, '.'));
for(int i = 0; i + 1 < n; i++) {
arr[i][i + 1] = 'X';
arr[i][i + 2] = 'd';
arr[i + 1][i + 1] = 'r';
}
for(int i = 0; i < n; i++) {
//cout << k << ' ' << (k >> (n - i)) << '\n';
if(k >> (n - i - 1) & 1) {
if((k & -k) >> (n - i - 1) & 1)
arr[i][0] = 'r';
else
arr[i][0] = 'X';
}
else
arr[i][0] = 'd';
}
for(int i = 0; i < n; i++)
for(int j = 0; j < m; j++)
if(arr[i][j] == '.')
arr[i][j] = 'r';
for(int i = 0; i < n; i++)
arr[i][m - 1] = 'd';
for(int i = 0; i < m; i++)
arr[n - 1][i] = 'r';
arr[n - 1][m - 1] = '.';
cout << n << ' ' << m << '\n';
for(const auto &s : arr)
cout << s << '\n';
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
256 KB |
Correct! Your size: 3 |
2 |
Correct |
1 ms |
204 KB |
Correct! Your size: 4 |
3 |
Correct |
1 ms |
244 KB |
Correct! Your size: 4 |
4 |
Correct |
1 ms |
204 KB |
Correct! Your size: 4 |
5 |
Correct |
0 ms |
204 KB |
Correct! Your size: 4 |
6 |
Correct |
0 ms |
204 KB |
Correct! Your size: 5 |
7 |
Correct |
1 ms |
204 KB |
Correct! Your size: 5 |
8 |
Correct |
0 ms |
204 KB |
Correct! Your size: 5 |
9 |
Partially correct |
1 ms |
316 KB |
Partially Correct! Your size: 6 |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Partially correct |
0 ms |
204 KB |
Partially Correct! Your size: 60 |
2 |
Partially correct |
0 ms |
204 KB |
Partially Correct! Your size: 60 |
3 |
Partially correct |
1 ms |
204 KB |
Partially Correct! Your size: 61 |
4 |
Partially correct |
0 ms |
204 KB |
Partially Correct! Your size: 61 |
5 |
Partially correct |
1 ms |
332 KB |
Partially Correct! Your size: 61 |
6 |
Partially correct |
1 ms |
204 KB |
Partially Correct! Your size: 61 |
7 |
Partially correct |
1 ms |
204 KB |
Partially Correct! Your size: 61 |
8 |
Partially correct |
1 ms |
204 KB |
Partially Correct! Your size: 59 |