Official

A - Compromise Editorial by en_translator


For beginners

Inspect the element one by one, and check if there is \(i\) with \(X_i \geq 0\). Alternatively, the answer is No if and only if \(\max X_i \geq 0\), so one may use this property.

Sample code

#include <bits/stdc++.h>
using namespace std;

int main() {
	int n;
	cin >> n;
	string ans = "Yes";
	for (int i = 0; i < n; i++) {
		int x;
		cin >> x;
		if (x >= 0) ans = "No";
	}
	cout << ans << '\n';
}
N = int(input())
X = list(map(int, input().split()))
print("No" if max(X) >= 0 else "Yes")

posted:
last update: