fork download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. #define ll long long
  5. #define ull unsigned long long
  6. #define ld long double
  7.  
  8. void Free_palestine() {
  9. ios::sync_with_stdio(false);
  10. cin.tie(NULL);
  11. cout.tie(NULL);
  12. }
  13.  
  14. const int N = 2e5 + 5;
  15. const int MOD = 1e9 + 7;
  16. const int MAXN = 1005;
  17. int a[MAXN];
  18.  
  19. signed main(){
  20. Free_palestine();
  21. int n;
  22. cin>>n;
  23.  
  24. for (int i = 1; i <= n; i++) {
  25. cin >> a[i];
  26. }
  27.  
  28. int val = a[1];
  29. int pos = 1;
  30.  
  31. for (int i = 2; i <= n; i++) {
  32. if (a[i] < val) {
  33. val = a[i];
  34. pos = i;
  35. }
  36. }
  37.  
  38. cout <<val << " " <<pos << "\n";
  39.  
  40. return 0;
  41. }
Success #stdin #stdout 0.01s 5316KB
stdin
5
5 6 2 3 2
stdout
2 3