fork download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. int main() {
  5. int n; cin>>n;
  6. int a[n+1];
  7. for(int i = 1; i<=n; i++){
  8. cin>> a[i];
  9. }
  10. int b[n+1];
  11. for(int i = 1; i<=n; i++){
  12. cin>> b[i];
  13. }
  14.  
  15. sort(a+1, a+n+1);
  16. sort(b+1, b+n+1);
  17.  
  18. for(int i=1; i<=n; i++){
  19. if(a[i] = b[i]){
  20. cout<< "yes" << endl;
  21. return 0;
  22. }
  23. }
  24.  
  25. cout << "no" << endl;
  26. return 0;
  27.  
  28. }
Success #stdin #stdout 0s 5300KB
stdin
4
4 2 3 7
2 3 4 9
stdout
yes