結果
| 問題 | 
                            No.3224 2×2行列入門
                             | 
                    
| コンテスト | |
| ユーザー | 
                             titia
                         | 
                    
| 提出日時 | 2025-08-09 00:41:54 | 
| 言語 | Python3  (3.13.1 + numpy 2.2.1 + scipy 1.14.1)  | 
                    
| 結果 | 
                             
                                AC
                                 
                             
                            
                         | 
                    
| 実行時間 | 31 ms / 2,000 ms | 
| コード長 | 748 bytes | 
| コンパイル時間 | 679 ms | 
| コンパイル使用メモリ | 12,288 KB | 
| 実行使用メモリ | 10,496 KB | 
| 最終ジャッジ日時 | 2025-08-09 00:41:57 | 
| 合計ジャッジ時間 | 2,221 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge4 / judge5 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 23 | 
ソースコード
import sys
input = sys.stdin.readline
def prod(A,B,k,l,m):# A:k*l,B:l*m
    C=[[None for i in range(m)] for j in range(k)]
    for i in range(k):
        for j in range(m):
            ANS=0
            for pl in range(l):
                ANS=(ANS+A[i][pl]*B[pl][j])
            C[i][j]=ANS
    return C
def plus(A,B,k,l):# a,B:k*l
    C=[[None for i in range(l)] for j in range(k)]
    for i in range(k):
        for j in range(l):
            C[i][j]=(A[i][j]+B[i][j])%mod
    return C
A,B=map(int,input().split())
C,D=map(int,input().split())
A2,B2=map(int,input().split())
C2,D2=map(int,input().split())
X=[[A,B],[C,D]]
Y=[[A2,B2],[C2,D2]]
Z=prod(X,Y,2,2,2)
ANS=prod(Z,Z,2,2,2)
print(ANS[0][0],ANS[0][1])
print(ANS[1][0],ANS[1][1])
            
            
            
        
            
titia