提出 #75859567


ソースコード 拡げる

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int x,q,a,b;
priority_queue<int> mn;
priority_queue<int,vector<int>,greater<>> mx;
ll ans=0;
void inst(int k) {
 if(k>mx.top()) mx.push(k); else mn.push(k);
 if(mx.size()>mn.size()+1) {mn.push(mx.top()); mx.pop();} 
 if(mn.size()>mx.size()) {mx.push(mn.top()); mn.pop();}
}
int main() {
 ios::sync_with_stdio(false);
 cin.tie(0);
 cin >> x >> q;
 mx.push(x);
 for(;q--;) {
  cin >> a >> b;
  inst(a); inst(b);
  cout << mx.top() << "\n";
 }
}

提出情報

提出日時
問題 D - Chalkboard Median
ユーザ Hakuaa_2
言語 C++23 (GCC 15.2.0)
得点 400
コード長 532 Byte
結果 AC
実行時間 46 ms
メモリ 5292 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 3520 KiB
00_sample_01.txt AC 1 ms 3520 KiB
00_sample_02.txt AC 1 ms 3560 KiB
01_random_00.txt AC 32 ms 5092 KiB
01_random_01.txt AC 23 ms 5264 KiB
01_random_02.txt AC 36 ms 5268 KiB
01_random_03.txt AC 34 ms 5036 KiB
01_random_04.txt AC 34 ms 5044 KiB
01_random_05.txt AC 31 ms 5056 KiB
01_random_06.txt AC 28 ms 5208 KiB
01_random_07.txt AC 41 ms 5104 KiB
01_random_08.txt AC 24 ms 4368 KiB
01_random_09.txt AC 43 ms 5048 KiB
01_random_10.txt AC 18 ms 4384 KiB
01_random_11.txt AC 42 ms 4960 KiB
01_random_12.txt AC 41 ms 5056 KiB
01_random_13.txt AC 40 ms 5144 KiB
01_random_14.txt AC 46 ms 5196 KiB
01_random_15.txt AC 46 ms 5268 KiB
01_random_16.txt AC 40 ms 5048 KiB
01_random_17.txt AC 40 ms 5152 KiB
01_random_18.txt AC 42 ms 5176 KiB
01_random_19.txt AC 42 ms 5148 KiB
01_random_20.txt AC 42 ms 5292 KiB
01_random_21.txt AC 42 ms 4960 KiB