結果
| 問題 | No.469 区間加算と一致検索の問題 |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2023-02-25 00:03:22 |
| 言語 | PyPy3 (7.3.17) |
| 結果 |
AC
|
| 実行時間 | 319 ms / 5,000 ms |
| コード長 | 439 bytes |
| 記録 | |
| コンパイル時間 | 618 ms |
| コンパイル使用メモリ | 85,072 KB |
| 実行使用メモリ | 116,848 KB |
| 最終ジャッジ日時 | 2026-04-04 03:44:56 |
| 合計ジャッジ時間 | 10,636 ms |
|
ジャッジサーバーID (参考情報) |
judge5_0 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 49 |
ソースコード
from collections import defaultdict
from random import randint
pool = defaultdict(lambda: randint(1, (1 << 61) - 1))
curHash = 0
history = {0: 0}
n, q = map(int, input().split())
for i in range(q):
op, *args = input().split()
if op == "?":
print(history.get(curHash, -1))
else:
left, rigth, add = map(int, args)
curHash += (pool[rigth] - pool[left]) * add
history.setdefault(curHash, i + 1)