Advertisement
Guest User

Untitled

a guest
May 25th, 2019
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.86 KB | None | 0 0
  1. #include <iostream>
  2. #include <unordered_map>
  3.  
  4. using namespace std;
  5.  
  6. const int MAXN = 15;
  7. const int MX_VAL = 1e2;
  8.  
  9. int main() {
  10. freopen("input.txt", "w", stdout);
  11. freopen("output.txt", "r", stdin);
  12. int n = rand() % MAXN + 1;
  13. int m = rand() % MAXN + 1, ans = 0;
  14. int a[n];
  15. int b[m];
  16. unordered_map<int, bool> used;
  17. cout << n << "\n";
  18. for (int i = 0; i < n; ++i) {
  19. a[i] = (rand() % MX_VAL) * (rand() % 2 == 0 ? 1 : -1);
  20. used[a[i]] = 1;
  21. cout << a[i] << " ";
  22. }
  23. cout << "\n" << m << "\n";
  24. for (int i = 0; i < m; ++i) {
  25. b[i] = (rand() % MX_VAL) * (rand() % 2 == 0 ? 1 : -1);
  26. ans = ans + (used[b[i]]);
  27. cout << b[i] << " ";
  28. }
  29. int ans_solve;
  30. cin >> ans_solve;
  31. if (ans != ans_solve) {
  32. cout << "WA";
  33. return 0;
  34. }
  35. return 0;
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement