結果

問題 No.2684 折々の色
ユーザー Ayuna
提出日時 2023-12-16 03:05:33
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 746 ms / 2,000 ms
コード長 849 bytes
コンパイル時間 597 ms
コンパイル使用メモリ 82,236 KB
実行使用メモリ 206,572 KB
最終ジャッジ日時 2024-09-29 18:30:07
合計ジャッジ時間 24,356 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 56
権限があれば一括ダウンロードができます

ソースコード

diff #

n, m = map(int, input().split())
x = list(map(int, input().split()))
a = [list(map(int, input().split())) for _ in range(n)]
dic = dict()

for i in range(n):
    lis = []
    for j in range(m):
        lis.append(a[i][j] * a[i][-1])
    tup = tuple(lis)
    if tup in dic:
        dic[tup] = -1
    else:
        dic[tup] = i

for i in range(n):
    if a[i][-1] == 100:
        if a[i][:-1] == x:
            print("Yes")
            exit()
    else:
        flg = True
        predict = []
        for j in range(m):
            k = x[j] * 10000 - 100 * a[i][-1] * a[i][j]
            if k % (100 - a[i][-1]) != 0:
                flg = False
                break
            predict.append(k // (100 - a[i][-1]))
        tup = tuple(predict)
        if flg and tup in dic and dic[tup] != i:
            print("Yes")
            exit()
print("No")
0