fork download
  1. /*=================================*\
  2. | |
  3. | Md. Shahidul Islam |
  4. | CSE, BRUR |
  5. | Rangpur, Bangladesh |
  6. | mail: shahidul.cse.brur@gmail.com |
  7. | FB : fb.com/shahidul.brur |
  8. | Blog: shahidul-brur.blogspot.com |
  9. \*=================================*/
  10. #include<bits/stdc++.h>
  11. using namespace std;
  12.  
  13. #define vi vector<int>
  14. #define pii pair<int, int>
  15. #define vii vector<pair<int, int> >
  16. #define vs vector<string>
  17.  
  18. #define pb push_back
  19. #define mp make_pair
  20. #define ff first
  21. #define ss second
  22. #define sz size()
  23. #define all(a) a.begin(), a.end()
  24. #define F(i, a, b) for(int i=a;i<=b;i++)
  25. #define rep(i, k) for(int i=0;i<k;i++)
  26. #define rep1(i, k) for(int i=1;i<=k;i++)
  27. #define FORR(i, b, a) for(int i=b;i>=a;i--)
  28. #define FOR(i, a, b) for(int i=a;i<=b;i++)
  29. #define pi acos(-1.0)
  30. #define eps 1e-6
  31. #define mem(a, b) memset(a, b, sizeof(a))
  32. #define ll long long
  33. #define ull unsinged long long
  34. #define mod 1000000007
  35. #define N 1000005
  36. #define inf 1e9
  37.  
  38. int main()
  39. {
  40. //freopen("in.txt", "r", stdin);
  41. //freopen("out.txt", "w", stdout);
  42. //ios_base::sync_with_stdio(false); cin.tie(NULL);
  43. int m=0, mini, n, a[105], pos;
  44. cin>>n;
  45. rep(i, n)
  46. {
  47. cin>>a[i];
  48.  
  49. }
  50. sort(a, a+n);
  51. mini = a[0];
  52. rep(i, n)
  53. if(a[i]==mini)
  54. m++;
  55. else break;
  56. if(m>1)
  57. cout << a[0] << " " << n << "\n";
  58. else
  59. {
  60. if(n==1)
  61. cout << a[0]*2 << " " << " 1" << "\n";
  62. else
  63. cout << min(a[0]*2, a[m]) << " 1\n";
  64. }
  65. return 0;
  66. }
  67.  
  68.  
Success #stdin #stdout 0s 3472KB
stdin
1
10
stdout
20  1