結果

問題 No.1974 2x2 Flipper
ユーザー 沙耶花沙耶花
提出日時 2022-06-10 21:36:21
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 713 bytes
コンパイル時間 4,388 ms
コンパイル使用メモリ 262,204 KB
実行使用メモリ 7,676 KB
最終ジャッジ日時 2023-10-21 04:55:34
合計ジャッジ時間 7,963 ms
ジャッジサーバーID
(参考情報)
judge15 / judge10
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,348 KB
testcase_01 AC 10 ms
4,348 KB
testcase_02 AC 3 ms
4,348 KB
testcase_03 AC 49 ms
6,328 KB
testcase_04 AC 23 ms
4,900 KB
testcase_05 WA -
testcase_06 AC 35 ms
5,560 KB
testcase_07 AC 24 ms
4,904 KB
testcase_08 AC 6 ms
4,348 KB
testcase_09 AC 37 ms
5,660 KB
testcase_10 WA -
testcase_11 AC 29 ms
5,200 KB
testcase_12 AC 49 ms
6,320 KB
testcase_13 AC 32 ms
5,288 KB
testcase_14 AC 19 ms
4,656 KB
testcase_15 AC 57 ms
6,752 KB
testcase_16 WA -
testcase_17 AC 42 ms
5,868 KB
testcase_18 AC 6 ms
4,348 KB
testcase_19 AC 7 ms
4,348 KB
testcase_20 AC 23 ms
4,868 KB
testcase_21 AC 72 ms
7,676 KB
testcase_22 AC 72 ms
7,672 KB
testcase_23 AC 73 ms
7,676 KB
testcase_24 WA -
testcase_25 AC 2 ms
4,348 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <stdio.h>
#include <atcoder/all>
#include <bits/stdc++.h>
using namespace std;
using namespace atcoder;
using mint = modint1000000007;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define Inf 1000000001

int main(){
	int h,w;
	cin>>h>>w;
	
	vector a(h,vector<int>(w,0));
	rep(i,h){
		rep(j,w){
			if(a[i][j]==1)continue;
			if(i+1<h&&j+1<w){
				rep(k,2){
					rep(l,2){
						a[i+k][j+l] = 1;
					}
				}
			}
		}
	}
	
	if(h>=3&&w>=3&&h%2==1&&w%2==1){
		rep(i,2){
			rep(j,2){
				a[h-1-i][w-1-j] ^= 1;
			}
		}
	}
	
	int ans = 0;
	rep(i,h){
		rep(j,w){
			ans += a[i][j];
		}
	}
	cout<<ans<<endl;
	rep(i,h){
		rep(j,w){
			if(j!=0)cout<<' ';
			cout<<a[i][j];
		}
		cout<<endl;
	}
	
    return 0;
}
0