Emiliatan

c299

Feb 24th, 2019
296
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.52 KB | None | 0 0
  1. /* c299            */
  2. /* AC (2ms, 116KB) */
  3. #include <cstdio>
  4. #include <algorithm>
  5.  
  6. #define max(x,y) ((x)>(y)?(x):(y))
  7. #define min(x,y) ((x)<(y)?(x):(y))
  8.  
  9. using namespace std;
  10.  
  11. int n, tmp, min0, max0, in;
  12.  
  13. int main()
  14. {
  15.     while(~scanf("%d", &n))
  16.     {
  17.         tmp = n, min0 = 999999, max0 = -1;
  18.         while(tmp-- && scanf("%d", &in))
  19.         {
  20.             max0 = max(max0, in);
  21.             min0 = min(min0, in);
  22.         }
  23.         printf("%d %d ", min0, max0);
  24.         if(max0 - min0 == n - 1) puts("yes");
  25.         else puts("no");
  26.         putchar('\n');
  27.     }
  28.     return 0;
  29. }
Advertisement
Add Comment
Please, Sign In to add comment