Submission #795809

# Submission time Handle Problem Language Result Execution time Memory
795809 2023-07-27T15:50:25 Z Andrey Costinland (info1cup19_costinland) C++14
92 / 100
1 ms 212 KB
#include<bits/stdc++.h>
using namespace std;

int main()
{
    ios_base::sync_with_stdio(NULL);
    cin.tie(NULL);
    cout.tie(NULL);
    long long k,br = 2,y = 1,z;
    cin >> k;
    while(y*3 <= k) {
        y*=6;
        br+=2;
    }
    if(k == 18) {
        cout << 4 << " " << 4 << "\n";
        cout << "XXdd\n";
        cout << "XXXd\n";
        cout << "rXXd\n";
        cout << "rrr.\n";
        return 0;
    }
    char ans[br][br];
    for(long long i = 0; i < br; i++) {
        for(long long j = 0; j < br; j++) {
            ans[i][j] = '.';
        }
    }
    for(long long i = 1; i < br-1; i+=2) {
        ans[i][i] = 'X';
        ans[i][i+1] = 'X';
        ans[i+1][i] = 'X';
        ans[i+1][i+1] = 'X';
        ans[i+2][i] = 'r';
        ans[i+2][i+1] = 'r';
        ans[i][i+2] = 'd';
        ans[i+1][i+2] = 'd';
    }
    for(long long i = 0; i < br-1; i++) {
        ans[br-1][i] = 'r';
        ans[i][br-1] = 'd';
    }
    ans[0][0] = 'X';
    z = k;
    int p = br-2;
    while(z > 0) {
        if(z%6 >= 3) {
            ans[0][p] = 'X';
        }
        if(z != k) {
            if(z%3 > 0) {
                ans[0][p+1] = 'X';
                if(z%3 > 1) {
                    ans[p+1][0] = 'X';
                }
            }
        }
        p-=2;
        z/=6;
    }
    if(k%3 < 2) {
        for(int i = br-2; i >= 0; i--) {
            if(ans[i][0] == 'X') {
                ans[i][0] = 'r';
                break;
            }
        }
        if(k%3 < 1) {
            for(int i = br-2; i >= 0; i--) {
                if(ans[0][i] == 'X') {
                    ans[0][i] = 'd';
                    break;
                }
            }
        }
    }
    cout << br << " " << br << "\n";
    for(long long i = 0; i < br; i++) {
        for(long long j = 0; j < br; j++) {
            cout << ans[i][j];
        }
        cout << "\n";
    }
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Correct! Your size: 4
2 Correct 0 ms 212 KB Correct! Your size: 4
3 Correct 0 ms 212 KB Correct! Your size: 4
4 Correct 0 ms 212 KB Correct! Your size: 4
5 Correct 1 ms 212 KB Correct! Your size: 4
6 Correct 0 ms 212 KB Correct! Your size: 4
7 Correct 0 ms 212 KB Correct! Your size: 4
8 Correct 0 ms 212 KB Correct! Your size: 4
9 Partially correct 0 ms 212 KB Partially Correct! Your size: 6
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Correct! Your size: 46
2 Correct 0 ms 212 KB Correct! Your size: 48
3 Correct 0 ms 212 KB Correct! Your size: 48
4 Correct 1 ms 212 KB Correct! Your size: 48
5 Correct 0 ms 212 KB Correct! Your size: 48
6 Correct 0 ms 212 KB Correct! Your size: 48
7 Correct 0 ms 212 KB Correct! Your size: 48
8 Correct 0 ms 212 KB Correct! Your size: 46