結果
| 問題 | No.2709 1975 Powers | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2024-03-31 15:15:35 | 
| 言語 | PyPy3 (7.3.15) | 
| 結果 | 
                                TLE
                                 
                             | 
| 実行時間 | - | 
| コード長 | 410 bytes | 
| コンパイル時間 | 177 ms | 
| コンパイル使用メモリ | 82,104 KB | 
| 実行使用メモリ | 186,308 KB | 
| 最終ジャッジ日時 | 2024-09-30 20:28:43 | 
| 合計ジャッジ時間 | 3,666 ms | 
| ジャッジサーバーID (参考情報) | judge4 / judge5 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 2 | 
| other | TLE * 1 -- * 24 | 
ソースコード
from itertools import combinations
def count_ways(N, P, Q, A):
    ways = 0
    powers = [[(x**a) % P for a in A] for x in [10, 9, 7, 5]]
    for a, b, c, d in combinations(range(N), 4):
        if (powers[0][a] + powers[1][b] + powers[2][c] + powers[3][d]) % P == Q:
            ways += 1
    return ways
N, P, Q = map(int, input().split())
A = list(map(int, input().split()))
print(count_ways(N, P, Q, A))
            
            
            
        