Simple finish the code on the line, do not be so a lot of conditions
Consider the prevailing circumstances, taking into account the special
#include <bits/stdc++.h> using namespace std; const int maxn = 1e5 + 10; int n; int a[maxn]; int main(){ ios::sync_with_stdio(0); cin >> n; for(int i = 1; i <= n; i++) cin >> a[i]; sort(a,a+n); for(int i = 3; i <= n; i++){ if(a[i - 2] + a[i - 1] > a[i]){ cout << a[i - 2] << " " << a[i - 1] << " " << a[i]; return 0; } } cout << "-1"; return 0; }