제출 #1124814

#제출 시각아이디문제언어결과실행 시간메모리
1124814dwfekjhwfdwfhkStove (JOI18_stove)C++20
0 / 100
0 ms320 KiB
#include <bits/stdc++.h> using namespace std; #define ll long long #define ull unsigned long long #define pll pair<ll,ll> #define pqll priority_queue<ll> #define pqpll priority_queue<pll> #define pqllg priority_queue<ll, vector<ll>, greater<ll>> #define pqpllg priority_queue<pll, vector<pll>, greater<pll>> #define inf LLONG_MAX #define vll vector<ll> #define vqll vector<queue<ll>> #define qll queue<ll> #define sll set<ll> int main(){ ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0); ll n,k;cin>>n>>k; pqll pq; ll s[n]; for(ll i=0;i<n;i++){ ll a;cin>>a; s[i]=a; } for(ll i=0;i<n-1;i++){ pq.push(s[i+1]-s[i]-1); } ll cnt=s[n-1]-s[0]+2; for(ll i=0;i<k;i++){ cnt-=pq.top(); pq.pop(); } cout<<cnt; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...