結果
問題 |
No.3258 Xor Division Game
|
ユーザー |
|
提出日時 | 2025-09-05 20:34:44 |
言語 | PyPy3 (7.3.15) |
結果 |
TLE
|
実行時間 | - |
コード長 | 851 bytes |
コンパイル時間 | 474 ms |
コンパイル使用メモリ | 82,692 KB |
実行使用メモリ | 228,576 KB |
最終ジャッジ日時 | 2025-09-05 21:18:42 |
合計ジャッジ時間 | 15,117 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 17 TLE * 1 -- * 49 |
ソースコード
# stack、座圧 import sys from random import randrange from collections import defaultdict from bisect import bisect_left sys.setrecursionlimit(10 ** 6) 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() 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")