update
This commit is contained in:
parent
7ceea85559
commit
9e28b0004c
32
src/11/c4/P1190.cpp
Normal file
32
src/11/c4/P1190.cpp
Normal file
@ -0,0 +1,32 @@
|
||||
#include <cstdint>
|
||||
#include <functional>
|
||||
#include <iostream>
|
||||
#include <queue>
|
||||
#include <vector>
|
||||
using namespace std;
|
||||
using ll = int64_t;
|
||||
|
||||
ll n,m;
|
||||
priority_queue<ll, vector<ll>,greater<>> list_pq;
|
||||
|
||||
int main(){
|
||||
ios::sync_with_stdio(false),cin.tie(nullptr),cout.tie(nullptr);
|
||||
cin>>n>>m;
|
||||
for(ll i{1};i<=m;i++){
|
||||
list_pq.emplace(0);
|
||||
}
|
||||
while(n--){
|
||||
ll tmp;
|
||||
cin>>tmp;
|
||||
ll front{list_pq.top()};
|
||||
list_pq.pop();
|
||||
front+=tmp;
|
||||
list_pq.emplace(front);
|
||||
}
|
||||
ll ans{};
|
||||
while(list_pq.size()){
|
||||
ans=list_pq.top();
|
||||
list_pq.pop();
|
||||
}
|
||||
cout<<ans<<'\n';
|
||||
}
|
Loading…
Reference in New Issue
Block a user