This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |