結果

問題 No.2709 1975 Powers
ユーザー Nikkuniku029Nikkuniku029
提出日時 2024-03-31 17:19:21
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 592 bytes
コンパイル時間 312 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 82,308 KB
最終ジャッジ日時 2024-03-31 17:19:43
合計ジャッジ時間 22,429 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 41 ms
62,416 KB
testcase_01 AC 41 ms
55,612 KB
testcase_02 AC 74 ms
66,416 KB
testcase_03 AC 1,726 ms
75,760 KB
testcase_04 TLE -
testcase_05 AC 1,965 ms
75,936 KB
testcase_06 AC 618 ms
75,796 KB
testcase_07 AC 47 ms
62,224 KB
testcase_08 AC 567 ms
75,812 KB
testcase_09 TLE -
testcase_10 AC 51 ms
64,340 KB
testcase_11 AC 100 ms
70,560 KB
testcase_12 AC 182 ms
72,608 KB
testcase_13 AC 1,991 ms
75,936 KB
testcase_14 AC 321 ms
73,840 KB
testcase_15 AC 334 ms
75,820 KB
testcase_16 AC 1,587 ms
75,808 KB
testcase_17 AC 59 ms
66,408 KB
testcase_18 AC 218 ms
72,596 KB
testcase_19 TLE -
testcase_20 AC 73 ms
68,508 KB
testcase_21 AC 541 ms
75,808 KB
testcase_22 TLE -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

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):
        for c in range(b + 1, N):
            for d in range(c + 1, N):
                tmp = ten[A[a]] + nine[A[b]] + seven[A[c]] + five[A[d]]
                if tmp % P == Q:
                    ans += 1
print(ans)
0