#include <bits/stdc++.h>
using namespace std;
#define int long long
#define fs first
#define sc second
#define mp make_pair
#define FOR(i, j, k) for (int i = j, Z = k; i < Z; i++)
typedef pair<int, int> pii;
const int MXN = 50;
int x;
int n;
char c[MXN][MXN];
vector<pii> w[6] = {
vector<pii>{},
vector<pii>{mp(2LL, 0LL)},
vector<pii>{mp(2LL, 0LL), mp(0LL, 2LL)},
vector<pii>{mp(2LL, 1LL)},
vector<pii>{mp(2LL, 0LL), mp(2LL, 1LL)},
vector<pii>{mp(2LL, 0LL), mp(2LL, 1LL), mp(0LL, 2LL)}
};
vector<int> base6(int x) {
vector<int> v;
while (x) {
v.push_back(x % 6);
x /= 6;
}
return v;
}
void miku() {
cin >> x;
n = (x < 20 ? 5 : 49);
FOR(i, 0, n) FOR(j, 0, n) c[i][j] = '.';
FOR(i, 0, n - 1) {
c[n - 1][i] = 'r';
c[i][n - 1] = 'd';
}
vector<int> v = base6(x);
FOR(i, 0, v.size() - 1) {
int now = 2 * i;
c[now + 0][now + 0] = 'X';
c[now + 0][now + 1] = 'X';
c[now + 1][now + 0] = 'X';
c[now + 1][now + 1] = 'X';
c[now + 2][now + 0] = 'r';
c[now + 2][now + 1] = 'r';
c[now + 0][now + 2] = 'd';
c[now + 1][now + 2] = 'd';
for (auto [dx, dy] : w[v[i]]) c[now + dx][now + dy] = 'X';
}
int now = 2 * (v.size() - 1);
if (v.back() > 1) c[now + 0][now + 0] = 'X';
if (v.back() > 2) c[now + 1][now + 0] = 'X';
if (v.back() > 3) c[now + 0][now + 1] = 'X';
if (v.back() > 4) c[now + 0][now + 2] = 'X';
cout << n << ' ' << n << '\n';
FOR(i, 0, n) {
FOR(j, 0, n) cout << c[i][j];
cout << '\n';
}
}
int32_t main() {
cin.tie(0) -> sync_with_stdio(false);
cin.exceptions(cin.failbit);
int t;
cin >> t;
while (t--) miku();
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
2 ms |
600 KB |
Execution killed with signal 6 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
2 ms |
604 KB |
Execution killed with signal 6 |
2 |
Halted |
0 ms |
0 KB |
- |