結果
| 問題 |
No.2709 1975 Powers
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-05-26 18:33:51 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 482 bytes |
| コンパイル時間 | 513 ms |
| コンパイル使用メモリ | 82,148 KB |
| 実行使用メモリ | 83,044 KB |
| 最終ジャッジ日時 | 2025-05-26 18:33:57 |
| 合計ジャッジ時間 | 6,349 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 2 TLE * 1 -- * 22 |
ソースコード
from itertools import combinations
def main():
N, P, Q = map(int, input().split())
A = sorted(map(int, input().split()))
divisors = [10, 9, 7, 5]
A_mod = [[pow(div_, a_elm, P) for div_ in divisors] for a_elm in A]
ctr = 0
for idxs in combinations(range(N), r=4):
if (A_mod[idxs[0]][0] + A_mod[idxs[1]][1] +
A_mod[idxs[2]][2] + A_mod[idxs[3]][3]) % P == Q:
ctr += 1
print(ctr)
if __name__ == "__main__":
main()