| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 1301536 | stas-badzi | Stove (JOI18_stove) | C++20 | 60 ms | 5108 KiB |
#include <functional>
#include <iostream>
#include <queue>
#include <set>
#include <vector>
int main() {
int n,z;std::cin>>n>>z;
std::set<int> s;
for (int i=0;i<n;++i){int x;std::cin>>x;s.insert(x);}
std::priority_queue<int, std::vector<int>,std::greater<int>> pq;
while (s.size()>1) {
auto top = *s.begin();
s.erase(s.begin());
pq.push(*s.begin()-top-1);
}
int res=n;
while (z<pq.size()+1) {
res+=pq.top();
pq.pop();
}
std::cout << res;
}| # | 결과 | 실행 시간 | 메모리 | 채점기 출력 |
|---|---|---|---|---|
| 결과를 불러오는 중입니다… | ||||
| # | 결과 | 실행 시간 | 메모리 | 채점기 출력 |
|---|---|---|---|---|
| 결과를 불러오는 중입니다… | ||||
| # | 결과 | 실행 시간 | 메모리 | 채점기 출력 |
|---|---|---|---|---|
| 결과를 불러오는 중입니다… | ||||
