You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
26 lines
570 B
C++
26 lines
570 B
C++
#define _CRT_SECURE_NO_WARNINGS
|
|
#define _SILENCE_CXX17_C_HEADER_DEPRECATION_WARNING
|
|
#include <bits/stdc++.h>
|
|
using namespace std;
|
|
int main()
|
|
{
|
|
int n, k;
|
|
scanf("%d%d", &n, &k);
|
|
set<int> S;
|
|
for (int i = 0, x; i < n; i++)
|
|
scanf("%d", &x), S.insert(x);
|
|
int cur = 0;
|
|
for (int i = 0; i < k; i++)
|
|
{
|
|
auto ite = S.upper_bound(cur);
|
|
if (ite != S.end())
|
|
{
|
|
printf("%d\n", *ite - cur);
|
|
cur = *ite;
|
|
}
|
|
else
|
|
printf("%d\n", 0);
|
|
}
|
|
return 0;
|
|
}
|