fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5. int n, v[11], w[11];
  6. cin >> n;
  7. for (int i = 1; i <= n; ++i) {
  8. cin >> v[i];
  9. }
  10. for (int i = 1; i <= n; ++i) {
  11. cin >> w[i];
  12. }
  13. int sort = 1;
  14. while (sort == 1) {
  15. sort = 0;
  16. for (int i = 1; i < n; ++i) {
  17. if (w[i] < w[i + 1]) {
  18. int aux = w[i];
  19. w[i] = w[i + 1];
  20. w[i + 1] = aux;
  21. sort = 1;
  22. }
  23. }
  24. }
  25. int cont = 0;
  26. for (int i = 1; i <= n; ++i) {
  27. for (int j = 1; j <= n; ++j) {
  28. if (v[i] == w[j] && v[i] > v[i + 1]) {
  29. ++cont;
  30. break;
  31. }
  32. }
  33. }
  34. if (cont != n) {
  35. cout << "NU";
  36. } else {
  37. cout << "DA";
  38. }
  39. return 0;
  40. }
Success #stdin #stdout 0s 5284KB
stdin
7
7 5 6 4 3 2 1
5 4 2 3 7 1 6 
stdout
NU