結果
| 問題 |
No.1810 RGB Biscuits
|
| コンテスト | |
| ユーザー |
ytft
|
| 提出日時 | 2022-02-13 12:44:08 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
AC
|
| 実行時間 | 1,262 ms / 2,000 ms |
| コード長 | 477 bytes |
| コンパイル時間 | 89 ms |
| コンパイル使用メモリ | 12,672 KB |
| 実行使用メモリ | 43,824 KB |
| 最終ジャッジ日時 | 2024-06-29 05:33:06 |
| 合計ジャッジ時間 | 18,408 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 20 |
ソースコード
import numpy as np A,B=map(int,input().split()) N=int(input()) a=np.array([[1,0,0],[0,1,0],[A,B,1]]) b=np.array([[0,0,1],[1,0,0],[0,0,0]]) mod=10**9+7 for k in range(N): t=int(input()) ans=a if t%2 else np.array([[1,0,0],[0,1,0],[0,0,1]]) temp=b@a rem=t//2 while rem: if rem%2: ans=ans@temp temp=temp@temp for i in range(3): for j in range(3): ans[i][j]%=mod temp[i][j]%=mod rem//=2 print((np.array([[1,1,1]])@ans@np.array([[1],[1],[0]]))[0][0]%mod)
ytft