daily pastebin goal
57%
SHARE
TWEET

Untitled

a guest Dec 4th, 2018 949 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <iostream>
  2. #include <set>
  3. using namespace std;
  4. int main()
  5. {
  6.     int n,m;
  7.     scanf("%d%d",&n,&m);
  8.     set<int> s;
  9.     s.insert(0);
  10.     while (n--)
  11.     {
  12.         int a;
  13.         scanf("%d",&a);
  14.         s.insert(a);
  15.     }
  16.     auto it=s.begin();
  17.     for (int i=0;i<m;i++)
  18.     {
  19.         if (next(it)==s.end())
  20.         printf("0\n");
  21.         else
  22.         {
  23.             printf("%d\n",*next(it)-*it);
  24.             it=next(it);
  25.         }
  26.     }
  27. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top