MiinaMagdy

11942 - Lumberjack Sequencing

Sep 1st, 2022
908
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.59 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2.  
  3. using namespace std;
  4.  
  5. #define ll long long
  6. #define endl '\n'
  7. #define sz(x) int(x.size())
  8. #define all(x) x.begin(), x.end()
  9.  
  10. int main() {
  11.     ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  12.     int test;
  13.     cin >> test;
  14.     cout << "Lumberjacks:\n";
  15.     while (test--) {
  16.         vector<int> a(10);
  17.         bool ascend = 1;
  18.         bool descend = 1;
  19.         for (int i = 0; i < 10; i++) {
  20.             cin >> a[i];
  21.             if (i > 0) {
  22.                 ascend &= (a[i] > a[i - 1]);
  23.                 descend &= (a[i] < a[i - 1]);
  24.             }
  25.         }
  26.         cout << (ascend || descend ? "Ordered" : "Unordered") << endl;
  27.     }
  28.     return 0;
  29. }
  30.  
Tags: UVA
Advertisement
Add Comment
Please, Sign In to add comment