제출 #1300803

#제출 시각아이디문제언어결과실행 시간메모리
1300803pashtetkasStove (JOI18_stove)C++20
100 / 100
14 ms1016 KiB
// Header Files and namespaces #include <bits/stdc++.h> using namespace std; // Code shorteners typedef long long ll; #define print(x) cout << x << '\n' #define endl '\n' #define fast ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0); // Code int main() { fast; int n, k; cin >> n >> k; int wyn = n; vector<int>dist = {}; int prev; cin >> prev; for(int i = 2; i<=n; i++){ int ti; cin >> ti; dist.push_back(ti - prev - 1); prev = ti; } sort(dist.begin(),dist.end()); for(int i = 0; i<n-k; i++)wyn+=dist[i]; cout << wyn << '\n'; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...