Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- int main(){
- int nStick;
- scanf("%d", &nStick);
- if(nStick < 3){
- cout << "no";
- return 0;
- }
- int mx = 0;
- int mn = 1e9;
- int secondMn = 1e9;
- for(int i = 1; i <= nStick; ++i){
- int x;
- scanf("%d", &x);
- mx = max(mx, x);
- if(x < mn){
- secondMn = mn;
- mn = x;
- } else if(x < secondMn){
- secondMn = x;
- }
- }
- if(mn + secondMn <= mx){
- cout << "yes";
- } else {
- cout << "no";
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement