fork download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. int main() {
  5. int n, i, vmax,cmax=1;
  6. cin >> n;
  7. int arr[n];
  8. for(i=0; i<n; i++) cin >> arr[i];
  9. sort(arr, arr+n);
  10. i=n-2;
  11. vmax=arr[n-1];
  12. while(i>=0 && vmax==arr[i]){
  13. cmax++; i--;
  14. }
  15. cout << arr[0] <<' ' << cmax;
  16. return 0;
  17. }
Success #stdin #stdout 0.01s 5288KB
stdin
7
5 6 2 10 1 10 8
stdout
1 2