This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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 ++)
#define rrep(i, a, b) for(int i = b; i >= a; i--)
#define all(x) x.begin(), x.end()
#define ceil(a, b) ((a + b - 1) / (b))
using namespace std;
#define int long long int
#define lld long double
#define pii pair<int, int>
#define random mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count())
#ifdef wiwihorz
#define print(a...) cerr << "Line: " << __LINE__, kout("[" + string(#a) + "] = ", a)
void vprint(auto L, auto R) { cerr << *L << " \n"[next(L) == R], ++L; }
void kout() { cerr << endl; }
template<class T1, class ... T2> void kout(T1 a, T2 ... e) { cerr << a << " ", kout(e...);}
#else
#define print(...) 0
#define vprint(...) 0
#endif
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 + 1), vector<char>(2 * (sz + 1), '.'));
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 rep(i, 0, p[sz - 1] - 2)
ans[base + dots[i].first][base + dots[i].second] = 'X';
cout << 2 * sz + 1 << " " << 2 * sz + 1 << "\n";
rep(i, 1, 2 * sz + 1) rep(j, 1, 2 * sz + 1) {
if(i == 2 * sz + 1 && j == 2 * sz + 1) cout << ".";
else if(j == 2 * sz + 1) cout << "d";
else if(i == 2 * sz + 1) cout << "r";
else cout << ans[i][j];
cout << " \n"[j == 2 * sz + 1];
}
}
};
using namespace solver;
signed main() {
ios::sync_with_stdio(false), cin.tie(0);
int k; cin >> k;
solve(k);
return 0;
}
Compilation message (stderr)
costinland.cpp:4: warning: ignoring '#pragma loop ' [-Wunknown-pragmas]
4 | #pragma loop-opt(on)
|
costinland.cpp:20:13: warning: use of 'auto' in parameter declaration only available with '-fconcepts-ts'
20 | void vprint(auto L, auto R) { cerr << *L << " \n"[next(L) == R], ++L; }
| ^~~~
costinland.cpp:20:21: warning: use of 'auto' in parameter declaration only available with '-fconcepts-ts'
20 | void vprint(auto L, auto R) { cerr << *L << " \n"[next(L) == R], ++L; }
| ^~~~
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |