結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 43 ms
62,412 KB
testcase_01 AC 42 ms
55,608 KB
testcase_02 AC 76 ms
66,404 KB
testcase_03 AC 1,701 ms
75,764 KB
testcase_04 TLE -
testcase_05 TLE -
testcase_06 AC 628 ms
75,936 KB
testcase_07 AC 50 ms
62,220 KB
testcase_08 AC 602 ms
75,840 KB
testcase_09 TLE -
testcase_10 AC 54 ms
64,336 KB
testcase_11 AC 106 ms
70,564 KB
testcase_12 AC 190 ms
72,612 KB
testcase_13 TLE -
testcase_14 AC 327 ms
75,764 KB
testcase_15 AC 352 ms
75,844 KB
testcase_16 AC 1,629 ms
75,816 KB
testcase_17 AC 62 ms
66,408 KB
testcase_18 AC 224 ms
73,248 KB
testcase_19 TLE -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
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):
        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)
0