pastebin

Paste Search Dynamic
Recent pastes
test case
  1. #include <bits/stdc++.h>
  2.  
  3. using namespace std;
  4.  
  5. #define Morshedy_22 ios_base::sync_with_stdio(false);cin.tie(nullptr);
  6. #define F first
  7. #define S second
  8. #define pb push_back
  9. #define all(v) v.begin(),v.end()
  10. #define FILL(a, b) memset(a, b, sizeof(a))
  11. #define el 'n'
  12.  
  13. typedef long long ll;
  14. typedef pair<int, int> pii;
  15. typedef pair<pii, int> piii;
  16. typedef vector<int> vi;
  17. typedef vector<vi> vvi;
  18. typedef vector<pii> vii;
  19.  
  20. const int inf = 0x3f3f3f3f;
  21. const ll infLL = 0x3f3f3f3f3f3f3f3fLL;
  22. const int N = 1e5+5;
  23. const int mod = 1e9+7;
  24. const int d4x[4]={-1, 0, 1, 0}, d4y[4]={0, 1, 0, -1};
  25. const int d8x[8]={-1, -1, 0, 1, 1, 1, 0, -1}, d8y[8]={0, 1, 1, 1, 0, -1, -1, -1};
  26.  
  27. /*
  28. ---> وتظل تسعى جاهدا في همةٍ   ..  والله يعطي من يشاءُ إذا شكر <---
  29. */
  30.  
  31.  
  32. void testCase()
  33. {
  34.     int n, x;
  35.     cin >> n;
  36.  
  37.     map<int, int> freq;
  38.     int mn = inf, mx = -1;
  39.     for(int i=0; i<n; i++)
  40.     {
  41.         cin >> x;
  42.         freq[x]++;
  43.         mn = min(mn,x);
  44.         mx = max(mx,x);
  45.     }
  46.     cout << mx-mn << " ";
  47.     cout << (ll)freq[mn] * freq[mx] << el;
  48. }
  49.  
  50.  
  51. int main()
  52. {
  53.     Morshedy_22
  54.  
  55.     int tc = 1;
  56.     // cin >> tc;
  57.     while(tc--)
  58.         testCase();
  59.  
  60.  
  61.     return 0;
  62. }
Parsed in 0.019 seconds