#include #include #include #include #include #include #include #include #include #include #include #include #include //#define pb push_back //#define puts(x) cout << #x << " : " << x << endl; //#pragma GCC diagnostic ignored "-Wconversion" //#define REP(i,n) for (int i=0;i<(n);i++) //#define REPE(i,n) for (int i=0;i<=(n);i++) //#define init(a,b) memset((a), (b), (sizeof(a))); //#define PI 3.14159265 //#define EPS (1e-10) //#define EQ(a,b) (abs((a)-(b)) < EPS) using namespace std; typedef long long ll; //#define int long long int dxy[] = {0, 1, 0, -1, 0}; typedef pair P; ll gcd(ll a, ll b) { if (b == 0) return a; return gcd(b, a % b); } ll lcm(ll a , ll b) { return a / (gcd(a, b)) * b; } int a[10005]; vector divs[10005]; // i, a,b,c,d,... set > s[10005]; // div, a[i], i signed main() { int n; cin>>n; for(int i=0;i>a[i]; for(int k=0;kfirst; int index = s[div].begin()->second; // cout< lcm_res || (min_t == lcm_res && a_index < a[next_id])){ min_t = lcm_res; next_id = index; } } // printf("next_id = %d\n", next_id); id = next_id; } cout<