結果
| 問題 |
No.1974 2x2 Flipper
|
| コンテスト | |
| ユーザー |
沙耶花
|
| 提出日時 | 2022-06-10 21:47:32 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 77 ms / 2,000 ms |
| コード長 | 895 bytes |
| コンパイル時間 | 4,232 ms |
| コンパイル使用メモリ | 252,936 KB |
| 最終ジャッジ日時 | 2025-01-29 19:45:00 |
|
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 25 |
ソースコード
#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){
a.assign(h,vector<int>(w,1));
if(h>=w){
rep(i,h){
if(i<w){
a[i][i] = 0;
}
else{
a[i][w-1] = 0;
}
}
}
else{
rep(i,w){
if(i<h){
a[i][i] = 0;
}
else{
a[h-1][i] = 0;
}
}
}
}
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;
}
沙耶花