#define wiwihorz
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma loop-opt(on)
#define rep(i, a, b) for(int i = a; i <= b; i ++)
using namespace std;
#define int long long int
#define pii pair<int, int>
namespace solver {
vector<vector<char>> a = {
{'X', 'X', 'd'},
{'X', 'X', 'd'},
{'r', 'r', '.'}
};
vector<pii> dots = {{0, 0}, {0, 1}, {1, 0}, {1, 1}};
vector<vector<pii>> pos = {
{{0, 0}},
{{0, 2}},
{{0, 2}, {2, 0}},
{{1, 2}},
{{0, 2}, {1, 2}},
{{0, 2}, {1, 2}, {2, 0}}
};
vector<int> p;
vector<vector<char>> ans;
void solve(int k) {
p.clear();
while(k) p.push_back(k % 6), k /= 6;
int sz = p.size(), base;
ans.assign(2 * (sz + 2), vector<char>(2 * (sz + 2), '.'));
rep(pow, 1, sz - 1) {
base = (pow - 1) * 2 + 1;
rep(i, 0, 2) rep(j, 0, 2)
ans[base + i][base + j] = a[i][j];
for(auto i : pos[p[pow - 1]])
ans[base + i.first][base + i.second] = 'X';
}
base = 2 * (sz - 1) + 1;
if(p[sz - 1] == 1) ans[base][base] = 'r';
else if(p[sz - 1] == 5) {
rep(i, 0, 2)
ans[base + dots[i].first][base + dots[i].second] = 'X';
ans[base + 2][base + 1] = 'X';
}
else rep(i, 0, p[sz - 1] - 2)
ans[base + dots[i].first][base + dots[i].second] = 'X';
int tot = 2 * sz + 1 + (p[sz - 1] == 5);
cout << tot << " " << tot << "\n";
rep(i, 1, tot) rep(j, 1, tot) {
if(i == tot && j == tot) cout << ".";
else if(j == tot) cout << "d";
else if(i == tot) cout << "r";
else cout << ans[i][j];
if(j == tot) cout << "\n";
}
}
};
using namespace solver;
signed main() {
ios::sync_with_stdio(false), cin.tie(0);
int k; cin >> k;
solve(k);
return 0;
}
Compilation message
costinland.cpp:4: warning: ignoring '#pragma loop ' [-Wunknown-pragmas]
4 | #pragma loop-opt(on)
|
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
204 KB |
Correct! Your size: 3 |
2 |
Correct |
0 ms |
204 KB |
Correct! Your size: 3 |
3 |
Correct |
0 ms |
204 KB |
Correct! Your size: 4 |
4 |
Correct |
0 ms |
204 KB |
Correct! Your size: 5 |
5 |
Correct |
0 ms |
204 KB |
Correct! Your size: 5 |
6 |
Correct |
0 ms |
204 KB |
Correct! Your size: 5 |
7 |
Correct |
0 ms |
204 KB |
Correct! Your size: 5 |
8 |
Correct |
0 ms |
204 KB |
Correct! Your size: 5 |
9 |
Correct |
0 ms |
204 KB |
Correct! Your size: 5 |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
204 KB |
Correct! Your size: 47 |
2 |
Correct |
1 ms |
204 KB |
Correct! Your size: 47 |
3 |
Correct |
1 ms |
204 KB |
Correct! Your size: 49 |
4 |
Correct |
1 ms |
204 KB |
Correct! Your size: 47 |
5 |
Correct |
1 ms |
320 KB |
Correct! Your size: 48 |
6 |
Correct |
1 ms |
204 KB |
Correct! Your size: 49 |
7 |
Correct |
0 ms |
204 KB |
Correct! Your size: 49 |
8 |
Correct |
1 ms |
204 KB |
Correct! Your size: 47 |