Advertisement
Guest User

Untitled

a guest
Oct 20th, 2017
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.93 KB | None | 0 0
  1. #include <iostream>
  2. #include <fstream>
  3. #include <set>
  4. #include <algorithm>
  5. #include <map>
  6. using namespace std;
  7.  
  8. const int MAXN = 1e4;
  9. int a[MAXN];
  10.  
  11.  
  12. int main()
  13. {
  14. ifstream cin("smd.in");
  15. ofstream cout("smd.out");
  16. ios::sync_with_stdio(0);
  17. srand(0);
  18. int n;
  19. cin >> n;
  20. for (int i = 0; i<n; i++)
  21. cin >> a[i];
  22. random_shuffle(a, a+n);
  23. for (int i = 0; i<min(n,7000); i++)
  24. {
  25. long long pr = 1;
  26. for (int j = 0; j<n; j++)
  27. {
  28. if (j==i)
  29. continue;
  30. pr = pr*a[j]%a[i];
  31. if (!pr)
  32. {
  33. cout << "Yes" << endl;
  34. cout << n-1 <<endl;
  35. for (int k = 0; k<n; k++)
  36. if (k!=i)
  37. cout << a[k] << " ";
  38. cout << endl << a[i];
  39. return 0;
  40. }
  41. }
  42. }
  43. cout <<"No" << endl;
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement