結果
問題 | No.2684 折々の色 |
ユーザー |
![]() |
提出日時 | 2024-03-22 18:01:35 |
言語 | PyPy3 (7.3.15) |
結果 |
TLE
|
実行時間 | - |
コード長 | 1,018 bytes |
コンパイル時間 | 440 ms |
コンパイル使用メモリ | 82,560 KB |
実行使用メモリ | 225,076 KB |
最終ジャッジ日時 | 2024-09-30 10:41:10 |
合計ジャッジ時間 | 29,796 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 32 TLE * 5 -- * 19 |
ソースコード
def extgcd(a, b):if b:d, y, x = extgcd(b, a % b)y -= (a // b) * xreturn d, x, yreturn a, 1, 0#以下modinvdef mod_inv(a, m):g, x, y = extgcd(a, m)if g != 1:raise Exception()if x < 0:x += mreturn ximport sysinput=sys.stdin.readlineN,M=map(int,input().split())X=list(map(int,input().split()))C=[]T=[]Cset=set()p=998244353for 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]*mod_inv(100,p)Ct[i]%=pCset.add(tuple(Ct))for i in range(N):if T[i]==100:if C[i]==X:print('Yes')exit(0)continuefor j in range(M):C[i][j]*=T[i]*mod_inv(100,p)%pC[i][j]%=pC[i][j]=X[j]-C[i][j]C[i][j]%=pC[i][j]*=mod_inv((1-T[i]*mod_inv(100,p))%p,p)C[i][j]%=pif tuple(C[i]) in Cset:print('Yes')exit(0)print('No')