提出 #75946613


ソースコード 拡げる

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define fastio cin.tie(0)->sync_with_stdio(0)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define compress(v) sort(all(v)), v.erase(unique(all(v)), v.end())
#define sz(x) (int)(x).size()
using namespace std;
using namespace __gnu_pbds;
template <typename T>
using ord_multiset = tree<T, null_type, less_equal<T>, rb_tree_tag, tree_order_statistics_node_update>;
typedef long long ll;

int main() {
    fastio; int X, Q; cin >> X >> Q;
    ord_multiset<int> os; os.insert(X);
    for (int q = 0; q < Q; q++) {
        int a, b; cin >> a >> b;
        os.insert(a); os.insert(b);
        cout << *os.find_by_order((sz(os)-1)/2) << "\n";
    }
    return 0;
}

提出情報

提出日時
問題 D - Chalkboard Median
ユーザ Lov34ever
言語 C++23 (GCC 15.2.0)
得点 400
コード長 815 Byte
結果 AC
実行時間 227 ms
メモリ 22392 KiB

ジャッジ結果

セット名 Sample All
得点 / 配点 0 / 0 400 / 400
結果
AC × 3
AC × 25
セット名 テストケース
Sample 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt
All 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt, 01_random_00.txt, 01_random_01.txt, 01_random_02.txt, 01_random_03.txt, 01_random_04.txt, 01_random_05.txt, 01_random_06.txt, 01_random_07.txt, 01_random_08.txt, 01_random_09.txt, 01_random_10.txt, 01_random_11.txt, 01_random_12.txt, 01_random_13.txt, 01_random_14.txt, 01_random_15.txt, 01_random_16.txt, 01_random_17.txt, 01_random_18.txt, 01_random_19.txt, 01_random_20.txt, 01_random_21.txt
ケース名 結果 実行時間 メモリ
00_sample_00.txt AC 1 ms 3524 KiB
00_sample_01.txt AC 1 ms 3576 KiB
00_sample_02.txt AC 1 ms 3408 KiB
01_random_00.txt AC 173 ms 22204 KiB
01_random_01.txt AC 178 ms 22296 KiB
01_random_02.txt AC 186 ms 22360 KiB
01_random_03.txt AC 171 ms 22392 KiB
01_random_04.txt AC 172 ms 22356 KiB
01_random_05.txt AC 171 ms 22220 KiB
01_random_06.txt AC 124 ms 15804 KiB
01_random_07.txt AC 205 ms 22392 KiB
01_random_08.txt AC 100 ms 14020 KiB
01_random_09.txt AC 207 ms 22220 KiB
01_random_10.txt AC 70 ms 11348 KiB
01_random_11.txt AC 205 ms 22300 KiB
01_random_12.txt AC 222 ms 22332 KiB
01_random_13.txt AC 221 ms 22392 KiB
01_random_14.txt AC 227 ms 22204 KiB
01_random_15.txt AC 225 ms 22328 KiB
01_random_16.txt AC 207 ms 22224 KiB
01_random_17.txt AC 202 ms 22204 KiB
01_random_18.txt AC 189 ms 22392 KiB
01_random_19.txt AC 189 ms 22300 KiB
01_random_20.txt AC 189 ms 22296 KiB
01_random_21.txt AC 187 ms 22328 KiB