結果

問題 No.2684 折々の色
ユーザー 👑 rin204
提出日時 2024-02-29 22:02:34
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 729 ms / 2,000 ms
コード長 1,016 bytes
コンパイル時間 373 ms
コンパイル使用メモリ 82,580 KB
実行使用メモリ 249,292 KB
最終ジャッジ日時 2024-09-29 18:31:04
合計ジャッジ時間 23,136 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 56
権限があれば一括ダウンロードができます

ソースコード

diff #

n, m = map(int, input().split())
assert 2 <= n <= 200000
assert 1 <= m <= 10
X = list(map(int, input().split()))
assert all(0 <= x < (1 << 16) for x in X)
C = []
T = []
for _ in range(n):
    C_ = list(map(int, input().split()))
    t = C_.pop()
    assert len(C_) == m
    assert 0 < t <= 100
    assert all(0 <= c < (1 << 16) for c in C_)

    T.append(t)
    C.append(C_)

inds = {}
for i in range(n):
    if T[i] == 100:
        if C[i] == X:
            print("Yes")
            exit()
    D = tuple(T[i] * c for c in C[i])
    inds.setdefault(D, []).append(i)

X = [x * 10000 for x in X]


for i in range(n):
    if T[i] == 100:
        continue
    D = [0] * m
    ok = True
    for j in range(m):
        D[j] = X[j] - 100 * T[i] * C[i][j]
        if D[j] % (100 - T[i]) != 0:
            ok = False
            break
        D[j] //= 100 - T[i]

    if ok:
        tup = tuple(D)
        if tup in inds and (len(inds[tup]) > 1 or inds[tup][0] != i):
            print("Yes")
            exit()

print("No")
0