답안 #48826

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
48826 2018-05-19T08:10:29 Z faishol27 Stove (JOI18_stove) C++14
0 / 100
3 ms 876 KB
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
#define PUB push_back

int N, K;
ll data[100005], ans = 0;
vector<ll>selisih;

int main(){
    cin >> N >> K;
    for(int i=0;i<N;i++) cin >> data[i];
    
    for(int i=0;i<N-1;i++){
        selisih.PUB(data[i+1]-(data[i]+1));
        ans += selisih[i];
    }
    
    ans += N;

    sort(selisih.begin(), selisih.end());

    for(int i=1;i<=K;i++){
        ans -= selisih[N-i];
    }

    cout << ans << endl;
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 248 KB Output is correct
2 Correct 2 ms 360 KB Output is correct
3 Correct 2 ms 544 KB Output is correct
4 Correct 2 ms 544 KB Output is correct
5 Correct 3 ms 580 KB Output is correct
6 Correct 2 ms 632 KB Output is correct
7 Correct 2 ms 696 KB Output is correct
8 Correct 2 ms 704 KB Output is correct
9 Runtime error 2 ms 876 KB Execution killed with signal 11 (could be triggered by violating memory limits)
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 248 KB Output is correct
2 Correct 2 ms 360 KB Output is correct
3 Correct 2 ms 544 KB Output is correct
4 Correct 2 ms 544 KB Output is correct
5 Correct 3 ms 580 KB Output is correct
6 Correct 2 ms 632 KB Output is correct
7 Correct 2 ms 696 KB Output is correct
8 Correct 2 ms 704 KB Output is correct
9 Runtime error 2 ms 876 KB Execution killed with signal 11 (could be triggered by violating memory limits)
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 248 KB Output is correct
2 Correct 2 ms 360 KB Output is correct
3 Correct 2 ms 544 KB Output is correct
4 Correct 2 ms 544 KB Output is correct
5 Correct 3 ms 580 KB Output is correct
6 Correct 2 ms 632 KB Output is correct
7 Correct 2 ms 696 KB Output is correct
8 Correct 2 ms 704 KB Output is correct
9 Runtime error 2 ms 876 KB Execution killed with signal 11 (could be triggered by violating memory limits)