Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <fstream>
- #include <set>
- #include <algorithm>
- #include <map>
- using namespace std;
- const int MAXN = 1e4;
- int a[MAXN];
- int main()
- {
- ifstream cin("smd.in");
- ofstream cout("smd.out");
- ios::sync_with_stdio(0);
- srand(0);
- int n;
- cin >> n;
- for (int i = 0; i<n; i++)
- cin >> a[i];
- random_shuffle(a, a+n);
- for (int i = 0; i<min(n,7000); i++)
- {
- long long pr = 1;
- for (int j = 0; j<n; j++)
- {
- if (j==i)
- continue;
- pr = pr*a[j]%a[i];
- if (!pr)
- {
- cout << "Yes" << endl;
- cout << n-1 <<endl;
- for (int k = 0; k<n; k++)
- if (k!=i)
- cout << a[k] << " ";
- cout << endl << a[i];
- return 0;
- }
- }
- }
- cout <<"No" << endl;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement