結果
| 問題 | No.2709 1975 Powers | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2024-03-31 15:45:37 | 
| 言語 | PyPy3 (7.3.15) | 
| 結果 | 
                                TLE
                                 
                             | 
| 実行時間 | - | 
| コード長 | 422 bytes | 
| コンパイル時間 | 338 ms | 
| コンパイル使用メモリ | 82,584 KB | 
| 実行使用メモリ | 76,300 KB | 
| 最終ジャッジ日時 | 2024-09-30 20:55:15 | 
| 合計ジャッジ時間 | 3,918 ms | 
| ジャッジサーバーID (参考情報) | judge1 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 2 | 
| other | AC * 1 TLE * 2 -- * 22 | 
ソースコード
from itertools import combinations
N,P,Q=list(map(int,input().split()))
A=list(map(int,input().split()))
A.sort()
M=[[0 for _ in range(4)] for _ in range(N)]
for (i,a) in enumerate(A):
    M[i][0]=pow(10,a,P)
    M[i][1]=pow(9,a,P)
    M[i][2]=pow(7,a,P)
    M[i][3]=pow(5,a,P)
ans=0
for l in combinations(list(range(N)),4):
    x=0
    for i in range(4):
        x+=M[l[i]][i]
        x%=P
    if x==Q:ans+=1
print(ans)
            
            
            
        