結果
問題 | No.2308 [Cherry 5th Tune B] もしかして、真? |
ユーザー | 倉 |
提出日時 | 2023-05-20 09:11:08 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 2,885 bytes |
コンパイル時間 | 190 ms |
コンパイル使用メモリ | 82,668 KB |
実行使用メモリ | 140,100 KB |
最終ジャッジ日時 | 2024-06-01 05:00:16 |
合計ジャッジ時間 | 22,470 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 48 ms
56,492 KB |
testcase_01 | WA | - |
testcase_02 | WA | - |
testcase_03 | WA | - |
testcase_04 | WA | - |
testcase_05 | WA | - |
testcase_06 | WA | - |
testcase_07 | WA | - |
testcase_08 | WA | - |
testcase_09 | WA | - |
testcase_10 | WA | - |
testcase_11 | WA | - |
testcase_12 | WA | - |
testcase_13 | AC | 569 ms
126,540 KB |
testcase_14 | WA | - |
testcase_15 | WA | - |
testcase_16 | WA | - |
testcase_17 | WA | - |
testcase_18 | WA | - |
testcase_19 | WA | - |
testcase_20 | WA | - |
testcase_21 | WA | - |
testcase_22 | AC | 582 ms
139,572 KB |
testcase_23 | WA | - |
testcase_24 | WA | - |
testcase_25 | WA | - |
testcase_26 | AC | 579 ms
139,788 KB |
testcase_27 | AC | 581 ms
139,980 KB |
testcase_28 | AC | 580 ms
139,584 KB |
testcase_29 | AC | 575 ms
139,832 KB |
testcase_30 | AC | 571 ms
139,344 KB |
testcase_31 | AC | 360 ms
138,232 KB |
testcase_32 | AC | 365 ms
137,864 KB |
testcase_33 | AC | 363 ms
138,028 KB |
testcase_34 | AC | 373 ms
139,360 KB |
testcase_35 | WA | - |
testcase_36 | AC | 379 ms
138,748 KB |
testcase_37 | WA | - |
testcase_38 | WA | - |
ソースコード
import sys from functools import partial # import pypyjit # pypyjit.set_param('max_unroll_recursion = -1') sys.setrecursionlimit(500005) stdin = sys.stdin ns = lambda: stdin.readline().strip() ni = lambda: int(ns()) na = lambda: list(map(int, stdin.readline().split())) nz = lambda: list(map(lambda x: int(x)-1, stdin.readline().split())) # 遅い printa = partial(print, sep="\n") # printa(*A) で各要素を改行して出力 mod = 1000000007 # 998244353 inf = 10 ** 18 # @maspy / Segment Tree のお勉強(1) # https://maspypy.com/segment-tree-%E3%81%AE%E3%81%8A%E5%8B%89%E5%BC%B71 from operator import add class SegTree: X_unit = 0 X_f = add def __init__(self, N): self.N = N self.X = [self.X_unit] * (N + N) def build(self, seq): for i, x in enumerate(seq, self.N): self.X[i] = x for i in range(self.N - 1, 0, -1): self.X[i] = self.X_f(self.X[i << 1], self.X[i << 1 | 1]) def set_val(self, i, x): i += self.N self.X[i] = x while i > 1: i >>= 1 self.X[i] = self.X_f(self.X[i << 1], self.X[i << 1 | 1]) def sub_val(self, i, x): i += self.N self.X[i] -= x while i > 1: i >>= 1 self.X[i] = self.X_f(self.X[i << 1], self.X[i << 1 | 1]) def fold(self, L, R): """半開区間 [L, R)""" L += self.N R += self.N vL = self.X_unit vR = self.X_unit while L < R: if L & 1: vL = self.X_f(vL, self.X[L]) L += 1 if R & 1: R -= 1 vR = self.X_f(self.X[R], vR) L >>= 1 R >>= 1 return self.X_f(vL, vR) def find_l(self, k): id = 1 while id < self.N: if self.X[id << 1] >= k: id <<= 1 else: k -= self.X[id << 1] id = id << 1 | 1 return id - self.N def debug(self): print(self.X[self.N:]) def set_size(k): ret = 1 while k >= 2: k //= 2 ret += 1 return pow(2, ret) def cal(x, y, o): if o == "a": return x & y elif o == "o": return x | y elif o == "x": return x ^ y else: return (not x) | y def solve(): N = ni() N = set_size(N) Xseg = SegTree(N) Xseg.build([1] * N) Yseg = SegTree(N) Yseg.build([1] * N) X = [1 if i == "True" else 0 for i in ns().split()] Y = list(ns().split()) S = na() for s in S: yid = Yseg.find_l(s) Yseg.sub_val(yid, 1) op = Y[yid][0] xidl = Xseg.find_l(s) xidr = Xseg.find_l(s+1) Xseg.sub_val(xidr, 1) X[yid] = cal(X[xidl], X[xidr], op) print("True" if X[0] else "False") T = ni() for _ in range(T): solve()