답안 #92925

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
92925 2019-01-05T20:16:29 Z brcode Stove (JOI18_stove) C++14
100 / 100
55 ms 2336 KB
#include <iostream>
#include <queue>
using namespace std;
const int MAXN = 100101;
priority_queue<int> q1;
int timer[MAXN];


int main() {
	int n,k;
	cin>>n>>k;
	for(int i=1;i<=n;i++){
	    cin>>timer[i];
	    if(i>1){
	        q1.push(-1*(timer[i]-timer[i-1]-1));
	    }
	}
	int x = n;
	while(!q1.empty() && q1.size()>=k){
	   
	    x+=(-1*q1.top());
	    
	    q1.pop();
	}
	cout<<x<<endl;
}

Compilation message

stove.cpp: In function 'int main()':
stove.cpp:19:32: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  while(!q1.empty() && q1.size()>=k){
                       ~~~~~~~~~^~~
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 348 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Correct 2 ms 376 KB Output is correct
7 Correct 2 ms 376 KB Output is correct
8 Correct 2 ms 256 KB Output is correct
9 Correct 2 ms 376 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 348 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Correct 2 ms 376 KB Output is correct
7 Correct 2 ms 376 KB Output is correct
8 Correct 2 ms 256 KB Output is correct
9 Correct 2 ms 376 KB Output is correct
10 Correct 3 ms 380 KB Output is correct
11 Correct 3 ms 380 KB Output is correct
12 Correct 3 ms 376 KB Output is correct
13 Correct 3 ms 376 KB Output is correct
14 Correct 3 ms 376 KB Output is correct
15 Correct 4 ms 376 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 348 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Correct 2 ms 376 KB Output is correct
7 Correct 2 ms 376 KB Output is correct
8 Correct 2 ms 256 KB Output is correct
9 Correct 2 ms 376 KB Output is correct
10 Correct 3 ms 380 KB Output is correct
11 Correct 3 ms 380 KB Output is correct
12 Correct 3 ms 376 KB Output is correct
13 Correct 3 ms 376 KB Output is correct
14 Correct 3 ms 376 KB Output is correct
15 Correct 4 ms 376 KB Output is correct
16 Correct 54 ms 2164 KB Output is correct
17 Correct 55 ms 2288 KB Output is correct
18 Correct 54 ms 2260 KB Output is correct
19 Correct 55 ms 2308 KB Output is correct
20 Correct 50 ms 2336 KB Output is correct
21 Correct 46 ms 2164 KB Output is correct
22 Correct 45 ms 2176 KB Output is correct
23 Correct 45 ms 2228 KB Output is correct
24 Correct 44 ms 2164 KB Output is correct