結果

問題 No.82 市松模様
ユーザー Tatsu_mr
提出日時 2024-10-15 01:28:22
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 888 bytes
コンパイル時間 3,203 ms
コンパイル使用メモリ 248,280 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-10-15 01:28:28
合計ジャッジ時間 3,755 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 7
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#define For(i, a, b) for(long long i = a; i < b; i++)
#define rep(i, n) For(i, 0, n)
#define rFor(i, a, b) for(long long i = a; i >= b; i--)
#define ALL(v) (v).begin(), (v).end()
#define rALL(v) (v).rbegin(), (v).rend()
using namespace std;

using lint = long long;
using ld = long double;

int main() {
    int w, h;
    char c;
    cin >> w >> h >> c;
    vector<vector<char>> ans(h, vector<char>(w));
    rep(i, h) {
        rep(j, w) {
            if (j == 0) {
                if (i == 0) {
                    ans[i][j] = c;
                } else {
                    ans[i][j] = (ans[i - 1][j] == 'B' ? 'W' : 'B');
                }
            } else {
                ans[i][j] = (ans[i][j - 1] == 'B' ? 'W' : 'B');
            }
        }
    }
    rep(i, h) {
        rep(j, w) {
            cout << ans[i][j];
        }
        cout << endl;
    }
}
0