Submission #1002209

#TimeUsernameProblemLanguageResultExecution timeMemory
1002209zh_hStove (JOI18_stove)C++17
0 / 100
0 ms344 KiB
#include <bits/stdc++.h> #define lint long long #define pb push_back #define mp make_pair using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int n, k; cin >> n >> k; vector<int> v; for(int i = 0; i < n; i ++){ int temp; cin >> temp; v.pb(temp); } vector<int> vb; for(int i = 1; i < n; i ++){ vb.pb(v[i]-v[i-1]-1); } sort(vb.begin(), vb.end()); for(auto i : vb){cout << i << " ";} cout << endl; int time = n; if(k >= n){cout << n;} else{ for(int i = 0; i < n-k; i ++){ time+=vb[i]; } cout << time; } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...