Submission #1087687

# Submission time Handle Problem Language Result Execution time Memory
1087687 2024-09-13T05:52:39 Z ahmetlbktd4 Stove (JOI18_stove) C++17
0 / 100
0 ms 348 KB
#include <bits/stdc++.h>
using namespace std;

int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	int n,k;
	cin >> n >> k;
	int a[n];
	for (int i = 0;i < n;i++){
		cin >> a[i];
	} 
	vector <int> b;
	for (int i = 0;i+1 < n;i++){
		b.push_back(a[i+1]-a[i]);
	}
	int p = 0; 
	sort(b.begin(),b.end());
	for (int i = 0;i < n-k;i++){
		p += b[i];
	}
	for (int i = 0;i+1 < n;i++){
		cout << b[i] << " ";
	}
	cout << "\n" <<  p+k << "\n";
}
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -