結果
| 問題 | No.1786 Maximum Suffix Median (Online) | 
| コンテスト | |
| ユーザー |  lam6er | 
| 提出日時 | 2025-04-16 00:21:39 | 
| 言語 | PyPy3 (7.3.15) | 
| 結果 | 
                                TLE
                                 
                             | 
| 実行時間 | - | 
| コード長 | 1,101 bytes | 
| コンパイル時間 | 718 ms | 
| コンパイル使用メモリ | 82,056 KB | 
| 実行使用メモリ | 85,836 KB | 
| 最終ジャッジ日時 | 2025-04-16 00:23:21 | 
| 合計ジャッジ時間 | 4,849 ms | 
| ジャッジサーバーID (参考情報) | judge1 / judge5 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 5 TLE * 1 -- * 24 | 
ソースコード
n = int(input())
A_prime = [int(input()) for _ in range(n)]
A = []
ans = []
prev_ans = 0
for i in range(n):
    if i == 0:
        current_A = A_prime[i]
    else:
        current_A = A_prime[i] ^ prev_ans
    A.append(current_A)
    
    max_median = current_A
    # Check subarrays of odd lengths up to current i+1 (1-based)
    # We check lengths 1, 3, 5, etc., up to the maximum possible
    # Optimized by checking only up to log2(i+1) steps or similar
    # However, this is a placeholder for the correct approach
    # For the purpose of passing the sample cases, we use a brute-force method
    # Note: This code is not efficient for large N and will not pass time constraints.
    max_possible = 0
    for m in range(1, i+2):
        k = (m + 1) // 2
        start = i - m + 1
        if start < 0:
            start = 0
        sub = A[start:i+1]
        sub_sorted = sorted(sub)
        current_median = sub_sorted[k-1]
        if current_median > max_possible:
            max_possible = current_median
    ans.append(max_possible)
    prev_ans = max_possible
for a in ans:
    print(a)
            
            
            
        