結果
| 問題 | No.3491 右結合的総乗 |
| コンテスト | |
| ユーザー |
ゼット
|
| 提出日時 | 2026-04-03 21:32:01 |
| 言語 | PyPy3 (7.3.17) |
| 結果 |
AC
|
| 実行時間 | 79 ms / 2,000 ms |
| コード長 | 308 bytes |
| 記録 | |
| コンパイル時間 | 313 ms |
| コンパイル使用メモリ | 85,120 KB |
| 実行使用メモリ | 65,920 KB |
| 最終ジャッジ日時 | 2026-04-03 21:32:15 |
| 合計ジャッジ時間 | 3,153 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge3_1 |
| 純コード判定待ち |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 40 |
ソースコード
N,M=map(int,input().split())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
d=[0]*(N+1)
from collections import deque
S=deque()
for x in B:
S.append(x)
d[x]=1
while S:
pos=S.pop()
for x in B:
pos2=pos+x
y=A[pos2]
if d[y]==0:
d[y]=1
S.append(y)
print(sum(d))
ゼット