Submission #00040


ソースコード

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#include<bits/stdc++.h>
#define mset multiset
#define unset unordered_set
#define ll long long
#define endl "\n";
#define prg_queue priority_queue <int,vector<int>,greater<int>
#define pr_queue priority_queue <int>
#define upper upper_bound
#define lower lower_bound
using namespace std;
int main(){
ll a=0,b=0,c=0,d=0,e=0,f;
mset <ll> q;
cin >>a>>b;
for (int o=0; o<b; o++){
cin >>c;
if(c==1){
cin >>d;
q.insert(d);
e+=d;
if(q.size()>a){
e-=*q.begin();
q.erase(q.begin());
}
}
if(c==2){
cout <<e<<endl
}
}
return 0;
}

ステータス

項目 データ
問題 0006 - 宝集め
ユーザー名 SnakyZoo8277089
投稿日時 2024-07-18 13:53:22
言語 C++17
状態 Accepted
得点 10
ソースコード長 716 Byte
最大実行時間 206 ms
最大メモリ使用量 9088 KB

セット

セット 得点 Cases
1 ALL 10 / 10 *

テストケース

ファイル名 状態 実行時間 メモリ使用量 #
in1.txt AC 25 ms 468 KB
1
in2.txt AC 206 ms 8608 KB
1
in3.txt AC 181 ms 9088 KB
1
in4.txt AC 144 ms 1628 KB
1
in5.txt AC 119 ms 1600 KB
1
in6.txt AC 113 ms 1700 KB
1
in7.txt AC 109 ms 1800 KB
1
in8.txt AC 57 ms 1896 KB
1
in9.txt AC 55 ms 1992 KB
1
in10.txt AC 22 ms 440 KB
1