답안 #734063

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
734063 2023-05-01T15:31:19 Z LCJLY Stove (JOI18_stove) C++14
100 / 100
25 ms 2260 KB
#include <bits/stdc++.h>  //needa retype template incase bret reynold yeah bruh moment ill me
using namespace std;
 
#define int long long 
typedef pair<int,int>pii;
 
int32_t main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	int n,k;
	cin >> n >> k;
 
	int arr[n+5];
 
	for(int x=1;x<=n;x++){
		cin >> arr[x];
	}
 
	priority_queue<int>pq;
	for(int x=2;x<=n;x++){
		pq.push(arr[x]-arr[x-1]-1);
	}
 
	int counter=arr[n]-arr[1]+1;
 
    for(int bruh=0; bruh<k-1; ++bruh) {
        auto cur=pq.top();
        counter-=cur;
        pq.pop();
	}
	cout << counter;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 1 ms 340 KB Output is correct
11 Correct 1 ms 340 KB Output is correct
12 Correct 1 ms 340 KB Output is correct
13 Correct 1 ms 340 KB Output is correct
14 Correct 1 ms 340 KB Output is correct
15 Correct 1 ms 340 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 1 ms 340 KB Output is correct
11 Correct 1 ms 340 KB Output is correct
12 Correct 1 ms 340 KB Output is correct
13 Correct 1 ms 340 KB Output is correct
14 Correct 1 ms 340 KB Output is correct
15 Correct 1 ms 340 KB Output is correct
16 Correct 17 ms 2248 KB Output is correct
17 Correct 20 ms 2252 KB Output is correct
18 Correct 12 ms 2260 KB Output is correct
19 Correct 14 ms 2252 KB Output is correct
20 Correct 17 ms 2260 KB Output is correct
21 Correct 25 ms 2260 KB Output is correct
22 Correct 25 ms 2260 KB Output is correct
23 Correct 23 ms 2260 KB Output is correct
24 Correct 22 ms 2252 KB Output is correct