結果
| 問題 | No.1786 Maximum Suffix Median (Online) | 
| コンテスト | |
| ユーザー |  gew1fw | 
| 提出日時 | 2025-06-12 19:11:12 | 
| 言語 | PyPy3 (7.3.15) | 
| 結果 | 
                                TLE
                                 
                             | 
| 実行時間 | - | 
| コード長 | 933 bytes | 
| コンパイル時間 | 179 ms | 
| コンパイル使用メモリ | 82,072 KB | 
| 実行使用メモリ | 123,088 KB | 
| 最終ジャッジ日時 | 2025-06-12 19:11:27 | 
| 合計ジャッジ時間 | 4,972 ms | 
| ジャッジサーバーID (参考情報) | judge5 / judge1 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 5 TLE * 1 -- * 24 | 
ソースコード
import sys
import bisect
def main():
    input = sys.stdin.read().split()
    N = int(input[0])
    A_prime = list(map(int, input[1:N+1]))
    
    ans = []
    decoded_A = []
    current_ans = 0
    
    for i in range(N):
        if i == 0:
            a = A_prime[i]
        else:
            a = A_prime[i] ^ current_ans
        decoded_A.append(a)
        
        # Compute ans[i+1] for the current 0-based i (which is 1-based in the problem)
        max_median = a
        sorted_list = [a]
        current_max = a
        
        for j in range(i-1, -1, -1):
            bisect.insort(sorted_list, decoded_A[j])
            l = i - j + 1
            k = (l + 1) // 2
            median = sorted_list[k-1]
            if median > current_max:
                current_max = median
        current_ans = current_max
        ans.append(current_ans)
    
    for a in ans:
        print(a)
if __name__ == "__main__":
    main()
            
            
            
        