結果
問題 | No.2709 1975 Powers |
ユーザー | 寝癖 |
提出日時 | 2024-03-31 16:59:00 |
言語 | PyPy3 (7.3.15) |
結果 |
TLE
|
実行時間 | - |
コード長 | 467 bytes |
コンパイル時間 | 192 ms |
コンパイル使用メモリ | 81,700 KB |
実行使用メモリ | 144,284 KB |
最終ジャッジ日時 | 2024-03-31 16:59:22 |
合計ジャッジ時間 | 21,975 ms |
ジャッジサーバーID (参考情報) |
judge15 / judge10 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 38 ms
60,392 KB |
testcase_01 | AC | 37 ms
53,588 KB |
testcase_02 | AC | 128 ms
136,532 KB |
testcase_03 | AC | 1,646 ms
137,908 KB |
testcase_04 | TLE | - |
testcase_05 | WA | - |
testcase_06 | WA | - |
testcase_07 | AC | 97 ms
120,988 KB |
testcase_08 | WA | - |
testcase_09 | WA | - |
testcase_10 | AC | 98 ms
122,220 KB |
testcase_11 | WA | - |
testcase_12 | WA | - |
testcase_13 | WA | - |
testcase_14 | AC | 347 ms
136,616 KB |
testcase_15 | WA | - |
testcase_16 | WA | - |
testcase_17 | WA | - |
testcase_18 | WA | - |
testcase_19 | TLE | - |
testcase_20 | WA | - |
testcase_21 | WA | - |
testcase_22 | TLE | - |
testcase_23 | -- | - |
testcase_24 | -- | - |
testcase_25 | -- | - |
testcase_26 | -- | - |
ソースコード
from itertools import combinations N, P, Q = map(int, input().split()) A = list(map(int, input().split())) M = max(A)+1 pow_10, pow_9, pow_7, pow_5 = [1]*M, [1]*M, [1]*M, [1]*M for i in range(M-1): pow_10[i+1] = pow_10[i]*10 % P pow_9[i+1] = pow_9[i]*9 % P pow_7[i+1] = pow_7[i]*7 % P pow_5[i+1] = pow_5[i]*5 % P ans = 0 for a, b, c, d in combinations(A, 4): if (pow_10[a] + pow_9[b] + pow_7[c] + pow_5[d]) % P == Q: ans += 1 print(ans)