Advertisement
Zuneve

w

Nov 18th, 2022
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.41 KB | None | 0 0
  1. #include <iostream>
  2. #include <vector>
  3. using namespace std;
  4.  
  5. int main() {
  6. int n, cnt=0;
  7. cin >> n;
  8. vector <int> a(n);
  9. for (int i = 0; i<n; i++) {
  10. cin >> a[i];
  11. }
  12. for (int i = 1; i<n; i++) {
  13. if (a[i-1]<0 and a[i]<0 or a[i-1]>=0 and a[i]>=0) {
  14. cout << "YES";
  15. cnt++;
  16. break;
  17. }
  18. } if (cnt==0) {
  19. cout << "NO";
  20. }
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement