Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- #define int long long
- signed main()
- {
- int n;
- cin >> n;
- vector<int> v(n);
- for(int i = 0; i < n; i++){
- cin >> v[i];
- }
- sort(v.begin() , v.end());
- bool ok = false;
- for(int i = 1; i < (n - 1); i++){
- int a = v[i - 1] , b = v[i] , c = v[i + 1];
- if((c < (a + b)) && (c > (b - a))){
- ok = true;
- break;
- }
- }
- cout << (ok ? "YES" : "NO") << endl;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement