結果

問題 No.3741 Used to be Polyominal Constructive
コンテスト
ユーザー uruzunyaa
提出日時 2026-09-19 01:39:22
言語 C++23
(gcc 15.3.0 + boost 1.92.0 + ACL)
コンパイル:
g++-15 -O2 -lm -std=c++23 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
AC  
実行時間 3 ms / 10,000 ms
+ 444µs
コード長 1,946 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 2,043 ms
コンパイル使用メモリ 336,080 KB
実行使用メモリ 7,984 KB
最終ジャッジ日時 2026-09-19 13:25:39
合計ジャッジ時間 5,537 ms
ジャッジサーバーID
(参考情報)
judge1_0 / judge5_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 1
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include <bits/stdc++.h>
using namespace std;

int main(){
    const int N = 666;

    // まず 332 x 332 の粗いグリッド上で図形を作る
    const int C = 332;
    const int H = 150;
    const int GAP = 32;
    const int W = 330;
    const int BOT = H + GAP; // 182
    const int XT = 166;

    vector<string> q(C, string(C, '.'));

    // 上側の櫛
    // 右端に縦棒、3行ごとに横棒
    for(int i = 0; i < H; i++){
        q[i][1 + W - 1] = '#';

        if(i % 3 == 1){
            for(int j = 1; j < 1 + W; j++){
                q[i][j] = '#';
            }
        }
    }

    // 下側の櫛
    // 左端に縦棒、3行ごとに横棒
    for(int i = 0; i < H; i++){
        q[BOT + i][1] = '#';

        if(i % 3 == 0){
            for(int j = 1; j < 1 + W; j++){
                q[BOT + i][j] = '#';
            }
        }
    }

    // 2つの櫛を連結
    for(int i = H - 1; i <= BOT; i++){
        q[i][XT] = '#';
    }

    /*
        粗いグリッドの各 # を

             #
            ###
             #

        という十字型に置き換える。

        中心 (i,j) -> (2i+1, 2j+1)
    */
    vector<string> base(N, string(N, '.'));

    const int dy[5] = {0, 1, -1, 0, 0};
    const int dx[5] = {0, 0, 0, 1, -1};

    for(int i = 0; i < C; i++){
        for(int j = 0; j < C; j++){
            if(q[i][j] != '#') continue;

            int y = 2 * i + 1;
            int x = 2 * j + 1;

            for(int d = 0; d < 5; d++){
                base[y + dy[d]][x + dx[d]] = '#';
            }
        }
    }

    vector<string> g1 = base;
    vector<string> g2 = base;
    vector<string> g3 = base;

    // ここだけ G1 に 1 マス追加
    // 1-indexed では (293, 659)
    g1[292][658] = '#';

    cout << N << '\n';

    for(const auto& s : g1) cout << s << '\n';
    for(const auto& s : g2) cout << s << '\n';
    for(const auto& s : g3) cout << s << '\n';

    return 0;
}
0