結果
| 問題 |
No.2270 T0空間
|
| コンテスト | |
| ユーザー |
gew1fw
|
| 提出日時 | 2025-06-12 12:54:09 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,256 bytes |
| コンパイル時間 | 182 ms |
| コンパイル使用メモリ | 82,036 KB |
| 実行使用メモリ | 76,756 KB |
| 最終ジャッジ日時 | 2025-06-12 12:58:00 |
| 合計ジャッジ時間 | 5,625 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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