結果

問題 No.2684 折々の色
ユーザー nikoro256nikoro256
提出日時 2024-03-22 18:10:17
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,458 ms / 2,000 ms
コード長 1,117 bytes
コンパイル時間 320 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 277,236 KB
最終ジャッジ日時 2024-03-22 18:10:56
合計ジャッジ時間 37,957 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 35 ms
53,460 KB
testcase_01 AC 35 ms
53,460 KB
testcase_02 AC 39 ms
58,804 KB
testcase_03 AC 35 ms
53,460 KB
testcase_04 AC 44 ms
61,568 KB
testcase_05 AC 35 ms
53,460 KB
testcase_06 AC 42 ms
58,804 KB
testcase_07 AC 36 ms
53,460 KB
testcase_08 AC 41 ms
58,804 KB
testcase_09 AC 36 ms
53,460 KB
testcase_10 AC 40 ms
58,804 KB
testcase_11 AC 740 ms
197,148 KB
testcase_12 AC 455 ms
150,156 KB
testcase_13 AC 555 ms
192,676 KB
testcase_14 AC 290 ms
125,012 KB
testcase_15 AC 534 ms
164,080 KB
testcase_16 AC 217 ms
92,676 KB
testcase_17 AC 412 ms
141,360 KB
testcase_18 AC 585 ms
200,124 KB
testcase_19 AC 580 ms
196,020 KB
testcase_20 AC 342 ms
147,084 KB
testcase_21 AC 264 ms
106,112 KB
testcase_22 AC 880 ms
236,760 KB
testcase_23 AC 573 ms
179,448 KB
testcase_24 AC 355 ms
124,128 KB
testcase_25 AC 465 ms
147,504 KB
testcase_26 AC 746 ms
218,560 KB
testcase_27 AC 510 ms
159,428 KB
testcase_28 AC 613 ms
179,156 KB
testcase_29 AC 1,070 ms
271,044 KB
testcase_30 AC 1,088 ms
277,236 KB
testcase_31 AC 737 ms
253,984 KB
testcase_32 AC 1,384 ms
276,828 KB
testcase_33 AC 1,013 ms
271,204 KB
testcase_34 AC 1,180 ms
267,812 KB
testcase_35 AC 1,157 ms
268,312 KB
testcase_36 AC 772 ms
254,360 KB
testcase_37 AC 977 ms
274,608 KB
testcase_38 AC 1,449 ms
272,580 KB
testcase_39 AC 1,445 ms
273,364 KB
testcase_40 AC 1,450 ms
273,108 KB
testcase_41 AC 1,458 ms
273,204 KB
testcase_42 AC 1,455 ms
272,648 KB
testcase_43 AC 1,458 ms
274,468 KB
testcase_44 AC 1,424 ms
272,784 KB
testcase_45 AC 1,406 ms
273,252 KB
testcase_46 AC 1,408 ms
272,844 KB
testcase_47 AC 40 ms
53,460 KB
testcase_48 AC 37 ms
53,460 KB
testcase_49 AC 37 ms
53,460 KB
testcase_50 AC 37 ms
53,460 KB
testcase_51 AC 37 ms
53,460 KB
testcase_52 AC 37 ms
53,460 KB
testcase_53 AC 37 ms
53,460 KB
testcase_54 AC 37 ms
53,460 KB
testcase_55 AC 37 ms
53,460 KB
testcase_56 AC 37 ms
53,460 KB
testcase_57 AC 35 ms
53,460 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def extgcd(a, b):
    if b:
        d, y, x = extgcd(b, a % b)
        y -= (a // b) * x
        return d, x, y
    return a, 1, 0

#以下modinv
def mod_inv(a, m):
    g, x, y = extgcd(a, m)

    if g != 1:
        raise Exception()

    if x < 0:
        x += m

    return x

import sys
input=sys.stdin.readline
N,M=map(int,input().split())
X=list(map(int,input().split()))
C=[]
T=[]
Cset=set()
p=998244353
inv100=mod_inv(100,p)
Cts=[]
for i in range(N):
    c=list(map(int,input().split()))
    C.append(c[:-1])
    T.append(c[-1])
    Ct=c[:-1]
    for i in range(M):
        Ct[i]*=T[-1]*inv100
        Ct[i]%=p
    Cts.append(Ct)
    Cset.add(tuple(Ct))
for i in range(N):
    if T[i]==100:
        if C[i]==X:
            print('Yes')
            exit(0)
        continue
    tinv=mod_inv((1-T[i]*inv100)%p,p)
    for j in range(M):
        C[i][j]*=T[i]*inv100%p
        C[i][j]%=p
        C[i][j]=X[j]-C[i][j]
        C[i][j]%=p
        C[i][j]*=tinv
        C[i][j]%=p
    Cset.remove(tuple(Cts[i]))
    if tuple(C[i]) in (Cset):
        print('Yes')
        exit(0)
    Cset.add(tuple(Cts[i]))
print('No')
0