fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. const int MAX_SIZE = 10;
  5.  
  6. int main() {
  7. int n, v[MAX_SIZE + 1], w[MAX_SIZE + 1];
  8. cin >> n;
  9. for (int i = 1; i <= n; ++i) {
  10. cin >> v[i];
  11. }
  12. for (int i = 1; i <= n; ++i) {
  13. cin >> w[i];
  14. }
  15. int count = 0;
  16. for (int i = 1; i <= n; ++i) {
  17. for (int j = 1; j <= n; ++j) {
  18. if (v[i] == w[j] && i == j) {
  19. count = 1;
  20. i = n + 1;
  21. j = n + 1;
  22. }
  23. }
  24. }
  25. if (count == 0) {
  26. cout << "DA";
  27. } else {
  28. cout << "NU";
  29. }
  30. return 0;
  31. }
Success #stdin #stdout 0.01s 5280KB
stdin
2 
1 0 
0 1 -> DA

stdout
DA