Submission #1234810

#TimeUsernameProblemLanguageResultExecution timeMemory
1234810khomeCostinland (info1cup19_costinland)C++20
20 / 100
3 ms328 KiB
#include <bits/stdc++.h>

using namespace std; 
#define int long long


void solve(){
    int k; cin >> k;

    auto fil = [&](vector<vector<int>> v) -> void {
        int sz = v[0].size();
        for (int i = 0; i < sz - 1; i++) {
            for (int j = 0; j < sz - 1; j++) {
                v[i][j] = i + j;
            }
        }
        return;
    };

    auto check = [&](int p) -> void {
        int cnt = 1;
        vector<int> hor(5, 0);
        vector<int> ver(5, 0);
        hor[0] = 1;
        ver[0] = 1;
        for (int j = 0; j < 16; j++) {
            if (p & (1 << j)) {
                int x = j / 4, y = j % 4;
                if (x == 0 && y == 0) continue;
                // cout << x << ' ' << y << " : " << hor[x] + ver[y] << endl;
                cnt += hor[x] + ver[y];
                hor[x] += ver[y];
                ver[y] += hor[x] - ver[y];
            }
        }
        if (cnt == k-1) {
            // cout << p << endl;
            for (int j = 0; j < 16; j++) {
                int x = j / 4, y = j % 4; 
                if (x == 0 && y == 0) {cout << 'X'; continue;}
                if (p & (1 << j)) {
                    cout << 'X';
                }
                else cout << '.';
                if (y == 3)cout << 'd' << endl;
            }
            for (int i = 0; i < 4; i++) cout << 'r';
            cout << '.' << endl;
            exit(0);
        }
    };


    vector<vector<int>> v(5, vector<int>(5));
    fil(v);
    vector<int> dp(k+1);
    dp[0] = 1;
    if (k == 1) {
        cout << 1 << ' '<< 1 << endl;
        cout << '.' << endl;
        return;
    }
    cout << 5 << ' ' << 5 << endl;
    for (int i = 0; i < (1 << 16); i ++) {
        check(i);
        // cout << "_________________" << endl;
    }

}

signed main(){
    cin.tie(0) -> sync_with_stdio(0);
    // int t = 1;
    // cin >> t;
    solve();
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...