fork download
  1. // In the name of God
  2. #include <iostream>
  3. #include <cmath>
  4. #include <cstdio>
  5. #include <cstring>
  6. #include <algorithm>
  7. #include <iomanip>
  8. #include <ctime>
  9. #include <queue>
  10. #include <set>
  11. #include <map>
  12. #include <vector>
  13. #include <list>
  14. #include <assert.h>
  15. #include <bitset>
  16. #include <unordered_set>
  17. #define sqr(a) ((a)*(a))
  18. #define all(a) (a).begin(), (a).end()
  19. using namespace std;
  20.  
  21. template <typename T>
  22. T next_int() {
  23. T x = 0, p = 1;
  24. char ch;
  25. do { ch = getchar(); } while(ch <= ' ');
  26. if(ch == '-') {
  27. p = -1;
  28. ch = getchar();
  29. }
  30. while(ch >= '0' && ch <= '9') {
  31. x = x * 10 + (ch - '0');
  32. ch = getchar();
  33. }
  34. return p * x;
  35. }
  36.  
  37. string next_token() {
  38. char ch;
  39. string ans = "";
  40. do { ch = getchar(); } while(ch <= ' ');
  41. while(ch > ' ') {
  42. ans += ch;
  43. ch = getchar();
  44. }
  45. return ans;
  46. }
  47.  
  48. const long long INF = (long long)1e18 + 227 + 1;
  49. const int INFINT = 1e9 + 227 + 1;
  50. const int MAXN = (int)1e6 + 227 + 1;
  51. const int MOD = (int)1e9 + 7;
  52. const long double EPS = 1e-9;
  53.  
  54. long long bin_pow(long long a, long long b) {
  55. if(!b) return 1;
  56. long long ans = bin_pow(a, b / 2);
  57. ans = ans * ans % MOD;
  58. if(b % 2) ans = ans * a % MOD;
  59. return ans;
  60. }
  61.  
  62. long long a[MAXN];
  63.  
  64. int main() {
  65. // freopen(".in", "r", stdin);
  66. // freopen("input.txt", "r", stdin);
  67. // freopen("output.txt", "w", stdout);
  68.  
  69. int n; cin >> n;
  70. for(int i = 0; i < n; i++)
  71. cin >> a[i];
  72.  
  73. sort(a, a + n);
  74. n = min(n, 1000);
  75.  
  76. long long ans = INF;
  77. for(int i = 0; i < n; i++)
  78. for(int j = i + 1; j < n; j++)
  79. ans = min(ans, a[i] * a[j] / __gcd(a[i], a[j]));
  80.  
  81. cout << ans << "\n";
  82. }
  83.  
  84.  
Runtime error #stdin #stdout 1.4s 11288KB
stdin
Standard input is empty
stdout
Standard output is empty