fork download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. int main() {
  5. int N;
  6. cin >> N;
  7. vector<int> nums(N);
  8. for(int i = 0; i < N; i++) {
  9. cin >> nums[i];
  10. }
  11. int min_val = *min_element(nums.begin(), nums.end());
  12. int max_val = *max_element(nums.begin(), nums.end());
  13. int max_count = count(nums.begin(), nums.end(), max_val);
  14. cout << min_val << " " << max_count << endl;
  15. return 0;
  16. }
  17.  
Success #stdin #stdout 0s 5284KB
stdin
7
5 6 2 10 1 10 8
stdout
1 2