結果

問題 No.3728 Half and Half, and Double
コンテスト
ユーザー 李柏霆
提出日時 2026-09-19 16:08:15
言語 C++23(gcc16)
(gcc 16.1.0 + boost 1.92.0 + ACL)
コンパイル:
g++-16 -O2 -lm -std=c++23 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
WA  
実行時間 -
コード長 887 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 2,744 ms
コンパイル使用メモリ 356,732 KB
実行使用メモリ 10,004 KB
最終ジャッジ日時 2026-09-19 16:08:23
合計ジャッジ時間 5,340 ms
ジャッジサーバーID
(参考情報)
judge2_0 / judge5_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 31 WA * 2
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

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

int main(){
    cin.tie(0);
    ios_base::sync_with_stdio(0);
    //start here
    int N;cin >> N;
    N *= 2;
    if(N == 2){
        cout << "-1";
        return 0;
    }
    // else if(N == 4){
    //     cout << "-1";
    //     return 0;
    // }
    // else if(N == 6){
    //     cout << "-1";
    //     return 0;
    // }
    vector<string> grid(N,string(N,'A'));
    int cnt = N*N/2;
    auto add = [&](int i,int j){
        if(cnt == 0) return;
        if(grid[i][j] == 'B') return;
        if((i == 1 || i == 2) && (j == 2 || j == 4)) return;
        cnt--;
        grid[i][j] = 'B';
    };
    for(int i = 1;i < N-1;i++){
        add(1,i);
        add(i,1);
    }
    for(int i = 1;i < N-1;i++){
        for(int j = 1;j < N-1;j++){
            add(i,j);
        }
    }
    for(auto &i:grid){
        cout << i << '\n';
    }
}
0