結果

問題 No.1974 2x2 Flipper
ユーザー ygd.ygd.
提出日時 2022-06-10 23:01:58
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 147 ms / 2,000 ms
コード長 1,205 bytes
コンパイル時間 181 ms
コンパイル使用メモリ 81,752 KB
実行使用メモリ 85,548 KB
最終ジャッジ日時 2023-10-21 06:01:09
合計ジャッジ時間 5,434 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 35 ms
51,872 KB
testcase_01 AC 71 ms
76,476 KB
testcase_02 AC 46 ms
63,144 KB
testcase_03 AC 107 ms
82,124 KB
testcase_04 AC 79 ms
78,340 KB
testcase_05 AC 68 ms
77,248 KB
testcase_06 AC 95 ms
79,824 KB
testcase_07 AC 83 ms
78,472 KB
testcase_08 AC 60 ms
76,012 KB
testcase_09 AC 97 ms
80,248 KB
testcase_10 AC 54 ms
73,728 KB
testcase_11 AC 86 ms
79,104 KB
testcase_12 AC 113 ms
81,936 KB
testcase_13 AC 90 ms
79,304 KB
testcase_14 AC 74 ms
77,656 KB
testcase_15 AC 115 ms
83,112 KB
testcase_16 AC 60 ms
76,044 KB
testcase_17 AC 100 ms
80,812 KB
testcase_18 AC 51 ms
73,528 KB
testcase_19 AC 62 ms
76,152 KB
testcase_20 AC 79 ms
78,236 KB
testcase_21 AC 136 ms
85,548 KB
testcase_22 AC 138 ms
85,408 KB
testcase_23 AC 146 ms
85,428 KB
testcase_24 AC 147 ms
85,484 KB
testcase_25 AC 37 ms
51,876 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
#input = sys.stdin.readline
input = sys.stdin.buffer.readline #文字列はダメ
#sys.setrecursionlimit(1000000)
#import bisect
#import itertools
#import random
#from heapq import heapify, heappop, heappush
#from collections import defaultdict 
#from collections import deque
#import copy
#import math
#from functools import lru_cache
#@lru_cache(maxsize=None)
MOD = pow(10,9) + 7
#MOD = 998244353
#dx = [1,0,-1,0]
#dy = [0,1,0,-1]
#dx8 = [1,1,0,-1,-1,-1,0,1]
#dy8 = [0,1,1,1,0,-1,-1,-1]


def main():
    H,W = map(int,input().split())
    
    if H%2 == 0 or W%2 == 0:
        A = [[0]*W for _ in range(H)]
        for i in range((H//2)*2):
            for j in range((W//2)*2):
                A[i][j] = 1
    else:
        A = [[1]*W for _ in range(H)]
        for i in range(min(H,W)):
            A[i][i] = 0
        if H > W:
            for i in range(W,H):
                #print(i,W-1)
                A[i][W-1] = 0
        else:
            for i in range(H,W):
                A[H-1][i] = 0

    ans = 0
    for i in range(H):
        for j in range(W):
            ans += A[i][j]
    print(ans)
    for i in range(H):
        print(*A[i])



if __name__ == '__main__':
    main()
0