結果

問題 No.1974 2x2 Flipper
ユーザー kabipoyokabipoyo
提出日時 2022-06-10 21:51:00
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 74 ms / 2,000 ms
コード長 1,467 bytes
コンパイル時間 4,341 ms
コンパイル使用メモリ 266,404 KB
実行使用メモリ 11,316 KB
最終ジャッジ日時 2023-10-21 05:56:51
合計ジャッジ時間 7,873 ms
ジャッジサーバーID
(参考情報)
judge10 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,348 KB
testcase_01 AC 10 ms
4,576 KB
testcase_02 AC 3 ms
4,348 KB
testcase_03 AC 50 ms
8,676 KB
testcase_04 AC 23 ms
5,772 KB
testcase_05 AC 14 ms
4,716 KB
testcase_06 AC 36 ms
7,092 KB
testcase_07 AC 24 ms
6,084 KB
testcase_08 AC 6 ms
4,348 KB
testcase_09 AC 38 ms
7,356 KB
testcase_10 AC 7 ms
4,348 KB
testcase_11 AC 29 ms
6,300 KB
testcase_12 AC 49 ms
8,676 KB
testcase_13 AC 31 ms
6,832 KB
testcase_14 AC 19 ms
5,244 KB
testcase_15 AC 57 ms
9,468 KB
testcase_16 AC 6 ms
4,348 KB
testcase_17 AC 42 ms
7,620 KB
testcase_18 AC 6 ms
4,348 KB
testcase_19 AC 7 ms
4,348 KB
testcase_20 AC 23 ms
5,772 KB
testcase_21 AC 74 ms
11,316 KB
testcase_22 AC 74 ms
11,316 KB
testcase_23 AC 73 ms
11,316 KB
testcase_24 AC 73 ms
11,316 KB
testcase_25 AC 2 ms
4,348 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
typedef int64_t lint;
#define rep(i, n) for(lint i=0; i<n; i++)
#define repx(i, l, n) for(int i=l; i<n; i++)
#define all(v) v.begin(), v.end()
#define show(x) cout << #x << ": " << x << endl;
#define list(x) cout << #x << ": " << x << "  ";
#define pb push_back
using vi = vector<lint>;
using vvi = vector<vector<lint>>;
template<class T> inline void vin(vector<T>& v) { rep(i, v.size()) cin >> v.at(i); }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<class T> inline void drop(T x) { cout << x << endl; exit(0); }
template<class T> void vout(vector<T> v) { rep(i, v.size()) { cout << v.at(i) << ' '; } cout << endl; }
constexpr lint LINF = LLONG_MAX/2;

int main() {
	lint H, W;
	cin >> H >> W;
	vvi v(H, vi(W, 1));

	lint a=H*W, b=0, c=0, x, y, z;
	if (H == 1) {
		rep(j, W) v[0][j] = 0;
		a = 0;
	}
	else if (W == 1) {
		rep(i, W) v[i][0] = 0;
		a = 0;
	}
	else if (H%2 == 1 && W%2 == 1) {
		if (H > W) {
			rep(i, H) {
				v[i][min(H-i-1, W-1)] = 0;
			}
			a -= H;
		} else {
			rep(j, W) {
				v[min(W-j-1, H-1)][j] = 0;
			}
			a -= W;
		}
	}
	else if (H%2 == 1) {
		rep(j, W) v[H-1][j] = 0;
		a -= W;
	}
	else if (W%2 == 1) {
		rep(i, H) v[i][W-1] = 0;
		a -= H;
	}
	std::cout << a << '\n';
	rep(i, H) vout(v[i]);
}
0