Advertisement
Guest User

Untitled

a guest
Nov 18th, 2019
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.80 KB | None | 0 0
  1. #include <iostream>
  2. #include <vector>
  3. #include <set>
  4. using namespace std;
  5.  
  6.  
  7. typedef set<int> SE;
  8. typedef SE::iterator SI;
  9.  
  10.  
  11. bool exists(int x, const vector<int>& V);
  12.  
  13.  
  14. int main() {
  15. int n;
  16. while (cin >> n) {
  17. vector<int> V(n);
  18. SE S;
  19. for (int i = 0; i < n; ++i) {
  20. cin >> V[i];
  21. S.insert(V[i]);
  22. }
  23. vector<int> A(S.begin(), S.end());
  24. int m = A.size();
  25.  
  26. cout << exists(1234, V) << endl;
  27. cout << exists(-1000000, V) << endl;
  28.  
  29. if (n < 100) {
  30. for (int i = 0; i < m; ++i) cout << exists(A[i], V) << endl;
  31. for (int i = 1; i < m; ++i)
  32. cout << exists((A[i] + A[i-1])/2, V) << endl;
  33. }
  34. else
  35. for (int rep = 1000; rep > 0; --rep)
  36. for (int i = 0; i < m; ++i)
  37. cout << exists(A[i], V) << endl;
  38. }
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement