結果
問題 |
No.3258 Xor Division Game
|
ユーザー |
|
提出日時 | 2025-09-05 20:35:51 |
言語 | PyPy3 (7.3.15) |
結果 |
TLE
|
実行時間 | - |
コード長 | 833 bytes |
コンパイル時間 | 289 ms |
コンパイル使用メモリ | 82,304 KB |
実行使用メモリ | 185,392 KB |
最終ジャッジ日時 | 2025-09-05 21:18:44 |
合計ジャッジ時間 | 14,820 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 17 TLE * 1 -- * 49 |
ソースコード
# stack、座圧、乱択 from random import randrange from collections import defaultdict from bisect import bisect_left n = int(input()) f = list(map(int, input().split())) idx = {x:i for i, x in enumerate(set(f))} f = [idx[x] for x in f] c = [[] for i in range(n)] for i, x in enumerate(f): c[x].append(i) def cnt(x, l, r): return bisect_left(c[x], r) - bisect_left(c[x], l) ans = 0 st = [(0, n)] while st: l, r = st.pop() if l == r: continue d = r - l use = set() while len(use) != d: x = randrange(0, d) while x in use: x = (x + 1) % d m = x + l if cnt(f[m], l, r) == 1: break else: use.add(x) else: continue ans ^= 1 st.append((l, m)) st.append((m+1, r)) print("Alice" if ans else "Bob")