結果
| 問題 | 
                            No.923 オセロきりきざむたん
                             | 
                    
| コンテスト | |
| ユーザー | 
                             maspy
                         | 
                    
| 提出日時 | 2020-03-23 17:19:41 | 
| 言語 | Python3  (3.13.1 + numpy 2.2.1 + scipy 1.14.1)  | 
                    
| 結果 | 
                             
                                AC
                                 
                             
                            
                         | 
                    
| 実行時間 | 888 ms / 2,000 ms | 
| コード長 | 569 bytes | 
| コンパイル時間 | 277 ms | 
| コンパイル使用メモリ | 12,288 KB | 
| 実行使用メモリ | 79,704 KB | 
| 最終ジャッジ日時 | 2024-12-26 13:08:43 | 
| 合計ジャッジ時間 | 64,066 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge2 / judge1 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 4 | 
| other | AC * 84 | 
ソースコード
#!/usr/bin/ python3.8
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
import numpy as np
H, W = map(int, readline().split())
A = np.frombuffer(read(), 'S1').reshape(H, -1)[:, :W].astype(int)
def solve(A):
    H, W = A.shape
    if H == 1 and W == 1:
        return A[0, 0] == 1
    is_monotone_col = np.isin(np.sum(A, axis=0), [0, H])
    is_monotone_row = np.isin(np.sum(A, axis=1), [0, W])
    return not (np.any(is_monotone_col) and np.any(is_monotone_row))
print('YES' if solve(A) else 'NO')
            
            
            
        
            
maspy