結果
問題 | No.2308 [Cherry 5th Tune B] もしかして、真? |
ユーザー | ntuda |
提出日時 | 2023-05-21 12:28:48 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,120 bytes |
コンパイル時間 | 352 ms |
コンパイル使用メモリ | 87,124 KB |
実行使用メモリ | 133,412 KB |
最終ジャッジ日時 | 2023-08-23 15:03:04 |
合計ジャッジ時間 | 47,358 ms |
ジャッジサーバーID (参考情報) |
judge11 / judge15 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 71 ms
71,368 KB |
testcase_01 | WA | - |
testcase_02 | WA | - |
testcase_03 | RE | - |
testcase_04 | WA | - |
testcase_05 | WA | - |
testcase_06 | RE | - |
testcase_07 | AC | 1,220 ms
116,368 KB |
testcase_08 | RE | - |
testcase_09 | RE | - |
testcase_10 | RE | - |
testcase_11 | AC | 1,249 ms
120,344 KB |
testcase_12 | AC | 1,298 ms
124,320 KB |
testcase_13 | AC | 1,276 ms
120,256 KB |
testcase_14 | WA | - |
testcase_15 | WA | - |
testcase_16 | WA | - |
testcase_17 | WA | - |
testcase_18 | WA | - |
testcase_19 | WA | - |
testcase_20 | AC | 1,250 ms
121,200 KB |
testcase_21 | WA | - |
testcase_22 | WA | - |
testcase_23 | WA | - |
testcase_24 | AC | 1,328 ms
133,328 KB |
testcase_25 | AC | 1,281 ms
132,976 KB |
testcase_26 | WA | - |
testcase_27 | WA | - |
testcase_28 | AC | 1,297 ms
133,348 KB |
testcase_29 | WA | - |
testcase_30 | AC | 1,325 ms
133,016 KB |
testcase_31 | AC | 1,063 ms
129,552 KB |
testcase_32 | AC | 1,056 ms
129,544 KB |
testcase_33 | AC | 1,070 ms
130,736 KB |
testcase_34 | AC | 1,060 ms
130,816 KB |
testcase_35 | AC | 1,069 ms
132,336 KB |
testcase_36 | WA | - |
testcase_37 | RE | - |
testcase_38 | AC | 1,280 ms
126,144 KB |
ソースコード
class Bit: def __init__(self, n): self.size = n self.tree = [0] * (n + 1) def sum(self, i): s = 0 while i > 0: s += self.tree[i] i -= i & -i return s def add(self, i, x): while i <= self.size: self.tree[i] += x i += i & -i def search(x): lb = 1 ub = N + 1 while ub - lb > 1: mid = (lb + ub) // 2 if bit.sum(mid) <= x: lb = mid else: ub = mid return lb T = int(input()) for t in range(T): N = int(input()) X = [True if x == "True" else False for x in input().split()] Y = input().split() S = list(map(int, input().split())) bit = Bit(N + 1) for i in range(1, N + 1): bit.add(i, 1) for s in S: r = search(s) l = search(s - 1) if Y[l] == "and": X[r] &= X[l] elif Y[l] == "or": X[r] |= X[l] elif Y[l] == "xor": X[r] ^= X[l] else: if X[l] == False: X[r] = True bit.add(l, -1) print(X[r])