結果
問題 | No.2709 1975 Powers |
ユーザー | koncha |
提出日時 | 2024-03-31 14:26:19 |
言語 | PyPy3 (7.3.15) |
結果 |
MLE
|
実行時間 | - |
コード長 | 1,012 bytes |
コンパイル時間 | 224 ms |
コンパイル使用メモリ | 81,700 KB |
実行使用メモリ | 848,296 KB |
最終ジャッジ日時 | 2024-03-31 14:26:26 |
合計ジャッジ時間 | 5,976 ms |
ジャッジサーバーID (参考情報) |
judge15 / judge12 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 47 ms
61,012 KB |
testcase_01 | AC | 46 ms
61,012 KB |
testcase_02 | MLE | - |
testcase_03 | AC | 132 ms
76,668 KB |
testcase_04 | MLE | - |
testcase_05 | AC | 141 ms
76,728 KB |
testcase_06 | AC | 285 ms
189,748 KB |
testcase_07 | AC | 76 ms
78,888 KB |
testcase_08 | MLE | - |
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 collections import Counter from copy import copy import sys sys.setrecursionlimit(10**7) def maker(l, x): current = (l[-1]*x) % P for i, item in enumerate(l): if item == current: return (l[:i], l[i:]) return maker(l+[current], x) N, P, Q = map(int, input().split()) A = list(map(int, input().split())) A.sort() lo = [] for x in [10, 9, 7, 5]: loops = maker([x%P], x) lo.append([]) for a in A: a -= 1 if len(loops[0]) > a: lo[-1].append(loops[0][a]) a -= len(loops[0]) lo[-1].append(loops[1][a%len(loops[1])]) clo = [Counter(l) for l in lo] answer = 0 clo3 = clo[3] for i in range(N): x = lo[0][i] clo3[lo[3][i]] -= 1 tmp = copy(clo3) for j in range(i+1, N): tmp[lo[3][j]] -= 1 for k in range(j+1, N): tmp[lo[3][k]] -= 1 answer += tmp.get((Q-(x+lo[1][j]+lo[2][k])) % P, 0) for k in range(j+1, N): tmp[lo[3][k]] += 1 print(answer)