結果
| 問題 |
No.1974 2x2 Flipper
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2022-10-22 14:46:57 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 828 bytes |
| コンパイル時間 | 1,811 ms |
| コンパイル使用メモリ | 198,684 KB |
| 最終ジャッジ日時 | 2025-02-08 11:19:36 |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 24 WA * 1 |
ソースコード
#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)if(max(i,j) < min(H,W)) ans[i][j] = (i != j);
rep(i,H)rep(j,W)if(max(i,j)>=min(H,W)) {
ans[i][j] = (i == 0 ? 0 : 1);
}
}
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];
}