結果
問題 | No.2942 Sigma Music Game Level Problem |
ユーザー | miya145592 |
提出日時 | 2024-10-18 22:12:07 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 2,244 bytes |
コンパイル時間 | 623 ms |
コンパイル使用メモリ | 82,304 KB |
実行使用メモリ | 289,952 KB |
最終ジャッジ日時 | 2024-11-07 21:59:54 |
合計ジャッジ時間 | 29,317 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 54 ms
66,048 KB |
testcase_01 | AC | 55 ms
66,048 KB |
testcase_02 | AC | 57 ms
66,432 KB |
testcase_03 | AC | 59 ms
65,792 KB |
testcase_04 | AC | 56 ms
66,176 KB |
testcase_05 | AC | 58 ms
66,304 KB |
testcase_06 | AC | 57 ms
66,048 KB |
testcase_07 | AC | 61 ms
66,560 KB |
testcase_08 | AC | 101 ms
81,792 KB |
testcase_09 | AC | 82 ms
75,648 KB |
testcase_10 | AC | 76 ms
73,216 KB |
testcase_11 | AC | 938 ms
186,096 KB |
testcase_12 | WA | - |
testcase_13 | AC | 2,664 ms
227,568 KB |
testcase_14 | AC | 1,048 ms
215,840 KB |
testcase_15 | AC | 512 ms
196,532 KB |
testcase_16 | AC | 2,397 ms
217,524 KB |
testcase_17 | AC | 476 ms
118,144 KB |
testcase_18 | AC | 1,658 ms
191,376 KB |
testcase_19 | AC | 3,243 ms
270,712 KB |
testcase_20 | AC | 558 ms
172,016 KB |
testcase_21 | AC | 3,307 ms
289,312 KB |
testcase_22 | AC | 3,336 ms
289,952 KB |
testcase_23 | AC | 581 ms
106,368 KB |
testcase_24 | AC | 58 ms
66,304 KB |
testcase_25 | AC | 59 ms
66,048 KB |
testcase_26 | WA | - |
ソースコード
class SegTree: def __init__(self, op, e, n, v=None): self._n = n self._op = op self._e = e self._log = (n - 1).bit_length() self._size = 1 << self._log self._d = [self._e()] * (self._size << 1) if v is not None: for i in range(self._n): self._d[self._size + i] = v[i] for i in range(self._size - 1, 0, -1): self._d[i] = self._op(self._d[i << 1], self._d[i << 1 | 1]) def set(self, p, x): p += self._size self._d[p] = x while p: l, r = p, p^1 if l > r: l, r = r, l self._d[p >> 1] = self._op(self._d[l], self._d[r]) p >>= 1 def get(self, p): return self._d[p + self._size] #[l, r)の区間で求める def prod(self, l, r): sml, smr = self._e(), self._e() l += self._size r += self._size while l < r: if l & 1: sml = self._op(sml, self._d[l]) l += 1 if r & 1: r -= 1 smr = self._op(self._d[r], smr) l >>= 1 r >>= 1 return self._op(sml, smr) def all_prod(self): return self._d[1] def op(x, y): return x+y def e(): return 0 BASE = 20 MASK = (1<<BASE)-1 def op2(x, y): xi, xc = x>>BASE, x&MASK yi, yc = y>>BASE, y&MASK ret = ((xi+yi)<<BASE) | (xc+yc) return ret def e2(): return 0 import sys input = sys.stdin.readline N, Q, L = map(int, input().split()) A = list(map(int, input().split())) query = [list(map(int, input().split())) for _ in range(Q)] dp = [0 for _ in range(200001)] for a in A: dp[a] += 1 for i in range(200001): c = dp[i] dp[i] = ((c*i)<<BASE) | c ST = SegTree(op2, e2, 200001, dp) flag = True for q in query: t = q[0] if t==1: l = q[1] v = ST.get(l) vi, vc = v>>BASE, v&MASK vi += l vc += 1 v = (vi<<BASE)|vc ST.set(l, v) elif t==2: l, r = q[1:] v = ST.prod(l, r+1) vi, vc = v>>BASE, v&MASK print(vc, vi) flag = False else: m = q[1] L = m if flag: print("Not Found!")