text
stringlengths
49
983k
#include <bits/stdc++.h> using namespace std; int main() { int prmin, mn, mx, n, hh, x, prmini, mni = -1, mxi; cin >> n; for (int i = 0; i < n; i++) { cin >> hh; prmin = 1000000001; mn = 1000000001; mx = -1; for (int j = 0; j < hh; j++) { cin >> x; if (x < mn) { prmin = mn; mn = x; prmini = mni; mni = j; } else if (x < prmin) { prmin = x; prmini = j; } else if (x > mx) { mx = x; mxi = j; } } if (mn + prmin > mx) { cout << -1 << endl; } else { cout << mni + 1 << " " << prmini + 1 << " " << mxi + 1 << endl; } } return 0; }
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); int T; cin >> T; while (T--) { int n, i, j, k; cin >> n; int a[n]; vector<pair<int, int>> v; for (i = 0; i < n; i++) { cin >> a[i]; v.push_back({a[i], i}); } sort(v.begin(), v.end()); if (v[0].first + v[1].first <= v[v.size() - 1].first || v[0].first + v[v.size() - 1].first <= v[1].first || v[v.size() - 1].first + v[1].first <= v[1].first) { cout << 1 << " " << 2 << " " << v.size() << endl; } else cout << -1 << endl; } }
#include <bits/stdc++.h> using namespace std; int main() { int t; cin >> t; while (t--) { int n, x, a = 0, b = -1; cin >> n; for (int i = 0; i < n; i++) { cin >> x; if (i == 0 || i == 1) a += x; if (i == n - 1 && x >= a) b = i + 1; } if (b == -1) cout << -1 << "\n"; else cout << 1 << " " << 2 << " " << b << "\n"; } return 0; }
#include <bits/stdc++.h> using namespace std; const int N = 5e4 + 5; long long a[N]; void solve() { long long n, i; cin >> n; for (i = 0; i < n; i++) cin >> a[i]; long long x, y, z; x = a[0]; y = a[1]; z = a[n - 1]; if (x + y <= z) { cout << "1 2 " << n << '\n'; return; } cout << "-1\n"; } int main() { int t; cin >> t; while (t--) solve(); }
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(nullptr); int t; cin >> t; while (t-- > 0) { int n; cin >> n; vector<int> a(n); for (int& v : a) cin >> v; if (a[0] + a[1] > a[n - 1]) cout << "-1\n"; else cout << "1 2 " << n << '\n'; } return 0; }
#include <bits/stdc++.h> using namespace std; int main() { int64_t cases, total, elements, i; cin >> cases; for (i = 0; i < cases; i++) { int flag = 0, val = 0; vector<int> x = {}; cin >> total; for (int j = 0; j < total; j++) { cin >> elements; x.push_back(elements); } for (int l = 1; l <= x.size() - 2; l++) { if (x[0] + x[l] <= x[x.size() - 1]) { flag = 1; val = l; break; } } if (flag == 0) { cout << -1 << endl; } else { cout << 1 << " " << val + 1 << " " << x.size() << endl; } } return 0; }
#include <bits/stdc++.h> using namespace std; long long int isprime[1000001]; void sieve() { long long int i, j, k; isprime[0] = isprime[1] = 1; for (i = 2; i <= sqrt(1000000); i++) { if (!isprime[i]) { for (j = 2 * i; j <= 1000000; j += i) { isprime[j] = 1; } } } } long long int modInverse(long long int a, long long int m) { long long int m0 = m; long long int y = 0, x = 1; if (m == 1) return 0; while (a > 1) { long long int q = a / m; long long int t = m; m = a % m; a = t; t = y; y = x - q * y; x = t; } if (x < 0) x += m0; return x; } long long int mod(long long int x, long long int n) { if (n == 0) return 1; if (n % 2 == 0) { long long int y = mod(x, n / 2); return ((y % 1000000007) * (y % 1000000007)) % 1000000007; } else { return ((x % 1000000007) * (mod(x, (n - 1)) % 1000000007)) % 1000000007; } } int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); ; long long int t; cin >> t; while (t--) { long long int n; cin >> n; long long int a[n], i; for (i = 0; i < n; i++) { cin >> a[i]; } if (a[0] + a[1] > a[n - 1]) { cout << "-1" << endl; } else { cout << 1 << " " << 2 << " " << n << endl; } } return 0; }
#include <bits/stdc++.h> using namespace std; using ll = long long; int main() { ios::sync_with_stdio(false); cin.tie(0); int t; cin >> t; while (t--) { int n; cin >> n; vector<int> a(n); for (int i = 0; i < n; i++) cin >> a[i]; if (a[0] + a[1] <= a[n - 1]) { cout << 1 << ' ' << 2 << ' ' << n << endl; } else cout << -1 << endl; } }
#include <bits/stdc++.h> using namespace std; int main() { int t; scanf("%d", &t); while (t--) { int n; cin >> n; int a[n]; for (int i = 0; i < n; i++) { scanf("%d", &a[i]); } if (a[0] + a[1] > a[n - 1]) { printf("-1"); printf("\n"); } else { printf("1"); printf(" "); printf("2"); printf(" "); printf("%d", n); printf("\n"); } } return 0; }
#include <bits/stdc++.h> using namespace std; int main() { int t; cin >> t; while (t--) { long long int n; cin >> n; long long int ar[n + 1]; for (long long int i = 1; i <= n; i++) cin >> ar[i]; long long int x = ar[1], y = ar[2], z = ar[n]; if ((x + y) <= z || (y + z) <= x || (z + x) <= y) cout << 1 << " " << 2 << " " << n << endl; else cout << -1 << endl; } return 0; }
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); int t; cin >> t; while (t--) { long long int n; long long int ar[50009]; cin >> n; for (int i = 1; i <= n; i++) { cin >> ar[i]; } if ((ar[1] + ar[2]) > ar[n]) { cout << "-1" << endl; } else cout << "1" << " " << "2" << " " << n << endl; } }
#include <bits/stdc++.h> using namespace std; long long mod = 1e9 + 7; long long C(int n, int r) { if (r > n) return 0; if (r > n - r) r = n - r; long long ans = 1; int i; for (i = 1; i <= r; i++) { ans *= n - r + i; ans /= i; } return ans; } vector<long long> sieve(long long n) { vector<long long> is_prime(n + 1, true); is_prime[0] = is_prime[1] = false; for (int i = 2; i <= n; i++) { if (is_prime[i] && (long long)i * i <= n) { for (int j = i * i; j <= n; j += i) is_prime[j] = false; } } return is_prime; } void test() { long long n; cin >> n; vector<long long> v(n); for (long long(i) = 0; (i) < n; ++(i)) cin >> v[i]; long long i = 0, j = 1, k = n - 1; if (v[i] + v[j] <= v[k]) { cout << i + 1 << " " << j + 1 << " " << k + 1 << "\n"; return; } cout << "-1\n"; } int main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); long long t = 1; cin >> t; for (long long T = 0; T < t; T++) { test(); } cerr << "Time : " << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC << "ms\n"; }
#include <bits/stdc++.h> using namespace std; void solve() { long long int n; long long int a[50007]; cin >> n; for (int i = 0; i < n; i++) { cin >> a[i]; } if (a[0] + a[1] <= a[n - 1]) { cout << 1 << " " << 2 << " " << n << endl; } else cout << -1 << endl; } int main() { long long int t; cin >> t; for (int i = 0; i < t; i++) { solve(); } }
#include <bits/stdc++.h> using namespace std; int main() { int t; cin >> t; while (t--) { int n, a[100000]; cin >> n; for (int i = 0; i < n; i++) cin >> a[i]; if (a[0] + a[1] <= a[n - 1]) { cout << 0 + 1 << " " << 1 + 1 << " " << n << "\n"; } else cout << "-1\n"; } }
#include <bits/stdc++.h> using namespace std; vector<int> ar[1000001]; int vis[1000001]; int freq1[26]; int freq2[26]; bool checkPrime(int n) { if (n <= 1) return false; if (n <= 3) return true; if (n % 2 == 0 || n % 3 == 0) return false; for (int i = 5; i * i <= n; i = i + 6) if (n % i == 0 || n % (i + 2) == 0) return false; return true; } long long power(long long a, long long b) { if (b == 0) return 1; if (b == 1) return a; if (b % 2 == 1) return (power(a, b - 1) * a) % 1000000007; long long q = power(a, b / 2); return (q * q) % 1000000007; } bool CPT(long long n) { return !(n & (n - 1)); } long long gcd(long long int a, long long int b) { if (b == 0) return a; return gcd(b, a % b); } long long lcm(int a, int b) { return (a / gcd(a, b)) * b; } bool isSubsetSum(int set[], int n, int sum) { bool subset[n + 1][sum + 1]; for (int i = 0; i <= n; i++) subset[i][0] = true; for (int i = 1; i <= sum; i++) subset[0][i] = false; for (int i = 1; i <= n; i++) { for (int j = 1; j <= sum; j++) { if (j < set[i - 1]) subset[i][j] = subset[i - 1][j]; if (j >= set[i - 1]) subset[i][j] = subset[i - 1][j] || subset[i - 1][j - set[i - 1]]; } } return subset[n][sum]; } bool compare(string a, string b) { string ab = a + b; string ba = b + a; return ab > ba; } bool isSubSequence(string str1, string str2, int m, int n) { if (m == 0) return true; if (n == 0) return false; if (str1[m - 1] == str2[n - 1]) return isSubSequence(str1, str2, m - 1, n - 1); return isSubSequence(str1, str2, m, n - 1); } bool areEqual(int arr1[], int arr2[], int n, int m) { if (n != m) return false; int b1 = arr1[0]; int b2 = arr2[0]; for (int i = 1; i < n; i++) { b1 ^= arr1[i]; } for (int i = 1; i < m; i++) { b2 ^= arr2[i]; } int all_xor = b1 ^ b2; if (all_xor == 0) return true; return false; } bool isPrime(int n) { if (n <= 1) return false; if (n <= 3) return true; if (n % 2 == 0 || n % 3 == 0) return false; for (int i = 5; i * i <= n; i = i + 6) if (n % i == 0 || n % (i + 2) == 0) return false; return true; } int nextPrime(int N) { if (N <= 1) return 2; int prime = N; bool found = false; while (!found) { prime++; if (isPrime(prime)) found = true; } return prime; } void solve() { long long n; cin >> n; vector<int> v(n); for (int i = 0; i < n; i++) cin >> v[i]; if (v[0] + v[1] <= v[n - 1]) { cout << 1 << " " << 2 << " " << n << "\n"; return; } cout << -1 << "\n"; } int main() { int tt; cin >> tt; while (tt--) solve(); return 0; }
#include <bits/stdc++.h> using namespace std; int main() { int t, n, a[100000]; cin >> t; for (int i = 0; i < t; i++) { cin >> n; for (int j = 0; j < n; j++) { cin >> a[j]; } if (a[0] + a[1] <= a[n - 1]) cout << 1 << ' ' << 2 << ' ' << n << endl; else cout << -1 << endl; } return 0; }
#include <bits/stdc++.h> using namespace std; int main() { int t; cin >> t; while (t--) { long long n; cin >> n; long long a[n + 1]; for (int i = 1; i <= n; i++) cin >> a[i]; if (a[1] + a[2] <= a[n]) { cout << "1" << " " << "2" << " " << n << endl; } else cout << "-1" << endl; } }
#include <bits/stdc++.h> using namespace std; const int N = 100005; const int oo = INT_MAX; int t, n; int a[N]; int main() { cin >> t; while (t--) { scanf("%d", &n); for (int i = 0; i < n; i++) scanf("%d", a + i); if (a[0] + a[1] <= a[n - 1]) printf("%d %d %d\n", 1, 2, n); else puts("-1"); } }
#include <bits/stdc++.h> using namespace std; int main() { int t; cin >> t; while (t--) { int n; cin >> n; int a[n]; for (int i = 0; i < n; i++) cin >> a[i]; if (a[0] + a[1] <= a[n - 1]) { cout << "1 2 " << n << endl; } else cout << -1 << endl; } return 0; }
#include <bits/stdc++.h> using namespace std; int main() { int i, j, k, t, n; cin >> t; while (t--) { cin >> n; int arr[n]; for (i = 0; i < n; i++) { cin >> arr[i]; } if ((arr[0] + arr[1] <= arr[n - 1]) || (arr[1] + arr[n - 1] <= arr[0]) || (arr[0] + arr[n - 1] <= arr[1])) { cout << "1" << " " << "2" << " " << n << endl; } else { cout << "-1" << endl; } } }
#include <bits/stdc++.h> using namespace std; int s[50001]; signed main() { int t; scanf("%d", &t); while (t--) { int n; scanf("%d", &n); for (int i = 0; i < (n); i++) { scanf("%d", &s[i]); } for (int i = 1; i < n - 1; i++) { if (s[0] + s[i] <= s[n - 1]) { printf("%d %d %d\n", 1, i + 1, n); goto hell; } } printf("-1\n"); hell : {} } }
#include <bits/stdc++.h> using namespace std; int a[50005]; int main() { int t, n; cin >> t; while (t--) { cin >> n; for (int i = 1; i <= n; i++) { cin >> a[i]; } if (a[1] + a[2] <= a[n]) { printf("1 2 %d\n", n); } else { puts("-1"); } } }
#include <bits/stdc++.h> using namespace std; int main() { int t; cin >> t; for (int tc = 1; tc <= t; tc++) { int n; cin >> n; vector<int> v(n); for (int i = 0; i < n; i++) cin >> v[i]; int i = 0, j = 1, k = n - 1; if (v[i] + v[j] > v[k]) cout << -1 << endl; else { cout << i + 1 << " " << j + 1 << " " << k + 1 << endl; } } }
#include <bits/stdc++.h> using namespace std; int main() { int t; cin >> t; for (int p = 0; p < t; p++) { int n; cin >> n; int a[n]; for (int i = 0; i < n; i++) cin >> a[i]; int flag = 0; int ans[3]; for (int i = 0; i < n - 2; i++) { int temp; temp = a[i] + a[i + 1]; if (temp <= a[n - 1]) { flag = 1; ans[0] = i + 1; ans[1] = i + 2; ans[2] = n; } if (flag == 1) break; } if (flag == 1) cout << ans[0] << " " << ans[1] << " " << ans[2] << endl; else cout << "-1" << endl; } return 0; }
#include <bits/stdc++.h> using namespace std; using ll = long long; mt19937 gen(time(0)); void setIO(string name = "") { ios_base::sync_with_stdio(false); cin.tie(nullptr); } int main() { setIO(); int t, n, x; cin >> t; for (int j = 0; j < t; j++) { cin >> n; vector<int> a(n); for (int i = 0; i < n; i++) { cin >> a[i]; } if (a[n - 1] >= a[0] + a[1]) { cout << "1 2 " << n << "\n"; } else { cout << "-1\n"; } } }
#include <bits/stdc++.h> using namespace std; template <class T> bool mini(T &a, T b) { return a > b ? (a = b, true) : false; } template <class T> bool maxi(T &a, T b) { return a < b ? (a = b, true) : false; } signed main() { ios::sync_with_stdio(false); cin.tie(nullptr); cout.precision(10); cout << fixed; int t; cin >> t; while (t--) { int n; cin >> n; vector<long long> a(n + 3); for (int i = 0; i < (int)(n); i++) cin >> a[i]; if (a[0] + a[1] <= a[n - 1]) cout << 1 << " " << 2 << " " << n << "\n"; else cout << -1 << "\n"; } }
#include <bits/stdc++.h> #pragma GCC optimize("Ofast") #pragma GCC optimize("unroll-loops") using namespace std; void test() { long long n; cin >> n; long long a[n]; for (long long i = 0; i < n; i++) cin >> a[i]; if (a[n - 1] >= a[0] + a[1]) cout << 1 << " " << 2 << " " << n << endl; else cout << -1 << endl; } int main() { ios::sync_with_stdio(0), cin.tie(0), cout.tie(0); long long t = 1; cin >> t; while (t--) { test(); } return 0; }
#include <bits/stdc++.h> using namespace std; struct solution { int t, n{0}; vector<int> a{}; void get_data() { cin >> t; } void solve() { while (t--) { cin >> n; a.clear(); a.resize(n); for (auto &el : a) cin >> el; auto f = a[0]; auto s = a[1]; bool printed = false; for (auto i = 2; i < a.size(); ++i) { if ((f + s) <= a[i]) { cout << 1 << " " << 2 << " " << i + 1 << "\n"; printed = true; break; } } if (!printed) cout << "-1\n"; } } }; int main() { ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); solution s; s.get_data(); s.solve(); return 0; }
#include <bits/stdc++.h> using namespace std; void solve() { long long n, i, x; cin >> n; vector<long long> ar; for (i = 0; i < n; i++) { cin >> x; ar.push_back(x); } if ((ar[0] + ar[1]) <= ar[n - 1]) { cout << 1 << " " << 2 << " " << n << endl; } else { cout << -1 << endl; } } int main() { int t; cin >> t; while (t--) { solve(); } }
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); int t; cin >> t; while (t--) { int n; cin >> n; long long int arr[n]; for (int j = 0; j < n; j++) { cin >> arr[j]; } if (arr[0] + arr[1] <= arr[n - 1]) { cout << 1 << " " << 2 << " " << n << endl; } else { cout << -1 << endl; } } return 0; }
#include <bits/stdc++.h> using namespace std; long long a[50005]; int main() { int i, t, n; scanf("%d", &t); while (t--) { scanf("%d", &n); for (i = 0; i < n; i++) { scanf("%lld", &a[i]); } if (a[0] + a[1] <= a[n - 1]) { printf("1 2 %d\n", n); } else { printf("-1\n"); } } return 0; }
#include <bits/stdc++.h> #pragma GCC optimize("Ofast") #pragma GCC target("avx,avx2,fma") using namespace std; int arrg[1000000]; int nxt() { int x; cin >> x; return x; } int lxt() { long long x; cin >> x; return x; } int dxt() { double x; cin >> x; return x; } int ldxt() { long double x; cin >> x; return x; } bool cmp(const pair<int, int> &p, const pair<int, int> &q) { if (p.first < q.first) return 1; else if (p.first == q.first) return (p.second < q.second); else return 0; } int main() { ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); int tc; cin >> tc; for (int z = 1; z <= tc; z++) { long long n = nxt(), p = 1; vector<long long> v(n); for (int i = 0; i < n; i++) cin >> v[i]; sort((v).begin(), (v).end()); long long x = *max_element((v).begin(), (v).end()); for (long long j = 1; j <= n - 2 && p == 1; j++) { if ((v[0] + v[j]) <= x) { cout << 1 << " " << j + 1 << " " << n << "\n"; p = 0; } } if (p) cout << (-1) << "\n"; } return 0; }
#include <bits/stdc++.h> using namespace std; long long max3(long long a, long long b, long long c) { return max(a, max(b, c)); } long long min3(long long a, long long b, long long c) { return min(a, min(b, c)); } int main() { { int q; cin >> q; while (q--) { int n; cin >> n; vector<int> a(n); for (int i = 0; i < n; i++) { cin >> a[i]; } bool done = false; if (a[0] + a[1] <= a[n - 1]) { cout << 1 << " " << 2 << " " << n << endl; } else { cout << -1 << endl; } } } return 0; }
#include <bits/stdc++.h> int mod = 1000000007; using namespace std; vector<int> v[100001]; void solve() { long long n; cin >> n; long long a[n]; for (int i = 0; i < n; i++) { cin >> a[i]; } if (a[0] + a[1] <= a[n - 1]) { cout << "1 " << "2 " << n << " " << endl; } else { cout << "-1 " << endl; } } int main() { int t = 1; cin >> t; while (t--) solve(); return 0; }
#include <bits/stdc++.h> using namespace std; double pi = 3.14159265358979323846; bool sortbysec(const pair<long long int, long long int> &a, const pair<long long int, long long int> &b) { if (a.first == b.first) return (a.second < b.second); return (a.first < b.first); } long long int fpower(long long int x, long long int y) { long long int ans = 1; while (y) { if (y & 1) ans = ans * x, y--; else x *= x, y /= 2; } return ans; } long long int myXOR(long long int x, long long int y) { return (x | y) & (~x | ~y); } bool prime(long long int x) { if (x == 1) return 0; for (long long int i = 2; i * i <= x; i++) { if (x % i == 0) return 0; } return 1; } long long int gcd(long long int x, long long int y) { if (x == 0) return y; return gcd(y % x, x); } void primefactor(set<long long int> &s, long long int x) { for (long long int i = 2; i * i <= x; i++) { if (x % i == 0) { s.insert({i, x / i}); } } } int count(string s, string s1, int n, int m, int sum) { if (n == 0 || m == 0) return 0; if (s[n - 1] == s1[m - 1]) sum = max(sum + 1, count(s, s1, n - 1, m - 1, sum + 1)); else sum = max(sum, max(count(s, s1, n - 1, m, 0), count(s, s1, n, m - 1, 0))); return sum; } int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); ; int k; cin >> k; while (k--) { int n, x; cin >> n; vector<int> v; for (int i = 0; i < n; i++) { cin >> x; v.push_back(x); } int flag = 0; int l = 0, r, i = n - 1; for (r = 1; r < i; r++) { if (v[i] >= v[l] + v[r]) { flag = 1; break; } } if (flag) { cout << l + 1 << " "; cout << r + 1 << " "; cout << i + 1 << "\n"; } else cout << -1 << "\n"; } }
#include <bits/stdc++.h> using namespace std; const long long LINF = (long long)1e18 + 47; const int INF = 2 * 1e9 + 47; const int MOD = 1e9 + 7; const int modulo = 1e8; const int nax = 3 * (int)1e3 + 10; const double EPS = 1e-7; int main() { ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0); int tt; cin >> tt; for (int test = (1); test < (tt + 1); test++) { int n; cin >> n; vector<int> a(n); for (int i = (0); i < (n); i++) cin >> a[i]; if (a[n - 1] >= a[0] + a[1]) { cout << 1 << ' ' << 2 << ' ' << n << '\n'; } else cout << -1 << '\n'; } }
#include <bits/stdc++.h> using namespace std; int main() { long long int t, k; cin >> t; for (k = 1; k <= t; k++) { long long int n, i, s = 0, f = 0; cin >> n; int a[n]; for (i = 0; i < n; i++) { cin >> a[i]; } s = a[0] + a[1]; for (i = 2; i < n; i++) { if (a[i] >= s) { f = 1; cout << 1 << " " << 2 << " " << i + 1; break; } } if (f == 0) cout << -1; cout << endl; } return 0; }
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(0); cin.tie(NULL); cout.tie(NULL); int t, n, i; cin >> t; while (t--) { cin >> n; int ar[n]; for (i = 0; i < n; i++) cin >> ar[i]; if (ar[0] + ar[1] <= ar[n - 1]) cout << 1 << ' ' << 2 << ' ' << n << '\n'; else cout << -1 << '\n'; } }
#include <bits/stdc++.h> using namespace std; const int MXN = 5e4 + 5; const int INF = 1e9; const long long P = 29; const long long MOD = 1e9 + 7; int t; int main() { srand(time(0)); ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); cout << fixed << setprecision(10); cin >> t; while (t--) { int n, x1, x2, x3; cin >> n; cin >> x1 >> x2; for (int i = 2; i < n; i++) { cin >> x3; } if (x1 + x2 <= x3) cout << 1 << ' ' << 2 << ' ' << n << '\n'; else cout << -1 << '\n'; } return 0; }
#include <bits/stdc++.h> using namespace std; template <typename T> void pr(vector<T> &v) { for (int i = 0; i < (int)(v).size(); i++) cout << v[i] << " "; cout << endl; } template <typename T> void pr(vector<vector<T>> &v) { for (int i = 0; i < (int)(v).size(); i++) { pr(v[i]); } } template <typename T> void re(T &first) { cin >> first; } template <typename T> void re(vector<T> &a) { for (int i = 0; i < (int)(a).size(); i++) re(a[i]); } template <class Arg, class... Args> void re(Arg &first, Args &...rest) { re(first); re(rest...); } template <typename T> void pr(T first) { cout << first << endl; } template <class Arg, class... Args> void pr(const Arg &first, const Args &...rest) { cout << first << " "; pr(rest...); cout << endl; } void ps() { cout << endl; } template <class T, class... Ts> void ps(const T &t, const Ts &...ts) { cout << t; if (sizeof...(ts)) cout << " "; ps(ts...); } void solve() { int n; re(n); vector<int> a(n); re(a); if (a[0] + a[1] <= a[n - 1]) { ps(1, 2, n); } else { pr(-1); } } int main() { ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); int t = 1; re(t); for (int tt = 0; tt < t; tt++) { solve(); } }
#include <bits/stdc++.h> using namespace std; const double PI = acos(-1); const long long INF = 1LL << 62; const long long MINF = -(1LL << 62); template <typename T> T getint() { T val = 0; char c; bool neg = false; while ((c = getchar()) && !(c >= '0' && c <= '9')) { neg |= c == '-'; } do { val = (val * 10) + c - '0'; } while ((c = getchar()) && (c >= '0' && c <= '9')); return val * (neg ? -1 : 1); } int main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); int T; cin >> T; while (T--) { int n; cin >> n; vector<int> t(n); for (int i = 0; i < n; ++i) cin >> t[i]; if (t[0] + t[1] > t[n - 1]) { cout << "-1\n"; } else { cout << "1 2 " << n << "\n"; } } return 0; }
#include <bits/stdc++.h> using namespace std; int main() { int t; cin >> t; while (t--) { int n; cin >> n; int a[n]; for (int i = 0; i < n; i++) cin >> a[i]; if (a[0] + a[1] <= a[n - 1]) cout << "1 2 " << n << endl; else cout << "-1" << endl; } }
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); long long int t; cin >> t; while (t--) { long long int n; cin >> n; long long int a[n]; for (long long int i = 0; i < n; i++) { cin >> a[i]; } long long int x, y, z; x = a[0]; y = a[1]; z = a[n - 1]; if (x + y <= z) { cout << "1 2 " << n << "\n"; } else { cout << "-1\n"; } } return 0; }
#include <bits/stdc++.h> using namespace std; int main() { int T; cin >> T; while (T--) { int n; cin >> n; int A, B, C; cin >> A >> B; for (int i = 3; i <= n - 1; i++) cin >> C; cin >> C; if (A + B <= C) cout << "1 2 " << n; else cout << -1; cout << "\n"; } }
#include <bits/stdc++.h> using namespace std; void solve() { int n; cin >> n; vector<int> v(n); for (int i = 0; i < n; i++) cin >> v[i]; if (v[0] + v[1] <= v.back()) cout << "1 2 " << n << "\n"; else cout << "-1\n"; } int32_t main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); int tst; cin >> tst; while (tst--) { solve(); } }
#include <bits/stdc++.h> using namespace std; const int N = 1e5 + 5; int main() { int t; scanf("%d", &t); ; while (t--) { int n; scanf("%d", &n); ; long long arr[n]; for (int i = 0; i < n; i++) scanf("%lld", &arr[i]); ; if (arr[0] + arr[1] <= arr[n - 1]) { cout << 1 << " " << 2 << " " << n << "\n"; } else { cout << -1 << "\n"; } } }
#include <bits/stdc++.h> using namespace std; int t; int main() { ios_base::sync_with_stdio(false); cin.tie(nullptr); cin >> t; while (t--) { int n, fir, sec, last; cin >> n; for (int i = 1; i <= n; i++) { int x; cin >> x; if (i == 1) fir = x; if (i == 2) sec = x; if (i == n) last = x; } if (last >= fir + sec) cout << 1 << ' ' << 2 << ' ' << n << "\n"; else cout << "-1\n"; } }
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); int t; cin >> t; while (t--) { int n; cin >> n; vector<int> a(n); for (int i = 0; i < n; i++) cin >> a[i]; int f = -1; for (int i = 2; i < n; i++) { if (a[i] >= a[0] + a[1]) { f = i; break; } } if (f == -1) { cout << -1 << '\n'; } else { cout << 1 << ' ' << 2 << ' ' << (f + 1) << '\n'; } } }
#include <bits/stdc++.h> using namespace std; void solve() { long long int n; cin >> n; long long int a[n]; long long int i; for (long long int i = 0; i < n; i += 1) cin >> a[i]; if ((a[0] + a[1]) > a[n - 1]) cout << -1 << '\n'; else cout << 1 << " " << 2 << " " << n << '\n'; } int main() { ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); ; long long int t = 1; cin >> t; while (t--) solve(); return 0; }
#include <bits/stdc++.h> using namespace std; const long long INF = 2e15; const long long MB = 20; const long long MOD = 1e9 + 7; void solve() { long long n; cin >> n; vector<long long> a(n); for (long long i = 0; i < n; i++) { cin >> a[i]; } if (a.back() >= a[0] + a[1]) { cout << "1 2 " << n << '\n'; return; } cout << "-1\n"; } signed main() { ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); cout << fixed; cout.precision(12); srand(time(0)); long long t; cin >> t; while (t--) solve(); }
#include <bits/stdc++.h> using namespace std; long long max(long long a, long long b) { if (a > b) return a; else return b; } int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); long long t; cin >> t; while (t--) { long long n; cin >> n; vector<long long> v(n); for (long long i = 0; i < n; i++) cin >> v[i]; sort(v.begin(), v.end()); if (n < 3) { cout << -1 << "\n"; continue; } long long mn1 = v[0]; long long mn2 = v[1]; long long mx = v[n - 1]; if (mn1 + mn2 > mx) cout << -1 << "\n"; else cout << 1 << " " << 2 << " " << n << "\n"; } return 0; }
#include <bits/stdc++.h> using namespace std; const int N = 100007; int main() { ios::sync_with_stdio(false); cin.tie(0); int t = 1; cin >> t; while (t--) { int n; cin >> n; int a[n]; for (int i = 0; i < n; i++) { cin >> a[i]; } int ind; bool found = false; if (a[0] + a[1] <= a[n - 1]) found = true; if (found) { cout << 1 << " " << 2 << " " << n << "\n"; } else cout << "-1\n"; } return 0; }
#include <bits/stdc++.h> using namespace std; int main() { int t; cin >> t; for (int i = 0; i < t; i++) { long long int n; cin >> n; long long int a[n]; for (long long int j = 0; j < n; j++) { cin >> a[j]; } if (a[0] + a[1] <= a[n - 1]) cout << "1 2 " << n << endl; else cout << "-1" << endl; } }
#include <bits/stdc++.h> using namespace std; const long double EPS = 1e-10; const long long INF = 1e18; const long double PI = acos(-1.0L); long long gcd(long long a, long long b) { if (b == 0) { return a; } return gcd(b, a % b); } int main() { int cnt = 1; int t; cin >> t; while (t--) { int n; cin >> n; int a[n]; for (int i = 0; i < (n); i++) { cin >> a[i]; } if (a[0] + a[1] <= a[n - 1]) { cout << "1 2 " << n << "\n"; } else { cout << "-1\n"; } } return 0; }
#include <bits/stdc++.h> using namespace std; int main() { int t, n, flag, j; cin >> t; int arr1[t]; for (int i = 0; i < t; i++) { cin >> n; int arr[n]; for (j = 0; j < n; j++) { cin >> arr[j]; } flag = 0; for (j = 2; j < n; j++) { if (arr[j] >= arr[0] + arr[1]) { flag = 1; break; } } if (flag == 1) arr1[i] = j + 1; else arr1[i] = -1; } for (int i = 0; i < t; i++) { if (arr1[i] != -1) cout << "1 2" << " " << arr1[i] << endl; else cout << "-1" << endl; } }
#include <bits/stdc++.h> using namespace std; int main() { int t, n, i; scanf("%d", &t); while (t--) { scanf("%d", &n); vector<int> a(n); for (i = 0; i < n; i++) scanf("%d", &a[i]); if (a[0] + a[1] <= a[n - 1]) printf("1 2 %d\n", n); else printf("-1\n"); } return 0; }
#include <bits/stdc++.h> using namespace std; void solve() { long long int n; cin >> n; vector<long long int> arr; set<long long int> s; for (int i = 0; i < n; i++) { long long int val; cin >> val; arr.push_back(val); } bool temp = false; long long int sum = arr[0] + arr[1]; for (int i = 2; i < n; i++) { if (sum <= arr[i]) { temp = true; cout << 1 << " " << 2 << " " << i + 1 << '\n'; break; } } if (!temp) { cout << -1 << '\n'; } } int main() { int t; cin >> t; while (t--) { solve(); } }
#include <bits/stdc++.h> using namespace std; int main() { int t; cin >> t; while (t--) { int n; cin >> n; int arr[n]; for (int i = 0; i < n; i++) cin >> arr[i]; if (arr[0] + arr[1] > arr[n - 1]) cout << -1 << endl; else cout << "1" << " " << "2" << " " << n << endl; } return 0; }
#include <bits/stdc++.h> using namespace std; long long n, a[100005], T, c; int main() { cin >> T; for (long long j = 1; j <= T; j++) { cin >> n; long long op; for (long long i = 1; i <= n; i++) { cin >> a[i]; } if (a[n] >= a[1] + a[2]) cout << "1 2 " << n << endl; else cout << "-1\n"; } return 0; }
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(0); cin.tie(0); int t; cin >> t; while (t--) { int n; cin >> n; int a[n]; for (int i = 0; i < n; i++) cin >> a[i]; if ((long long)a[0] + a[1] > (long long)a[n - 1]) cout << -1 << '\n'; else { cout << 1 << ' ' << 2 << ' ' << n << '\n'; } } }
#include <bits/stdc++.h> long long int a[50004]; int main() { int t; scanf("%d", &t); while (t--) { int n; scanf("%d", &n); for (int i = 1; i <= n; i++) scanf("%lld", &a[i]); if (a[1] + a[2] <= a[n]) { printf("%d %d %d\n", 1, 2, n); } else printf("-1\n"); } }
#include <bits/stdc++.h> using namespace std; int main() { int t; cin >> t; int cas = 0; while (t--) { int n; cin >> n; int a[n], a1 = 0, a2 = 0, a3 = 0; for (int i = 0; i < n; i++) cin >> a[i]; if (a[0] + a[1] <= a[n - 1]) cout << 1 << " " << 2 << " " << n << endl; else cout << -1 << endl; } }
#include <bits/stdc++.h> using namespace std; int main() { int t; scanf("%d", &t); for (int i = 0; i < t; i++) { int n; scanf("%d", &n); vector<int> a(n); for (int j = 0; j < n; j++) scanf("%d", &a[j]); if (a[0] + a[1] <= a[n - 1]) printf("%d %d %d\n", 1, 2, n); else printf("-1\n"); } return 0; }
#include <bits/stdc++.h> using namespace std; int main() { int n, a, c, d; cin >> n; while (n--) { int i, j, k, w, q; cin >> a; long g, h, e[a], m = 0; for (i = 1; i <= a; i++) cin >> e[i]; for (i = 2; i <= a - 1; i++) { if (e[i] + e[i - 1] <= e[a - i + 2]) { m++; g = i - 1; h = i; k = a - i + 2; break; } } if (m > 0) { cout << g << " " << h << " " << k << endl; } else { cout << "-1" << endl; } } }
#include <bits/stdc++.h> using namespace std; int main() { long long int t; cin >> t; while (t--) { long long int n; cin >> n; long long int a[n]; for (int i = 0; i < n; i++) { cin >> a[i]; } if (a[0] + a[1] <= a[n - 1]) { cout << 1 << " " << 2 << " " << n << endl; } else { cout << -1 << endl; } } return 0; }
#include <bits/stdc++.h> using namespace std; template <class T> using V = vector<T>; template <class T> using VV = V<V<T>>; int main() { int t; cin >> t; while (t--) { int n; cin >> n; V<int> a(n); for (int i = 0; i < n; i++) { cin >> a[i]; } if (a[0] + a[1] <= a[n - 1]) { cout << "1 2 " << n << endl; } else { cout << -1 << endl; } } return 0; }
#include <bits/stdc++.h> using namespace std; const double pi = acos(-1); int main() { ios_base::sync_with_stdio(0); cin.tie(0); long long tc; cin >> tc; while (tc--) { long long n, x, a, b, y; cin >> y >> a >> b; n = y - 2; while (n--) cin >> x; if (a + b > x) cout << "-1\n"; else cout << "1 2 " << y << endl; } }
#include <bits/stdc++.h> using namespace std; const double pi = 3.14159265358979323846; void fast() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); } long long n, m; int32_t main() { fast(); long long T, t; cin >> T; for (t = 1; t <= T; t++) { long long n; cin >> n; long long a[n]; for (long long i = 0; i < n; i++) cin >> a[i]; sort(a, a + n); long long A = a[0], B = a[1], C = a[n - 1]; if (A + B <= C) { cout << "1 2 " << n << "\n"; } else cout << -1 << "\n"; } }
#include <bits/stdc++.h> using namespace std; int t, n; int main() { cin >> t; for (int i = 0; i < t; i++) { cin >> n; long long arr[n]; for (int i = 0; i < n; i++) { cin >> arr[i]; } if (arr[0] + arr[1] <= arr[n - 1]) { cout << "1 2 " << n << '\n'; } else { cout << -1 << '\n'; } } }
#include <bits/stdc++.h> using namespace std; const int mxN = 5e4; int n, chu[mxN]; int main() { ios::sync_with_stdio(0); cin.tie(0); int t; cin >> t; while (t--) { cin >> n; for (int i = 0; i < n; i++) cin >> chu[i]; if (chu[0] + chu[1] <= chu[n - 1]) cout << 1 << " " << 2 << " " << n << "\n"; else cout << -1 << "\n"; } }
#include <bits/stdc++.h> using namespace std; int main() { long long t; cin >> t; while (t--) { long long n; long long i; cin >> n; long long a[n]; for (i = 0; i < n; i++) { cin >> a[i]; } if (a[0] + a[1] <= a[n - 1]) cout << 1 << " " << 2 << " " << n << "\n"; else cout << -1 << "\n"; } return 0; }
#include <bits/stdc++.h> using namespace std; const long long inf = 1e9 + 7; const long long INF = 1LL << 60; const long long mod = 1e9 + 7; const long double eps = 1e-8; const long double pi = acos(-1.0); template <class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; } template <class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; } void solve() { long long n; cin >> n; vector<long long> a(n); for (long long i = 0; i < n; i++) { cin >> a[i]; } if (a[0] + a[1] <= a[n - 1]) { cout << 1 << " " << 2 << " " << n << endl; } else { cout << -1 << endl; } } signed main() { ios::sync_with_stdio(false); cin.tie(0); long long t; cin >> t; for (long long i = 0; i < t; i++) solve(); return 0; }
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); int tc; cin >> tc; while (tc--) { int n; cin >> n; int a[n + 5]; for (int i = 1; i <= n; i++) cin >> a[i]; if (a[1] + a[2] <= a[n]) { cout << 1 << " " << 2 << " " << n << endl; } else { cout << "-1" << endl; } } return 0; }
#include <bits/stdc++.h> using namespace std; vector<string> vec_splitter(string s) { s += ','; vector<string> res; while (!s.empty()) { res.push_back(s.substr(0, s.find(','))); s = s.substr(s.find(',') + 1); } return res; } void debug_out(vector<string> __attribute__((unused)) args, __attribute__((unused)) int idx, __attribute__((unused)) int LINE_NUM) { cerr << "\n"; } template <typename Head, typename... Tail> void debug_out(vector<string> args, int idx, int LINE_NUM, Head H, Tail... T) { if (idx > 0) cerr << ", "; else cerr << "Line(" << LINE_NUM << ") "; stringstream ss; ss << H; cerr << args[idx] << " = " << ss.str(); debug_out(args, idx + 1, LINE_NUM, T...); } void solve() { long long int t; cin >> t; while (t--) { long long int n; cin >> n; vector<long long int> v(n); for (auto &it : v) cin >> it; long long int sum = v[0] + v[1]; long long int ans = -1; for (long long int(i) = 0; (i) < (n); (i)++) { if (sum <= v[i]) { ans = (i + 1); break; } } if (ans != -1) cout << 1 << " " << 2 << " " << ans << "\n"; else cout << ans << "\n"; } } int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); solve(); return 0; }
#include <bits/stdc++.h> int a[50003]; int main() { int T; scanf("%d", &T); while (T--) { int n; scanf("%d", &n); for (int i = 1; i <= n; ++i) { scanf("%d", &a[i]); } if (a[1] + a[2] <= a[n]) printf("%d %d %d\n", 1, 2, n); else puts("-1"); } }
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); int T; cin >> T; while (T--) { int n; cin >> n; int a[n]; for (int i = 0; i < (n); i++) { cin >> a[i]; } if (a[0] + a[1] <= a[n - 1]) { cout << "1 2 " << n << '\n'; } else { cout << -1 << '\n'; } } }
#include <bits/stdc++.h> #pragma GCC optimize "trapv" using namespace std; void solveEachTest(long long int T35TC453N = 1) { long long int n; cin >> n; vector<long long int> arr(n); for (auto &V3C_I7 : (arr)) cin >> (V3C_I7); if (arr[0] + arr[1] <= arr[n - 1]) { cout << "1 2 " << n; } else { cout << "-1"; } cout << "\n"; return; } signed main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.precision(10); long long int T3X0 = 0, T353 = 1; cin >> (T3X0); T353 = T3X0; while (T3X0--) solveEachTest(T353 - T3X0); return 0; }
#include <bits/stdc++.h> using namespace std; int t, n, A[1000000]; int main() { cin >> t; while (t--) { cin >> n; for (int i = 1; i <= n; i++) cin >> A[i]; if (A[1] + A[2] <= A[n]) cout << 1 << " " << 2 << " " << n << endl; else cout << -1 << endl; } }
#include <bits/stdc++.h> using namespace std; const int maxn = 1e9; int main() { ios_base::sync_with_stdio(0); cin.tie(0); int t; cin >> t; while (t--) { int n; cin >> n; vector<int> a(n); for (int i = 0; i < n; i++) { cin >> a[i]; } if (a[0] + a[1] <= a[n - 1]) { cout << 1 << " " << 2 << " " << n << '\n'; } else { cout << -1 << '\n'; } } return 0; }
#include <bits/stdc++.h> using namespace std; int main() { long long t, n; cin >> t; while (t--) { cin >> n; vector<long long> arr(n); for (int i = 0; i < n; i++) cin >> arr[i]; int i = 0, j = i + 1, k = j + 1; bool flag = false; while (k < n) { if (arr[i] + arr[j] <= arr[k]) { cout << i + 1 << " " << j + 1 << " " << k + 1 << "\n"; flag = true; break; } k++; } if (flag == false) { cout << "-1" << "\n"; } } return 0; }
#include <bits/stdc++.h> using namespace std; const int N = 1e5 + 5; int a[N]; int solve() { int n; cin >> n; for (int i = 0; i < n; i++) cin >> a[i]; int i = 0, j = 1, k = 2; long long sum = a[i] + a[j]; for (int k = 2; k < n; k++) { if (a[k] >= sum) { cout << "1 2 " << k + 1 << endl; return k; } } cout << -1 << endl; } int main() { int t = 1; cin >> t; while (t--) { solve(); } return 0; }
#include <bits/stdc++.h> using namespace std; int main() { int t; cin >> t; while (t--) { int n; cin >> n; long int a[n]; for (int i = 0; i < n; i++) cin >> a[i]; bool ok = true; for (int i = 2; i < n; i++) if (a[0] + a[1] <= a[i]) { cout << 1 << ' ' << 2 << ' ' << i + 1 << endl; ok = false; break; } if (ok) cout << -1 << endl; } }
#include <bits/stdc++.h> int n, a[50005]; void solve() { scanf("%d", &n); for (int i = 1; i <= n; ++i) { scanf("%d", a + i); } if (a[1] + a[2] <= a[n]) { printf("1 2 %d\n", n); } else { printf("-1\n"); } } int main() { int T; scanf("%d", &T); while (T--) { solve(); } }
#include <bits/stdc++.h> using namespace std; int main() { int t; cin >> t; while (t--) { int n; cin >> n; int a[n]; for (int i = 1; i <= n; i++) cin >> a[i]; if (a[2] + a[1] > a[n]) cout << -1 << endl; else cout << 1 << " " << 2 << " " << n << endl; } }
#include <bits/stdc++.h> using namespace std; bool isPrime(int n) { if (n <= 1) return false; for (int i = 2; i < n; i++) if (n % i == 0) return false; return true; } int main() { long long int t; cin >> t; while (t--) { long long int n; cin >> n; vector<long long int> v; for (long long int i = 0; i < n; i++) { long long int x; cin >> x; v.push_back(x); } if (v[0] + v[1] <= v[n - 1]) { cout << 1 << " " << 2 << " " << n << "\n"; } else { cout << -1 << "\n"; } } return 0; }
#include <bits/stdc++.h> using namespace std; int main() { int _; cin >> _; while (_--) { int n; cin >> n; long long a[n]; for (int i = 0; i < n; i++) { cin >> a[i]; } if (a[0] + a[1] <= a[n - 1]) cout << "1" << " " << "2" << " " << n << endl; else cout << "-1" << endl; } return 0; }
#include <bits/stdc++.h> using namespace std; int main(int argc, char const *argv[]) { int t; int n; vector<int> Arr; cin >> t; while (t--) { cin >> n; Arr.resize(n); for (int i = 0; i < n; i++) cin >> Arr[i]; if (Arr[n - 1] >= Arr[0] + Arr[1]) { cout << 1 << " " << 2 << " " << n << endl; } else cout << -1 << endl; } return 0; }
#include <bits/stdc++.h> using namespace std; const int dx[8] = {-1, -1, -1, 0, 1, 1, 1, 0}; const int dy[8] = {-1, 0, 1, 1, 1, 0, -1, -1}; const int MAX = 2 * 1000 * 1000 + 10; const long long INF = 1e18; const int MOD = 1e9 + 7; void sol() { int n; cin >> n; vector<int> v(n); for (int &i : v) cin >> i; int a = 0, b = 1; for (int i = 2; i < n; i++) { if (v[a] + v[b] <= v[i]) { cout << a + 1 << " " << b + 1 << " " << i + 1 << '\n'; return; } if (v[i] < v[b]) { if (v[b] < v[a]) a = b; b = i; } } cout << -1 << '\n'; } signed main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); ; int t = 1; cin >> t; while (t--) { sol(); } }
#include <bits/stdc++.h> using namespace std; int main(void) { long long int test, n, i; cin >> test; while (test--) { cin >> n; long long int arr[n]; for (i = 0; i < n; i++) { cin >> arr[i]; } if (arr[0] + arr[1] > arr[n - 1]) cout << -1 << endl; else cout << 1 << " " << 2 << " " << n << endl; } }
#include <bits/stdc++.h> using namespace std; bool check(long long a, long long b, long long c) { int f = 0; if ((a + b) > c) f = 1; if ((b + c) > a) f++; if ((c + a) > b) f++; if (f == 3) return false; else return true; } void solve() { int n; cin >> n; int i; long long arr[n]; for (i = 0; i < n; i++) { cin >> arr[i]; } if (check(arr[0], arr[1], arr[n - 1])) { cout << 1 << " " << 2 << " " << n << endl; return; } cout << "-1\n"; return; } int main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); int t = 1; cin >> t; while (t--) { solve(); } return 0; }
#include <bits/stdc++.h> using namespace std; const int N = 2005; const long long M = 1e9 + 7; const long long inf = 1e18 + 5; int main() { int T; scanf("%d", &T); while (T--) { int n; scanf("%d", &n); int a[n]; for (int i = 0; i < n; i++) scanf("%d", &a[i]); if (a[0] + a[1] <= a[n - 1]) { printf("1 2 %d\n", n); } else printf("%d\n", -1); } }
#include <bits/stdc++.h> using namespace std; int a[50005]; int main() { int t; scanf("%d", &t); while (t--) { int n; scanf("%d", &n); for (int i = 0; i < n; i++) scanf("%d", &a[i]); if (a[0] + a[1] <= a[n - 1]) printf("%d %d %d\n", 1, 2, n); else printf("-1\n"); } return 0; }
#include <bits/stdc++.h> using namespace std; signed main() { long long t; cin >> t; for (long long test = 0; test < t; test++) { long long n; cin >> n; vector<long long> lst(n); for (long long i = 0; i < n; i++) cin >> lst[i]; bool ok = false; for (long long i = 0; i < n - 2; i++) { if (lst[i] + lst[i + 1] <= lst.back()) { cout << i + 1 << " " << i + 2 << " " << n << "\n"; ok = true; break; } } if (!ok) { cout << -1 << "\n"; } } return 0; }
#include <bits/stdc++.h> using namespace std; const int N = 100010; int n, arr[N]; int main() { int t; cin >> t; while (t--) { scanf("%d", &n); for (int i = 0; i < n; i++) { scanf("%d", &arr[i]); } if (arr[0] + arr[1] <= arr[n - 1]) { cout << 1 << " " << 2 << " " << n << endl; } else cout << -1 << endl; } return 0; }
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); ; int t; cin >> t; while (t) { int n; cin >> n; vector<int> v(n); for (size_t i = 0; i < n; i++) { cin >> v[i]; } int i1, i2, i3; i1 = 0, i2 = 1, i3 = n - 1; if (v[i1] + v[i2] <= v[i3]) { cout << i1 + 1 << " " << i2 + 1 << " " << i3 + 1 << endl; t--; continue; } i2 = n - 2; if (v[i1] + v[i2] <= v[i3]) { cout << i1 + 1 << " " << i2 + 1 << " " << i3 + 1 << endl; t--; continue; } cout << -1 << endl; t--; } }
#include <bits/stdc++.h> using namespace std; int main() { int T; cin >> T; for (int i = 0; i < T; i++) { int N; cin >> N; vector<int> vec(N); for (int j = 0; j < N; j++) { cin >> vec.at(j); } if (vec.at(0) + vec.at(1) <= vec.at(N - 1)) { cout << 1 << " " << 2 << " " << N << endl; } else { cout << -1 << endl; } } }
#include <bits/stdc++.h> using namespace std; double pi = acos(-1); long long i, j; long long mx = (1ll << 48) - 1, fb[100]; bool ff[100010]; long long gcd(long long x, long long y) { return y ? gcd(y, x % y) : x; } long long C(long long n, long long m) { if (m < 0 || m > n) return 0; long long ans = 1; for (long long i = 1; i <= m; i++) ans = ans * (n - m + i) / i; return ans; } long long binaryPow(long long a, long long b) { long long ans = 1; while (b > 0) { if (b & 1) { ans = ans % 998244353 * a; } a = a * a % 998244353; b >>= 1; } return ans % 998244353; } long long niyuan(long long a, long long b) { return (a * binaryPow(b, 998244353 - 2)) % 998244353; } void exgcd(int a, int b, int &d, int &x, int &y) { if (!b) { d = a; x = 1; y = 0; } else { exgcd(b, a % b, d, y, x); y -= x * (a / b); } } long long a[6000005]; void gg() { long long n; scanf("%lld", &n); for (int i = 1; i <= n; i++) { cin >> a[i]; } if (a[1] + a[2] <= a[n]) cout << 1 << ' ' << 2 << ' ' << n << '\n'; else cout << -1 << '\n'; } int main() { long long t; scanf("%lld", &t); while (t--) gg(); }
#include <bits/stdc++.h> using namespace std; using namespace chrono; const long long int MOD = 1000000007; const long long int MAXN = 1000005; const long long int INF = 100000000000005; void solve() { long long int n; cin >> n; vector<long long int> a(n); for (long long int i = 0; i < n; ++i) cin >> a[i]; if (a[0] + a[1] > a[n - 1]) { cout << "-1\n"; return; } cout << "1 2 " << n << endl; } signed main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); long long int t; cin >> t; while (t--) solve(); return 0; }
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); ; int t; cin >> t; while (t--) { int n; cin >> n; long long int a[n], b[n]; for (int i = 0; i < n; i++) { cin >> a[i]; b[i] = a[i]; } sort(a, a + n); int d[3]; d[0] = d[1] = d[2] = -1; if (a[0] + a[1] > a[n - 1]) cout << "-1" << endl; else { for (int i = 0; i < n; i++) { if (b[i] == a[0] && d[0] == -1 && d[1] != i && d[2] != i) d[0] = i; if (b[i] == a[1] && d[0] != i && d[2] != i && d[1] == -1) d[1] = i; if (b[i] == a[n - 1] && d[0] != i && d[1] != i && d[2] == -1) d[2] = i; } sort(d, d + 3); cout << d[0] + 1 << " " << d[1] + 1 << " " << d[2] + 1 << endl; } } return 0; }
#include <bits/stdc++.h> using namespace std; long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; } long long lcm(long long a, long long b) { return (a / gcd(a, b)) * b; } int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); long long t; cin >> t; while (t--) { long long n; cin >> n; vector<long long> a(n); long long c = 0, c1 = 0; long long sum = 0; for (int i = 0; i < n; i++) { cin >> a[i]; } if (a[n - 1] >= (a[0] + a[1])) { cout << 1 << " " << 2 << " " << n << endl; } else { cout << -1 << endl; } } return 0; }