結果

問題 No.2709 1975 Powers
ユーザー hato336hato336
提出日時 2024-03-31 13:42:32
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 596 bytes
コンパイル時間 148 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 90,296 KB
最終ジャッジ日時 2024-03-31 13:43:11
合計ジャッジ時間 26,835 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 127 ms
84,920 KB
testcase_01 AC 125 ms
84,920 KB
testcase_02 AC 206 ms
90,168 KB
testcase_03 AC 1,290 ms
89,784 KB
testcase_04 AC 1,865 ms
90,040 KB
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 144 ms
89,272 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 143 ms
89,272 KB
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 AC 447 ms
89,656 KB
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 TLE -
testcase_23 TLE -
testcase_24 TLE -
testcase_25 TLE -
testcase_26 TLE -
権限があれば一括ダウンロードができます

ソースコード

diff #

import collections,sys,math,functools,operator,itertools,bisect,heapq,decimal,string,time,random
#sys.setrecursionlimit(10**9)
#sys.set_int_max_str_digits(0)
#input = sys.stdin.readline
n,p,q = map(int,input().split())
a = list(map(int,input().split()))
ans = 0
x = [[] for i in range(p)]
for i in range(n):
    x[pow(5,a[i],p)].append(i)

for i in range(n):
    for j in range(i+1,n):
        for k in range(j+1,n):
            z = pow(10,a[i],p) + pow(9,a[j],p) + pow(7,a[k],p)
            z %= p
            r = (q - z) % p
            ans += len(x[r]) - bisect.bisect_right(x[r],k)
print(ans)
0