結果
問題 |
No.2709 1975 Powers
|
ユーザー |
|
提出日時 | 2024-03-31 17:24:44 |
言語 | PyPy3 (7.3.15) |
結果 |
TLE
|
実行時間 | - |
コード長 | 771 bytes |
コンパイル時間 | 353 ms |
コンパイル使用メモリ | 82,108 KB |
実行使用メモリ | 76,800 KB |
最終ジャッジ日時 | 2024-09-30 21:11:10 |
合計ジャッジ時間 | 25,815 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 18 TLE * 7 |
ソースコード
N, P, Q = map(int, input().split()) A = list(map(int, input().split())) A.sort() from collections import defaultdict five = defaultdict(int) seven = defaultdict(int) nine = defaultdict(int) ten = defaultdict(int) for a in A: five[a] = pow(5, a, P) seven[a] = pow(7, a, P) nine[a] = pow(9, a, P) ten[a] = pow(10, a, P) ans = 0 for a in range(N): for b in range(a + 1, N): if A[a] == A[b]: continue for c in range(b + 1, N): if A[b] == A[c]: continue for d in range(c + 1, N): if A[c] == A[d]: continue tmp = ten[A[a]] + nine[A[b]] + seven[A[c]] + five[A[d]] if tmp % P == Q: ans += 1 print(ans)