結果
| 問題 | No.3579 区間積逆像 |
| コンテスト | |
| ユーザー |
titia
|
| 提出日時 | 2026-07-09 03:00:03 |
| 言語 | PyPy3 (7.3.17) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 973 bytes |
| 記録 | |
| コンパイル時間 | 228 ms |
| コンパイル使用メモリ | 95,852 KB |
| 実行使用メモリ | 122,952 KB |
| 最終ジャッジ日時 | 2026-07-09 03:00:35 |
| 合計ジャッジ時間 | 5,503 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge3_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 16 WA * 14 |
ソースコード
import sys
input = sys.stdin.readline
from collections import Counter
N,P,C=list(map(int,input().split()))
A=list(map(int,input().split()))
Z=[]
for i in range(N):
if A[i]==0:
Z.append(i)
ANS=0
if C==0:
ind=0
for i in range(N):
if ind==len(Z):
break
if Z[ind]<i:
ind+=1
if ind==len(Z):
break
ANS+=N-Z[ind]
print(ANS)
else:
LIST=[]
X=[]
for i in range(N):
if A[i]==0:
if X!=[]:
LIST.append(X)
X=[]
else:
X=[]
else:
X.append(A[i])
if X!=[]:
LIST.append(X)
#print(LIST)
for L in LIST:
S=[1]
now=1
for x in L:
now=now*x%P
S.append(now)
CA=Counter(S)
for s in S:
CA[s]-=1
need=C*pow(s,P-2,P)%P
ANS+=CA[need]
print(ANS)
titia