結果

問題 No.469 区間加算と一致検索の問題
ユーザー zimphazimpha
提出日時 2017-12-09 14:41:43
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 593 ms / 5,000 ms
コード長 356 bytes
コンパイル時間 279 ms
コンパイル使用メモリ 87,064 KB
実行使用メモリ 114,380 KB
最終ジャッジ日時 2023-08-23 13:42:16
合計ジャッジ時間 18,075 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 88 ms
71,984 KB
testcase_01 AC 87 ms
71,976 KB
testcase_02 AC 130 ms
80,600 KB
testcase_03 AC 135 ms
78,712 KB
testcase_04 AC 136 ms
78,120 KB
testcase_05 AC 147 ms
79,784 KB
testcase_06 AC 149 ms
79,624 KB
testcase_07 AC 151 ms
80,356 KB
testcase_08 AC 150 ms
80,652 KB
testcase_09 AC 128 ms
78,596 KB
testcase_10 AC 148 ms
79,940 KB
testcase_11 AC 120 ms
78,468 KB
testcase_12 AC 151 ms
79,716 KB
testcase_13 AC 139 ms
78,180 KB
testcase_14 AC 118 ms
78,184 KB
testcase_15 AC 120 ms
78,244 KB
testcase_16 AC 150 ms
80,104 KB
testcase_17 AC 147 ms
79,564 KB
testcase_18 AC 152 ms
80,296 KB
testcase_19 AC 117 ms
78,260 KB
testcase_20 AC 151 ms
80,188 KB
testcase_21 AC 134 ms
78,936 KB
testcase_22 AC 91 ms
71,772 KB
testcase_23 AC 236 ms
88,116 KB
testcase_24 AC 227 ms
89,100 KB
testcase_25 AC 230 ms
88,560 KB
testcase_26 AC 230 ms
88,544 KB
testcase_27 AC 229 ms
88,452 KB
testcase_28 AC 231 ms
88,924 KB
testcase_29 AC 233 ms
88,136 KB
testcase_30 AC 231 ms
88,772 KB
testcase_31 AC 231 ms
87,588 KB
testcase_32 AC 232 ms
87,952 KB
testcase_33 AC 586 ms
113,728 KB
testcase_34 AC 587 ms
114,072 KB
testcase_35 AC 586 ms
114,380 KB
testcase_36 AC 569 ms
114,004 KB
testcase_37 AC 582 ms
113,928 KB
testcase_38 AC 575 ms
109,908 KB
testcase_39 AC 572 ms
110,752 KB
testcase_40 AC 577 ms
110,620 KB
testcase_41 AC 578 ms
110,720 KB
testcase_42 AC 576 ms
110,500 KB
testcase_43 AC 572 ms
110,788 KB
testcase_44 AC 576 ms
111,276 KB
testcase_45 AC 577 ms
110,172 KB
testcase_46 AC 588 ms
112,100 KB
testcase_47 AC 579 ms
110,096 KB
testcase_48 AC 91 ms
71,976 KB
testcase_49 AC 89 ms
71,728 KB
testcase_50 AC 593 ms
112,216 KB
testcase_51 AC 590 ms
111,748 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import random as rnd

rnd.seed(2333)
n, q = list(map(int, input().split()))
seed = [rnd.randint(0, 2 ** 60) for i in range(n)] + [0]
now = 0
mem = {0 : 0}
for i in range(q):
  c = input()
  if c[0] == '?':
    print(mem[now])
  else:
    _, l, r, k = c.split()
    now += int(k) * (seed[int(l)] - seed[int(r)])
    if not now in mem:
      mem[now] = i + 1
0