結果
問題 | No.1974 2x2 Flipper |
ユーザー |
![]() |
提出日時 | 2023-07-15 13:47:12 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 587 bytes |
コンパイル時間 | 199 ms |
コンパイル使用メモリ | 12,800 KB |
実行使用メモリ | 19,584 KB |
最終ジャッジ日時 | 2024-09-16 22:35:42 |
合計ジャッジ時間 | 11,432 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 20 WA * 5 |
ソースコード
import sys readline=sys.stdin.readline H,W=map(int,readline().split()) if H%2==0 and W%2==0: ans_lst=[[1]*W for h in range(H)] elif H%2==0: ans_lst=[[1 if w!=W-1 else 0 for w in range(W)] for h in range(H)] elif W%2==0: ans_lst=[[1 if h!=H-1 else 0 for w in range(W)] for h in range(H)] else: ans_lst=[[1 if h!=H-1 and w!=W-1 else 0 for w in range(W)] for h in range(H)] ans_lst[H-2][W-2]=0 ans_lst[H-2][W-1]=1 ans_lst[H-1][W-2]=1 ans_lst[H-1][W-1]=1 print(sum(ans_lst[h][w] for h in range(H) for w in range(W))) for h in range(H): print(*ans_lst[h])