結果

問題 No.469 区間加算と一致検索の問題
ユーザー 草苺奶昔草苺奶昔
提出日時 2023-02-25 00:03:22
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 482 ms / 5,000 ms
コード長 439 bytes
コンパイル時間 305 ms
コンパイル使用メモリ 86,912 KB
実行使用メモリ 116,356 KB
最終ジャッジ日時 2023-10-11 07:06:27
合計ジャッジ時間 20,039 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 115 ms
72,964 KB
testcase_01 AC 114 ms
72,916 KB
testcase_02 AC 118 ms
73,176 KB
testcase_03 AC 172 ms
81,240 KB
testcase_04 AC 176 ms
81,092 KB
testcase_05 AC 186 ms
81,516 KB
testcase_06 AC 193 ms
82,124 KB
testcase_07 AC 187 ms
81,340 KB
testcase_08 AC 188 ms
82,500 KB
testcase_09 AC 162 ms
81,064 KB
testcase_10 AC 185 ms
81,172 KB
testcase_11 AC 154 ms
80,388 KB
testcase_12 AC 188 ms
82,976 KB
testcase_13 AC 173 ms
81,116 KB
testcase_14 AC 149 ms
81,008 KB
testcase_15 AC 157 ms
80,544 KB
testcase_16 AC 192 ms
82,332 KB
testcase_17 AC 185 ms
81,220 KB
testcase_18 AC 184 ms
81,452 KB
testcase_19 AC 149 ms
80,860 KB
testcase_20 AC 191 ms
82,012 KB
testcase_21 AC 167 ms
80,824 KB
testcase_22 AC 119 ms
73,176 KB
testcase_23 AC 309 ms
90,668 KB
testcase_24 AC 312 ms
90,268 KB
testcase_25 AC 308 ms
91,940 KB
testcase_26 AC 289 ms
89,884 KB
testcase_27 AC 307 ms
90,968 KB
testcase_28 AC 305 ms
90,940 KB
testcase_29 AC 312 ms
91,628 KB
testcase_30 AC 313 ms
90,524 KB
testcase_31 AC 311 ms
90,564 KB
testcase_32 AC 315 ms
91,140 KB
testcase_33 AC 482 ms
115,468 KB
testcase_34 AC 471 ms
116,156 KB
testcase_35 AC 465 ms
116,356 KB
testcase_36 AC 458 ms
115,552 KB
testcase_37 AC 473 ms
115,916 KB
testcase_38 AC 406 ms
97,948 KB
testcase_39 AC 425 ms
99,664 KB
testcase_40 AC 413 ms
98,832 KB
testcase_41 AC 414 ms
99,612 KB
testcase_42 AC 414 ms
98,328 KB
testcase_43 AC 410 ms
97,860 KB
testcase_44 AC 409 ms
99,536 KB
testcase_45 AC 410 ms
98,712 KB
testcase_46 AC 407 ms
99,132 KB
testcase_47 AC 409 ms
98,924 KB
testcase_48 AC 116 ms
73,228 KB
testcase_49 AC 114 ms
73,220 KB
testcase_50 AC 405 ms
99,244 KB
testcase_51 AC 398 ms
97,436 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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)
0