結果
問題 | No.2709 1975 Powers |
ユーザー | KDKJ |
提出日時 | 2024-04-30 00:26:35 |
言語 | PyPy3 (7.3.15) |
結果 |
TLE
|
実行時間 | - |
コード長 | 1,319 bytes |
コンパイル時間 | 250 ms |
コンパイル使用メモリ | 82,432 KB |
実行使用メモリ | 247,936 KB |
最終ジャッジ日時 | 2024-04-30 00:26:42 |
合計ジャッジ時間 | 7,196 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 154 ms
93,696 KB |
testcase_01 | AC | 156 ms
88,320 KB |
testcase_02 | AC | 627 ms
155,136 KB |
testcase_03 | AC | 1,985 ms
184,320 KB |
testcase_04 | TLE | - |
testcase_05 | -- | - |
testcase_06 | -- | - |
testcase_07 | -- | - |
testcase_08 | -- | - |
testcase_09 | -- | - |
testcase_10 | -- | - |
testcase_11 | -- | - |
testcase_12 | -- | - |
testcase_13 | -- | - |
testcase_14 | -- | - |
testcase_15 | -- | - |
testcase_16 | -- | - |
testcase_17 | -- | - |
testcase_18 | -- | - |
testcase_19 | -- | - |
testcase_20 | -- | - |
testcase_21 | -- | - |
testcase_22 | -- | - |
testcase_23 | -- | - |
testcase_24 | -- | - |
testcase_25 | -- | - |
testcase_26 | -- | - |
ソースコード
from heapq import heappush, heappop, heapify import sys from collections import defaultdict, deque,Counter from math import ceil, floor, sqrt, factorial,gcd from itertools import permutations, combinations,product from bisect import bisect_left, bisect_right from copy import deepcopy from functools import lru_cache #@lru_cache(maxsize=None) from fractions import Fraction sys.setrecursionlimit(10**6) # input = sys.stdin.readline vector1 = [[0, -1], [1, 0], [0, 1], [-1, 0]] vector2 = [[0, 1], [1, 0], [-1, 0], [0, -1], [1,-1], [-1, 1], [1, 1], [-1, -1]] from copy import deepcopy def main(): N,P,Q = map(int,input().split()) A = list(map(int,input().split())) A.sort() array = [[0 for i in range(P)]] for i in range(N): m = pow(5,A[i],P) tmp = deepcopy(array[-1]) tmp[m] += 1 array.append(tmp) ans = 0 #print(array) for i in range(N-3): for j in range(i+1,N-2): if A[i] == A[j]: continue for k in range(j+1,N-1): if A[j] == A[k]: continue t = (pow(10,A[i],P) + pow(9,A[j],P) + pow(7,A[k],P))%P t = (Q-t)%P ans += array[-1][t]-array[k+1][t] print(ans) if __name__ == '__main__': main()