fork download
  1. #include <bits/stdc++.h>
  2. #include <queue>
  3. #include <cmath>
  4. #include <math.h>
  5. #include <iostream>
  6. #include <map>
  7. #include <limits>
  8. #include <set>
  9. #include <vector>
  10. using namespace std;
  11. #define mAX 10000007;
  12. vector<int>a;
  13. vector<int> b;
  14.  
  15.  
  16.  
  17. int main()
  18. {
  19. //freopen("nhap.inp","r",stdin);
  20. //freopen("ra.out","w",stdout);
  21. int i =0 ,j=0;
  22. while(1){
  23. int x;
  24. cin >> x;
  25. if(x==-1){
  26. break;
  27. }
  28. else{
  29. a.push_back(x);
  30. ++i;
  31. }
  32. }
  33. while(true){
  34. int x;
  35. cin >> x;
  36. if(x==-1){
  37. break;
  38. }
  39. else{
  40. b.push_back(x);
  41. j++;
  42. }
  43. }
  44. if(i != j){
  45. cout <<"NO"<< endl;
  46. return 0;
  47. }
  48. for(int k=0;k < i;k++){
  49. if(a[k] != b[k]){
  50. cout << "NO" << endl;
  51. return 0;
  52. }
  53. }
  54. cout << "YES";
  55. return 0;
  56. }
  57.  
  58.  
Success #stdin #stdout 0.01s 5292KB
stdin
8
10
8
11
9
11
9
9
10
10
9
10
7
9
9
9
8
9
8
8
7
9
8
10
8
7
8
8
7
8
9
9
7
9
8
9
10
9
8
7
9
8
9
8
9
10
8
9
8
8
8
10
10
11
10
9
9
10
9
9
9
7
8
8
7
8
10
8
11
9
9
9
9
10
8
9
10
9
9
9
9
9
9
9
9
10
8
9
10
8
8
9
8
8
-1
8
10
8
11
9
11
9
9
10
10
9
10
7
9
9
9
8
9
8
8
7
9
8
10
8
7
8
8
7
8
9
9
7
9
8
9
10
9
8
7
9
8
9
8
9
10
8
9
8
8
8
10
10
11
10
9
9
10
9
9
9
7
8
8
7
8
10
8
11
9
9
9
9
10
8
9
10
9
9
9
9
9
9
9
9
10
8
9
10
8
8
9
8
8
-1
stdout
YES