結果
| 問題 |
No.469 区間加算と一致検索の問題
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2023-02-25 00:03:22 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 402 ms / 5,000 ms |
| コード長 | 439 bytes |
| コンパイル時間 | 180 ms |
| コンパイル使用メモリ | 82,344 KB |
| 実行使用メモリ | 114,348 KB |
| 最終ジャッジ日時 | 2024-09-13 06:17:10 |
| 合計ジャッジ時間 | 13,505 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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)