結果

問題 No.2709 1975 Powers
ユーザー yaakiyu
提出日時 2024-03-31 14:20:16
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 2,203 bytes
コンパイル時間 231 ms
コンパイル使用メモリ 82,124 KB
実行使用メモリ 75,860 KB
最終ジャッジ日時 2024-09-30 19:22:45
合計ジャッジ時間 6,727 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 1 TLE * 2 -- * 22
権限があれば一括ダウンロードができます

ソースコード

diff #
プレゼンテーションモードにする

# competetive programming
#
# sys
import sys
#sys.setrecursionlimit(100000000)
if sys.version_info.minor >= 11:
# python3.114300
sys.set_int_max_str_digits(10000000)
#input = lambda: sys.stdin.readline()[:-1]
### import
## pypy
#import pypyjit; pypyjit.set_param('max_unroll_recursion=-1') #
#from atcoder.dsu import DSU # UnionFind 使uf=DSU() ; uf.merge(u, v) ; uf.same(u, v) ; uf.leader(u) ; uf.size(u) ; uf.groups()
#from atcoder.scc import SCCGraph # SCC 使g=SCCGraph() ; g.add_edge(u, v) ; scc=g.scc()
#from atcoder.segtree import SegTree # 使tree=SegTree(, , ) ; tree.set(pos, x) ; tree.prod(left, right + 1) #
#import heapq # Priority Queue 使q=[...] ; heapq.heapify(q) ; heapq.heappush(q, item) ; heapq.heappop(q, item)
#from collections import deque # Queue 使q=deque(lis) ; q.popleft(item) ; q.append(item)
#from collections import Counter # Counter
#from collections import defaultdict # defaultdict del
#from itertools import accumulate #
from itertools import combinations #
#from bisect import bisect_left, bisect_right #
#from decimal import Decimal, getcontext; getcontext().prec = 100 #
###
#inf = float("inf")
#inf = 10**18
#mod = 998244353
#mod = 1000000007 # 10**9+7
#dir = ((0, 1), (1, 0), (0, -1), (-1, 0), (1, 1), (1, -1), (-1, 1), (-1, -1)) # 8 44
INTIN = lambda: int(input())
def MAPIN(kansu=int):
return map(kansu, input().split())
LISTIN = lambda k=int: list(MAPIN(k))
n, p, q = MAPIN()
a = list(sorted(LISTIN()))
pow10 = {}
pow9 = {}
pow7 = {}
pow5 = {}
ans = 0
for a,b,c,d in combinations(a, 4):
#print(a, b, c, d)
if not pow10.get(a, False):
pow10[a] = pow(10, a, p)
if not pow9.get(b, False):
pow9[b] = pow(9, b, p)
if not pow7.get(c, False):
pow7[c] = pow(7, c, p)
if not pow5.get(d, False):
pow5[d] = pow(5, d, p)
if (pow10[a] + pow9[b] + pow7[c] + pow5[d]) % p == q:
ans += 1
print(ans)
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
0