結果

問題 No.1974 2x2 Flipper
ユーザー rogi52rogi52
提出日時 2022-10-22 14:42:10
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 712 bytes
コンパイル時間 2,039 ms
コンパイル使用メモリ 202,328 KB
実行使用メモリ 7,084 KB
最終ジャッジ日時 2023-09-14 09:09:49
合計ジャッジ時間 5,823 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 7 ms
4,376 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 37 ms
5,744 KB
testcase_04 AC 17 ms
4,376 KB
testcase_05 WA -
testcase_06 AC 27 ms
4,900 KB
testcase_07 AC 18 ms
4,432 KB
testcase_08 AC 5 ms
4,380 KB
testcase_09 AC 27 ms
4,844 KB
testcase_10 WA -
testcase_11 AC 22 ms
4,700 KB
testcase_12 AC 36 ms
5,636 KB
testcase_13 AC 23 ms
4,576 KB
testcase_14 AC 14 ms
4,380 KB
testcase_15 AC 43 ms
5,896 KB
testcase_16 WA -
testcase_17 AC 30 ms
5,164 KB
testcase_18 AC 5 ms
4,376 KB
testcase_19 AC 5 ms
4,376 KB
testcase_20 AC 17 ms
4,380 KB
testcase_21 AC 55 ms
6,960 KB
testcase_22 AC 55 ms
6,948 KB
testcase_23 AC 55 ms
7,084 KB
testcase_24 AC 59 ms
7,068 KB
testcase_25 AC 2 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n); i++)
using namespace std;
using ll = long long;
using ld = long double;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(0);
    
    int H,W; cin >> H >> W;
    vector<vector<int>> ans(H, vector<int>(W, 0));
    if(H % 2 == 0 || W % 2 == 0 || H == 1 || W == 1) {
        rep(i,H)rep(j,W)if(ans[i][j] == 0 && i + 1 < H && j + 1 < W) {
            ans[i][j] = ans[i + 1][j] = ans[i][j + 1] = ans[i + 1][j + 1] = 1;
        }
    } else {
        rep(i,H)rep(j,W) ans[i][j] = (i % W != j % H);
    }
    int cnt = 0;
    rep(i,H)rep(j,W) cnt += ans[i][j];
    cout << cnt << "\n";
    rep(i,H)rep(j,W) cout << ans[i][j] << " \n"[j == W - 1];
}
0