Official
A - Compromise Editorial by en_translator
For beginners
- If you are new to learning programming and do not know where to start, please try Problem A "Welcome to AtCoder" from practice contest. There you can find a sample code for each language.
- Also, if you are not familiar with problems in programming contests, we recommend you to try some problems in "AtCoder Beginners Selection".
- 「C++入門 AtCoder Programming Guide for beginners (APG4b)」 is a C++ tutorial for competitive programmers. Sadly, this is only in Japanese too.
- 「Python入門 AtCoder Programming Guide for beginners (APG4bPython)」 is a Python tutorial for competitive programmers. Again, this is only in Japanese.
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: