結果
| 問題 | 
                            No.2270 T0空間
                             | 
                    
| コンテスト | |
| ユーザー | 
                             gew1fw
                         | 
                    
| 提出日時 | 2025-06-12 12:56:13 | 
| 言語 | PyPy3  (7.3.15)  | 
                    
| 結果 | 
                             
                                WA
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 1,256 bytes | 
| コンパイル時間 | 227 ms | 
| コンパイル使用メモリ | 82,292 KB | 
| 実行使用メモリ | 76,476 KB | 
| 最終ジャッジ日時 | 2025-06-12 13:01:59 | 
| 合計ジャッジ時間 | 6,077 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge2 / judge1 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 14 WA * 8 | 
ソースコード
import sys
def main():
    n = int(sys.stdin.readline())
    m = int(sys.stdin.readline())
    has_zero = [False] * n
    has_one = [False] * n
    for _ in range(m):
        s = sys.stdin.readline().strip()
        for i in range(n):
            c = s[-(i+1)]  # Rightmost is position 1 (0-based from end)
            if c == '0':
                has_zero[i] = True
            else:
                has_one[i] = True
    
    # Check all pairs i < j
    for i in range(n):
        for j in range(i + 1, n):
            # Condition 1: Either i or j has both 0 and 1
            cond1 = (has_zero[i] and has_one[i]) or (has_zero[j] and has_one[j])
            if cond1:
                continue
            # Condition 2: i and j have different bit sets (one is all 0, the other all 1)
            # Check if both are either all 0 or all 1, and they are different
            i_all_single = (has_zero[i] ^ has_one[i])  # Either all 0 or all 1
            j_all_single = (has_zero[j] ^ has_one[j])
            if i_all_single and j_all_single and (has_zero[i] != has_zero[j]):
                continue
            # If neither condition is met, answer is No
            print("No")
            return
    print("Yes")
if __name__ == "__main__":
    main()
            
            
            
        
            
gew1fw