結果
| 問題 |
No.2709 1975 Powers
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-05-26 18:35:38 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 645 bytes |
| コンパイル時間 | 522 ms |
| コンパイル使用メモリ | 81,840 KB |
| 実行使用メモリ | 82,768 KB |
| 最終ジャッジ日時 | 2025-05-26 18:36:01 |
| 合計ジャッジ時間 | 22,562 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 18 TLE * 3 -- * 4 |
ソースコード
from itertools import combinations
def main():
N, P, Q = map(int, input().split())
A = sorted(map(int, input().split()))
A_10 = [pow(10, a_elm, P) for a_elm in A]
A_9 = [pow(9, a_elm, P) for a_elm in A]
A_7 = [pow(7, a_elm, P) for a_elm in A]
A_5 = [pow(5, a_elm, P) for a_elm in A]
# 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_10[idxs[0]] + A_9[idxs[1]] +
A_7[idxs[2]] + A_5[idxs[3]]) % P == Q:
ctr += 1
print(ctr)
if __name__ == "__main__":
main()