답안 #888263

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
888263 2023-12-16T17:48:21 Z Marco_Escandon Stove (JOI18_stove) C++11
100 / 100
19 ms 3292 KB
#include<bits/stdc++.h>
using namespace std;
#define optimizar_io ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);cout.setf(ios::fixed);cout.precision(0);
#pragma GCC optimize("Ofast")
typedef long long ll;
#define double long double 
int main()
{
    optimizar_io
    ll n,m;
    cin>>n>>m;
    ll cad[n];
    priority_queue<ll> q;
    for(int i=0; i<n; i++)
    {
        cin>>cad[i];
        if(i>0)
        {
            q.push(cad[i]-cad[i-1]-1);
        }
    }
    ll cont=cad[n-1]-cad[0]+1;
    for(int i=0; i<m-1; i++)
    {
        //cout<<cont;
        cont-=q.top();
        q.pop();
    }
    cout<<cont;
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 504 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 448 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 504 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 448 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Correct 1 ms 468 KB Output is correct
12 Correct 1 ms 348 KB Output is correct
13 Correct 1 ms 348 KB Output is correct
14 Correct 1 ms 348 KB Output is correct
15 Correct 1 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 504 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 448 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Correct 1 ms 468 KB Output is correct
12 Correct 1 ms 348 KB Output is correct
13 Correct 1 ms 348 KB Output is correct
14 Correct 1 ms 348 KB Output is correct
15 Correct 1 ms 348 KB Output is correct
16 Correct 10 ms 3292 KB Output is correct
17 Correct 13 ms 3192 KB Output is correct
18 Correct 10 ms 3292 KB Output is correct
19 Correct 11 ms 3292 KB Output is correct
20 Correct 16 ms 3032 KB Output is correct
21 Correct 18 ms 3292 KB Output is correct
22 Correct 19 ms 3288 KB Output is correct
23 Correct 19 ms 3036 KB Output is correct
24 Correct 19 ms 3036 KB Output is correct