Submission #79502
ソースコード
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | #include<iostream> #include<queue> using namespace std; int main(){ long long m,q,value; cin >>m>>q; priority_queue< long long ,vector< long long >,greater< long long >>pq; for ( int i = 0;i < q;i++){ int x,a; cin >>x; if (x == 1){ cin >>a; pq.push(a); value += a; if (pq.size() > m){ value -= pq.top(); pq.pop(); } } else { cout <<value<< "\n" ; } } } |
ステータス
項目 | データ |
---|---|
問題 | 1796 - 宝集め |
ユーザー名 | ei2332 |
投稿日時 | 2024-07-07 21:55:31 |
言語 | C++17 |
状態 | Accepted |
得点 | 100 |
ソースコード長 | 401 Byte |
最大実行時間 | 29 ms |
最大メモリ使用量 | 600 KB |
セット
セット | 得点 | Cases | |
---|---|---|---|
1 | ALL | 100 / 100 | * |
テストケース
ファイル名 | 状態 | 実行時間 | メモリ使用量 | # |
---|---|---|---|---|
in1.txt | AC | 29 ms | 600 KB |
1
|