結果

問題 No.1974 2x2 Flipper
ユーザー 沙耶花
提出日時 2022-06-10 21:36:21
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 713 bytes
コンパイル時間 4,150 ms
コンパイル使用メモリ 252,644 KB
最終ジャッジ日時 2025-01-29 19:37:32
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 21 WA * 4
権限があれば一括ダウンロードができます

ソースコード

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