Submission #1100742

# Submission time Handle Problem Language Result Execution time Memory
1100742 2024-10-14T14:55:21 Z Kirill22 Costinland (info1cup19_costinland) C++17
53.2179 / 100
2 ms 848 KB
#include "bits/stdc++.h"

using namespace std;

void solve() {
    long long k;
    cin >> k;
    int n = 500;
    vector<string> a(n, string(n, '.'));
    int x = 0, y = 0, cur = 0;
    while (1) {
        if (k >> cur & 1ll && (1ll << (cur + 1)) > k) {
            // x, y
            for (int i = 0; i <= y; i++) {
                a[x + 1][i] = 'r';
            }
            for (int i = 0; i <= x; i++) {
                a[i][y + 1] = 'd';
            }
            break;
        }
        if (x < y) {
            a[x][y] = 'd';
            if (k >> cur & 1ll) {
                a[x + 1][y] = 'X';
                x++, y++;
                k -= (1ll << cur);
                continue;
            }
            a[x + 1][y] = 'X';
            a[x + 2][y] = 'r';
            a[x + 1][y + 1] = 'd';
            x += 2, y += 1;
            cur++;
        } else {
            a[x][y] = 'r';
            if (k >> cur & 1ll) {
                a[x][y + 1] = 'X';
                x++, y++;
                k -= (1ll << cur);
                continue;
            }
            a[x][y + 1] = 'X';
            a[x][y + 2] = 'd';
            a[x + 1][y + 1] = 'r';
            x += 1, y += 2;
            cur++;
        }
    }
    int N = 0, M = 0;
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < n; j++) {
            if (a[i][j] != '.') {
                N = max(N, i + 1);
                M = max(M, j + 1);
            }
        }
    }
    cout << N << " " << M << '\n';
    for (int i = 0; i < N; i++) {
        for (int j = 0; j < M; j++) {
            cout << a[i][j];
        }
        cout << '\n';
    }
};

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int t = 1;
//    cin >> t;
    while (t--) {
        solve();
    }
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 592 KB Correct! Your size: 5
2 Correct 1 ms 592 KB Correct! Your size: 5
3 Partially correct 1 ms 592 KB Partially Correct! Your size: 6
4 Partially correct 1 ms 600 KB Partially Correct! Your size: 6
5 Partially correct 2 ms 592 KB Partially Correct! Your size: 7
6 Partially correct 1 ms 592 KB Partially Correct! Your size: 7
7 Partially correct 1 ms 848 KB Partially Correct! Your size: 8
8 Partially correct 1 ms 592 KB Partially Correct! Your size: 9
9 Partially correct 1 ms 592 KB Partially Correct! Your size: 10
# Verdict Execution time Memory Grader output
1 Partially correct 1 ms 592 KB Partially Correct! Your size: 115
2 Partially correct 1 ms 592 KB Partially Correct! Your size: 123
3 Partially correct 1 ms 592 KB Partially Correct! Your size: 123
4 Partially correct 1 ms 592 KB Partially Correct! Your size: 107
5 Partially correct 1 ms 592 KB Partially Correct! Your size: 118
6 Partially correct 2 ms 592 KB Partially Correct! Your size: 114
7 Partially correct 1 ms 592 KB Partially Correct! Your size: 111
8 Partially correct 1 ms 592 KB Partially Correct! Your size: 116