結果

問題 No.1786 Maximum Suffix Median (Online)
ユーザー KudeKude
提出日時 2021-12-15 16:23:44
言語 C++17
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 158 ms / 2,000 ms
コード長 363 bytes
コンパイル時間 2,784 ms
コンパイル使用メモリ 200,832 KB
実行使用メモリ 13,004 KB
最終ジャッジ日時 2023-10-01 02:28:53
合計ジャッジ時間 8,569 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 1 ms
4,376 KB
testcase_04 AC 2 ms
4,376 KB
testcase_05 AC 2 ms
4,384 KB
testcase_06 AC 1 ms
4,380 KB
testcase_07 AC 2 ms
4,376 KB
testcase_08 AC 122 ms
11,652 KB
testcase_09 AC 80 ms
9,100 KB
testcase_10 AC 89 ms
9,676 KB
testcase_11 AC 70 ms
8,688 KB
testcase_12 AC 134 ms
12,168 KB
testcase_13 AC 118 ms
11,672 KB
testcase_14 AC 88 ms
9,620 KB
testcase_15 AC 103 ms
10,408 KB
testcase_16 AC 105 ms
10,696 KB
testcase_17 AC 88 ms
9,596 KB
testcase_18 AC 150 ms
12,744 KB
testcase_19 AC 153 ms
12,752 KB
testcase_20 AC 150 ms
13,004 KB
testcase_21 AC 155 ms
12,732 KB
testcase_22 AC 158 ms
12,776 KB
testcase_23 AC 100 ms
10,636 KB
testcase_24 AC 71 ms
8,664 KB
testcase_25 AC 121 ms
11,912 KB
testcase_26 AC 95 ms
10,968 KB
testcase_27 AC 85 ms
10,160 KB
testcase_28 AC 101 ms
11,392 KB
testcase_29 AC 1 ms
4,376 KB
testcase_30 AC 2 ms
4,376 KB
testcase_31 AC 115 ms
12,744 KB
testcase_32 AC 132 ms
12,748 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  multiset<int, greater<>> st;
  int n;
  cin >> n;
  int ans = 0;
  for(int i = 0; i < n; i++) {
    int a;
    cin >> a;
    a ^= ans;
    st.insert(a);
    st.insert(a);
    st.erase(st.begin());
    ans = *st.begin();
    cout << ans << '\n';
  }
}
0