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;...
#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...
#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"; ...
#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"; } i...
#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 " <<...
#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 (in...
#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 mod...
#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 <<...
#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"); ...
#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...
#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]) {...
#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 lo...
#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; ...
#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) ...
#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; } ...
#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; } ...
#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])) { ...
#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\...
#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 << ...
#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]; ...
#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 ...
#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; ...
#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...
#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 = fals...
#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(...
#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 - ...
#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"); } ...
#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...
#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<...
#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 "...
#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 lo...
#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 >> t...
#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) { ...
#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 << '...
#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...
#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> voi...
#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 = (...
#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 ...
#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...
#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...
#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...
#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...
#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:...
#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...
#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); fo...
#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...
#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 ...
#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; ...
#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]) { fla...
#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...
#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" ...
#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 cou...
#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 { ...
#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...
#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...
#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 -...
#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 {...
#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]) { cou...
#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"; el...
#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]; ...
#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 << '...
#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 << "\...
#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 ...
#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; } templa...
#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 <<...
#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, __...
#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...
#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 <<...
#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...
#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]) { ...
#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; retur...
#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 << e...
#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 ...
#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; ...
#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...
#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 ...
#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 << " " <<...
#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...
#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]) { ...
#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++) { ...
#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; } el...
#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; ...
#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 << en...
#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...
#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...
#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...
#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 lo...