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 <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main () {
long long k = 0;
cin >> k;
int largestbit = 0;
for (int i = 60; i >= 0; i--)
if ((k & (1ll << i))) {
largestbit = i;
break;
}
int siz = max (
largestbit + 1,
5
);
vector <string> gr (siz, string (siz, '.'));
for (int i = 0; i < largestbit; i++) {
gr[i][i] = 'X';
gr[i + 1][i] = 'r';
gr[i][i + 1] = 'd';
}
for (int i = 0; i < siz - 1; i++) {
gr[siz - 1][i] = 'r';
gr[i][siz - 1] = 'd';
}
for (int i = 2; i < largestbit; i++)
if ((k & (1ll << i))) {
gr[i][i - 1] = 'X';
gr[i - 1][i] = 'X';
}
if ((k & 3ll)) {
gr[1][0] = 'X';
gr[0][1] = 'X';
gr[siz - 2][0] = 'X';
gr[siz - 2][1] = 'd';
} else if ((k & 2ll)) {
gr[1][0] = 'X';
gr[0][1] = 'X';
} else if ((k & 1ll)) {
gr[1][0] = 'X';
}
for (int y = 0; y < siz; y++)
cout << gr[y] << '\n';
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |