solution
stringlengths
11
983k
difficulty
int64
0
21
language
stringclasses
2 values
t=int(input()) for tt in range(t): n=int(input()) a=list(map(int,input().split())) if(a[0]+a[1] > a[n-1]): print(-1) else: print(1,2,n)
7
PYTHON3
for t in range(int(input())): n=int(input()) l=list(map(int,input().split())) c=l[n-1] b=l[1] a=l[0] if a+b<=c or b+c<=a or c+a<=b: print(1,2,n) else: print(-1)
7
PYTHON3
t = int(input()) for _ in range(t): q = int(input()) l = list(map(int, input().split())) if l[0]+l[1] > l[-1]: print(-1) else: print(1, 2, q)
7
PYTHON3
#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(); } }
7
CPP
t = int(input()) for _ in range(t): n = int(input()) a = [int(x) for x in input().split()] if a[0] + a[1] > a[-1]: print(-1) else: print(1, 2, n)
7
PYTHON3
for _ in range(int(input())): n= int(input()) li= list(map(int, input().strip().split())) if(li[0]+li[1]>li[-1]): print(-1) else: print(1,2,n)
7
PYTHON3
import sys #another one inp=sys.stdin.buffer.readline inin=lambda typ=int: typ(inp()) inar=lambda typ=int: [typ(x) for x in inp().split()] inst=lambda : inp().decode().strip() _T_=inin() for _t_ in range(_T_): n=inin() a=inar() if a[0]+a[1]>a[n-1]: print(-1) else: print(1,2,n)
7
PYTHON3
for _ in range(int(input())): n=int(input()) l=list(map(int,input().split())) if l[0]+l[1] > l[-1]: print(-1) else: print(1, 2, len(l))
7
PYTHON3
for _ in range(int(input())): n=int(input()) l=[int(x) for x in input().split()] h=l[0]+l[1] count=0 for i in range(2,n): if(l[i]>=h): count=1 print("1 2",i+1) break if(count==0): print(-1)
7
PYTHON3
# -*- coding: utf-8 -*- """ Created on Tue Aug 18 00:52:21 2020 @author: RACHIT """ def triplet(arr:list): if len(arr)==0: return [-1] if len(arr)==3: if arr[-1]>=arr[0]+arr[1]: return[1,2,3] return [-1] for i in range(len(arr)-1,2,-1): if arr[i]>arr[0]+arr[1]: return [1,2,i+1] return [-1] if __name__=="__main__": t=int(input()) while(t>0): x=int(input()) arr=[int(i) for i in input().split()] ans=triplet(arr) for j in ans: print(j,end=' ') print() t-=1 ''' 4 6 11 11 15 18 20 10 10 10 11 1 1 100000'''
7
PYTHON3
#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; }
7
CPP
for _ in range(int(input())): n=int(input()) a=list(map(int,input().split())) if a[0]<=a[-1]-a[1]: print(1,2,n) elif a[-1]>=a[0]+a[1]: print(1,2,n) else: print(-1)
7
PYTHON3
for _ in range(int(input())): n=int(input()) k=list(map(int,input().split())) if (k[0]+k[1]<=k[n-1]): print(1,2,n) else: print(-1)
7
PYTHON3
def fun(ls,n): prv=ls[0] prv_index=0 for i,val in enumerate(ls[1:-1]): i=i+1 nxt_index=i+1 nxt=ls[nxt_index] if(prv+val<=nxt): print(prv_index+1,i+1,nxt_index+1) return prv=val prv_index=i if(ls[0]+ls[1]<=ls[-1]): print(1,2,n) return print(-1) T = int(input()) for i in range(T): # var=input() val=int(input()) # st=input() # ms= list(map(int, input().split())) # ls= list(map(int, input().split())) st= list(map(int, input().split())) # fun(ls) fun(st,val)
7
PYTHON3
def bad_triangle(arr,n): s=arr[0]+arr[1] if s<=arr[n-1]: print(1,2,n) else: print(-1) t=int(input()) for i in range(t): n=int(input()) li=[int(x) for x in input().split()] bad_triangle(li,n)
7
PYTHON3
t=int(input()) while t: t-=1 b=int(input()) a=input().split(" ") if int(a[0])+int(a[1])>int(a[-1]): print(-1) else: print(1,2,b)
7
PYTHON3
t=int(input()) a=[] b=[] for i in range(t): a.append([]) b.append(int(input())) a[i]=[int(a[i]) for a[i] in input().split()] if(a[i][0]+a[i][1]>a[i][b[i]-1]): print('-1') else: print('1 2',end=' ') print(b[i])
7
PYTHON3
t=int(input()) for i in range(t): n=int(input()) arr=[int(x) for x in input().split()] x=arr[0]+arr[1] flag=False for i in range(2,n): if arr[i]>=x: flag=True print(1,2,i+1) break if flag==False: print(-1)
7
PYTHON3
t = input() t = int(t) def solve(n, arr): a1 = arr[0] a2 = arr[1] for i in range(2, n): if a1+a2<=arr[i]: print(1, 2, i+1) return print(-1) return for i in range(t): n = input() n = int(n) arr = list(map(int, input().split())) solve(n, arr)
7
PYTHON3
for _ in range(int(input())): n=int(input()) a=list(map(int,input().split())) if(a[0]+a[1]>a[-1]): print("-1") else: print(1,2,n)
7
PYTHON3
for _ in range(int(input())): n=int(input()) l=[int(x) for x in input().split()] if l[0]+l[1]<=l[len(l)-1]: print(1,end=" ") print(2,end=" ") print(n) else: print(-1)
7
PYTHON3
t = int(input()) for case in range(t): n = int(input()) arr = [*map(int,input().split())] if arr[0]+arr[1]<=arr[-1]: print(1,2,n) else: print(-1)
7
PYTHON3
#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; }
7
CPP
#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; }
7
CPP
#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; }
7
CPP
# def seg_tree(arr,l,r,seg,ind): # if l==r: # seg[ind] = arr[l] # else: # mid = (l+r)//2 # seg_tree(arr,l,mid,seg,2*ind+1) # seg_tree(arr,mid+1,r,seg,2*ind+2) # seg[ind] = seg[2*ind+1]+seg[2*ind+2] # def get_sum(l1,r1,l2,r2,seg,ind): # if l1==l2 and r1==r2: # return seg[ind] # elif l1 > r1: # return 0 # else: # mid = (l2+r2)//2 # return get_sum(l1,min(r1,mid),l2,mid,seg,2*ind+1) + get_sum(max(l1,mid+1),r1,mid+1,r2,seg,2*ind+2) # def modify(l,r,seg,arr,pos,val,ind): # if l==r: # seg[ind] = val # arr[pos] = val # else: # mid = (l+r)//2 # if pos <= mid: # modify(l,mid,seg,arr,pos,val,2*ind+1) # else: # modify(mid+1,r,seg,arr,pos,val,2*ind+2) # seg[ind] = seg[2*ind+1]+seg[2*ind+2] # n,q = map(int,input().split()) # arr = [0]*n # seg = [None]*(4*len(arr)) # seg_tree(arr,0,len(arr)-1,seg,0) # for i in range(q): # a,b,c = input().split() # if a=="a": # modify(0,len(arr)-1,seg,arr,int(b)-1,(arr[int(b)-1]+int(c))%2,0) # else: # print(int(c)+1-int(b) - get_sum(int(b)-1,int(c)-1,0,len(arr)-1,seg,0)) # def dijksta(graph,edge,n): # Unvisit = {(0,0)} # dist = [0]*n # for i in range(1,n): # Unvisit.add((10000000000,i)) # dist[i] = 10000000000 # while Unvisit: # x = min(Unvisit) # Unvisit.remove(x) # u = x[1] # d = x[0] # for v in graph[u]: # if dist[u] + edge[u][v] < dist[v]: # Unvisit.remove((dist[v],v)) # dist[v] = dist[u] + edge[u][v] # Unvisit.add((dist[v],v)) # return dist[n-1] # def power(x): # if x==0: # return 1 # elif x==1: # return 2 # else: # if x%2==0: # a = power(x//2) # a = a%1000000007 # return (a*a)%1000000007 # else: # a = power(x//2) # a = a%1000000007 # return (2*a*a)%1000000007 for _ in range(int(input())): n = int(input()) arr = list(map(int,input().split())) x = arr[0] y = arr[1] z = arr[-1] if x+y >z: print(-1) else: print(1,2,n)
7
PYTHON3
import sys import math def II(): return int(sys.stdin.readline()) def LI(): return list(map(int, sys.stdin.readline().split())) def MI(): return map(int, sys.stdin.readline().split()) def SI(): return sys.stdin.readline().strip() t = II() for q in range(t): n = II() a = sorted(LI()) if a[0]+a[1]<=a[-1]: print(1,2,n) else: print(-1)
7
PYTHON3
import sys LI=lambda:list(map(int, sys.stdin.readline().strip('\n').split())) MI=lambda:map(int, sys.stdin.readline().strip('\n').split()) SI=lambda:sys.stdin.readline().strip('\n') II=lambda:int(sys.stdin.readline().strip('\n')) for _ in range(II()): n=II() a=LI() if a[0]+a[1]<=a[-1]: print(1, 2, n) else: print(-1)
7
PYTHON3
#!/usr/bin/env python # -*- coding: utf-8 -*- # # untitled.py # # Copyright 2020 Md Sidratul Muntaher Tibrow <[email protected]> # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, # MA 02110-1301, USA. # # def main(args): for i in range(int(input())): c = int(input()) n = list(map(int, input().split(' '))) count = 0 v = [] if n[0] + n[1] > n[-1]: print(-1) else: print(1, 2, c) if __name__ == '__main__': import sys sys.exit(main(sys.argv))
7
PYTHON3
for i in range(int(input())): g = input() a = [0] + list(map(int, input().split())) if a[1] + a[2] <= a[-1]: print(1, 2, g) else: print(-1)
7
PYTHON3
T = int(input()) l = [] for k in range(T): N = int(input()) a = list(map(int, input().split())) f=0 for j in range(1,N-1): if a[0]+a[j]<=a[N-1]: l.append([1,j+1,N]) f=1 break if f==0: l.append([-1]) for k in range(T): if l[k][0]==-1: print (-1) else: print (l[k][0],l[k][1],l[k][2])
7
PYTHON3
for _ in range(int(input())): n=int(input()) l=list(map(int,input().split())) m=max(l) for i in range(0,n-1): if (l[i]+l[i+1])<=m: print(i+1,i+2,n) break else: print(-1)
7
PYTHON3
import sys from collections import defaultdict # input=sys.stdin.readline for _ in range(int(input())): n=int(input()) lis=list(map(int,input().split())) if lis[0]+lis[1]<=lis[-1]: print(1,2,n) else: print(-1) # for i in range(int(input())): # s=input() # l=[] # c=0 # for i in s: # if i=="1": # c+=1 # else: # if c!=0: # l.append(c) # c=0 # if c!=0: # l.append(c) # l.sort(reverse=True) # print(sum(l[::2]))
7
PYTHON3
t = int(input()) anss = [] for _ in range(t): input() l = list(map(int, input().split(sep=' '))) if l[0] + l[1] > l[-1]: anss.append([-1]) else: anss.append([1, 2, len(l)]) for ans in anss: for i in ans: print(i, end = ' ') print()
7
PYTHON3
t = int(input()) a=b=c=0 for i in range(t): f=0 n = int(input()) li = list(map(int,input().split()))[:n] # for j in range(n): # for k in range(j+2,n): # if li[j]+li[j+1]<=li[k]: # a=j+1 # b=j+1+1 # c=k+1 # f=1 # break # if f==1: # break if li[0]+li[1]<=li[len(li)-1]: print(1,2,len(li)) else: print(-1) # if f==1: # print(a,b,c) # else: # print(-1)
7
PYTHON3
import sys t = int(input()) for _ in range(t): n = int(input()) li = list(map(int, input().split()))[:n] if li[0] + li[1] > li[n - 1]: print(-1) else: print(1, 2, n)
7
PYTHON3
for _ in range(int(input())): n=int(input()) data=[int(x) for x in input().split()] if((data[0]+data[1])<=data[n-1]): print(1,2,n) elif((data[n-1]-data[n-2])>=data[0]): print(1,n-1,n) else: print(-1)
7
PYTHON3
#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; }
7
CPP
#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"; } }
7
CPP
# -*- coding: utf-8 -*- """ Created on Sat Aug 15 22:54:54 2020 @author: user """ t=int(input()) for i in range(t): n=int(input()) arr=list(map(int,input().split())) if(arr[0]+arr[1]<=arr[-1]): print("1 2 "+str(n)) else: print(-1)
7
PYTHON3
for _ in range(int(input())): n=int(input()) a=[int(x) for x in input().split()] x=a[0] y=a[1] found=False for i in range(n-2): z=a[2+i] if(x+y<=z): found=True print(1,2,i+3) break if not found:print(-1)
7
PYTHON3
for _ in range(int(input())): n = int(input()) a = list(map(int, input().split())) a.sort() if a[0] + a[1] <= a[-1]: print(1, 2, n) elif a[0] >= a[-2] + a[-1]: print(1, n-1, n) else: print(-1)
7
PYTHON3
t=int(input()) while(t): n=int(input()) a=list(map(int,input().split())) b,c,e=a[0],a[1],a[-1] if(b+c<=e): print("1 2 %d"%(n)) else: print("-1") t-=1
7
PYTHON3
import math m=1000000007 def fact(n): ans=1 for i in range(1,n+1): ans=((ans%m)*(i%m))%m return ans def power_2(n): ans=1 for i in range(n): ans=((ans%m)*(2))%m return ans for z in range(int(input())): n=int(input()) flag=True a=[int(i) for i in input().split()] for i in range(n-2): if(a[i]+a[i+1]<=a[n-1]): flag=False print(i+1,i+2,n) break if(flag): print("-1")
7
PYTHON3
t = int (input ()) inn =[] result=[] c=0 for j in range(t): n = int (input()) inn = [int (a) for a in input().split()] if ((((inn[0]+inn[1])>inn[n-1]) & ((inn[0]+inn[n-1])>inn[1]) & ((inn[1]+inn[n-1])>inn[0])) & (((inn[n-1]+inn[n-2])>inn[0]) & ((inn[n-1]+inn[0])>inn[n-2]) & ((inn[0]+inn[n-2])>inn[n-1]))): result.append("-1") else: result.append([1,2,n]) for i in result: if (type(i) == list): for j in i: if (c!=(len(i)-1)): print(j, end=' ') c=c+1 else: print(j) c=0 else: print(i)
7
PYTHON3
#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'; } }
7
CPP
import math import sys from collections import Counter from math import factorial as fact from collections import defaultdict def inpint(): return int(input()) def inpstr(): return str(input()) def inparr(): return list(map(int,input().strip().split())) def inptup(): return map(int,input().strip().split()) #---------------------------------------------------------------------------- for _ in range(int(input())): n = int(input()) a = list(map(int,input().split())) if a[0]+a[1]<=a[-1]: print(1,2,n) else: print(-1)
7
PYTHON3
n=int(input()) for i in range(n): flag=0 m=int(input()) a=[int(x) for x in input().split()] if a[0]+a[1]<=a[-1]: print(1,2,m) else: print(-1)
7
PYTHON3
for _ in range(int(input())): n = int(input()) a = list(map(int, input().split())) if a[0]+a[1]<=a[-1]: print(1,2,n) else: print(-1)
7
PYTHON3
#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; }
7
CPP
#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'; } }
7
CPP
t = int(input()) while t: n = int(input()) sides = list(map(int, input().split())) if sides[0] + sides[1] > sides[-1]: print(-1) else: print(1, 2, n) t -= 1
7
PYTHON3
#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; }
7
CPP
#list (map(int, input().split())) rw = int(input()) for qwe in range(rw): n = int(input()) a = list(map(int, input().split())) a.reverse() if a[0] >= a[n - 2] + a[n - 1]: print(1, 2, n) else: print(-1)
7
PYTHON3
t = int(input()) for _ in range(t): n = int(input()) arr = [int(i) for i in input().split()] if arr[0]+arr[1] <= arr[-1]: print(0+1,1+1,n) else: print(-1)
7
PYTHON3
def main(): for _ in range(int(input())): n = int(input()) a = list(map(int,input().split())) if (a[0]+a[1])<=a[-1]: print(1,2,n) else: print(-1) if __name__ == '__main__': main()
7
PYTHON3
for _ in range(int(input())): n = int(input()) a = list(map(int, input().split())) if a[0] + a[1] <= a[n-1]: print("1 2 " + str(n)) else: print(-1)
7
PYTHON3
T = int(input()) for t in range(T): n = int(input()) a = [int(x) for x in input().split(' ')] if a[0]+a[1] <= a[-1]: print(1, 2, n) else: print(-1)
7
PYTHON3
t=int(input()) while(t>0): t-=1 n=int(input()) a=list(map(int,input().split())) if a[0]+a[1]>a[-1]: print(-1) else: print(1,2,n)
7
PYTHON3
#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(); } }
7
CPP
try: t=int(input()) for _ in range(t): n=int(input()) flag=0 a=list(map(int,input().split())) if a[-1] >= a[0]+a[1]: print(1,2,n) else: print(-1) except: pass
7
PYTHON3
t = int(input()) while t > 0: n = int(input()) lis = [int(a) for a in input().split()] i = 0 j = n-1 istrue = True while(j >= 2) and istrue: while(i <= j-2) and istrue: if(lis[j] >= lis[i]+lis[i+1]): print(i+1, i+2, j+1) istrue = False break i += 1 j -= 1 if(istrue): print(-1) t -= 1
7
PYTHON3
n = int(input()) for i in range(n): y = int(input()) a = list(map(int, input().split())) p = 0 q = 0 for k in range(2, y): if(a[0]+a[1]<=a[k]): p = 1 q = k+1 break if(p==0): print(-1) else: print(p, p+1, q)
7
PYTHON3
for _ in range(int(input())): N=int(input()) a=list(map(int,input().split())) x=a[0]+a[1] flag=0 for i in range(2,len(a)): if(a[i]>=x): print(1,2,i+1) flag=1 break if(flag==0): print(-1)
7
PYTHON3
import sys #another one inp=sys.stdin.buffer.readline inin=lambda : int(inp()) inar=lambda typ=int: list(map(typ,inp().split())) inst=lambda : inp().decode().strip() _T_=inin() for _t_ in range(_T_): n=inin() a=inar() if a[0]+a[1]>a[n-1]: print(-1) else: print(1,2,n)
7
PYTHON3
#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; }
7
CPP
for _ in range(int(input())): input() a = list(map(int,input().split())) if a[0]+a[1]<=a[-1]:print(1,2,len(a)) else:print(-1)
7
PYTHON3
for _ in range(int(input())): n = int(input()) *arr, = map(int, input().split()) # indices= sorted(range(n), key=lambda idx: arr[idx]) if arr[0] + arr[1] <= arr[-1]: print(1, 2, len(arr)) else: print(-1)
7
PYTHON3
for t in range(int(input())): n=int(input()) l=[int(i) for i in input().split()] if l[0]+l[1]>l[n-1]: print(-1) else: print(1,2,n)
7
PYTHON3
for _ in range(int(input())): n = int(input()) arr = list(map(int, input().split())) if arr[0]+arr[1]<=arr[n-1]: print(1,2,n) else: print("-1")
7
PYTHON3
for t in range(int(input())): n=int(input()) a=[int(i) for i in input().split()] x=1 if a[0]+a[1]<=a[n-1]: print(1,2,n) else: print(-1)
7
PYTHON3
a = int(input()) for i in range(a): b = int(input()) c = list(map(int,input().split())) if c[0] + c[1] > c[-1]: print(-1) else: print(1, 2, len(c))
7
PYTHON3
#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; } }
7
CPP
def findTriangle(arr,n): if n < 3: return -1 i = 0 j = 1 k = 2 while k < n-1: if (arr[i]+arr[j] <= arr[k]) or (arr[j]+arr[k] <= arr[i]) or (arr[i]+arr[k] <= arr[j]): return str(i+1)+" "+str(j+1)+" "+str(k+1) k+=1 while j<n-2: if (arr[i]+arr[j] <= arr[k]) or (arr[j]+arr[k] <= arr[i]) or (arr[i]+arr[k] <= arr[j]): return str(i+1)+" "+str(j+1)+" "+str(k+1) j+=1 while i<n-2: if (arr[i]+arr[j] <= arr[k]) or (arr[j]+arr[k] <= arr[i]) or (arr[i]+arr[k] <= arr[j]): return str(i+1)+" "+str(j+1)+" "+str(k+1) i+=1 return -1 t = int(input()) main_arr = [] n_s = [] for a in range(0,t): n = int(input()) n_s.append(n) arr = input().rstrip().split(" ") for b in range(0,n): arr[b] = int(arr[b]) main_arr.append(arr) for c in range(0,t): print(findTriangle(main_arr[c],n_s[c]))
7
PYTHON3
t=int(input()) while(t>0): n=int(input()) l=list(map(int,input().split())) s=l[0]+l[1] for i in range(2,n): if l[i]>=s: print(1,2,i+1) break else: print(-1) t-=1
7
PYTHON3
for _ in range(int(input())): n = int(input()) l = list(map(int, input().split())) if(l[0]+l[1] > l[-1]): print(-1) else: print(1,2,n)
7
PYTHON3
t=int(input()) for _ in range(t): n = int(input()) ar=list(map(int,input().split())) if(ar[0]+ar[1]<=ar[n-1]): print('1 2',end=' ') print(n) else: print('-1')
7
PYTHON3
import math import time from collections import defaultdict,deque,Counter from sys import stdin,stdout from bisect import bisect_left,bisect_right from queue import PriorityQueue import sys t=1 t=int(input()) for _ in range(t): n=int(input()) a=list(map(int,stdin.readline().split())) if(a[-1]>=a[0]+a[1]): print(1,2,n) else: print(-1)
7
PYTHON3
t=int(input()) for i in range(t): n=int(input()) a=[int(i) for i in input().split()] v=a[0]+a[1] a=a[2:] f=0 for i in range(len(a)): if(v<=a[i]): print("1 2",i+3,end='\n') f=1 break if(not f): print("-1",end='\n')
7
PYTHON3
def f(k,arr): #assert (j==len(arr)) a=arr[0] b=arr[1] for i in range(k): if arr[i]>=(a+b): return('1 2 '+str(i+1)) return '-1' a=input() n=int(a) for i in range(n): j=int(input()) a=list(map(int,input().rstrip().split())) print(f(j,a))
7
PYTHON3
from sys import stdin def main(): input = lambda: stdin.readline()[:-1] T = int(input()) for _ in [0] * T: N = int(input()) A = list(map(int, input().split())) if A[0] + A[1] <= A[-1]: print(1, 2, N) else: print(-1) main()
7
PYTHON3
import sys from math import ceil, factorial, gcd #from math import comb, perm only in python3 from collections import Counter, deque, defaultdict from bisect import bisect_left, bisect_right from heapq import heappop, heappush, heapify MOD = 10**9 + 7 INF = float('inf') rl = lambda : list(map(int, sys.stdin.readline().split())) rs = lambda : sys.stdin.readline().strip() for _ in range(int(input())): n = int(input()) A = rl() print(1, 2, n) if A[0] + A[1] <= A[-1] else print(-1)
7
PYTHON3
for t in range(int(input())): n = int(input()) a = list(map(int,input().split(" "))) a.sort() if a[0]+a[1] > a[n-1]: print(-1) else: print(1,2,n)
7
PYTHON3
def sum(n,a): if a[0]+a[1]<=a[n-1]: print(1,2,n,"\n") else: print(-1,"\n") t=int(input()) for e in range (t): n=int(input()) a=list(map(int,input().split())) sum(n,a)
7
PYTHON3
for i in range(int(input())): n = int(input()) a = list(map(int,input().split())) if a[0]+a[1]<=a[-1]: print(1,2,len(a)) else: print(-1)
7
PYTHON3
for _ in range(int(input())): n=int(input()) d={} l=[int(i) for i in input().split()] mn=10000000000000 idx=0 for i in range(n): if l[i]<mn: mn=l[i] idx=i d[idx]=l[idx] mn=10000000000000 idx=-1 for i in range(n): if i not in d: if l[i]<mn: mn=l[i] idx=i d[idx]=l[idx] c=max(l) d[l.index(c)]=c r=sorted(d.keys()) p=sorted(d.values()) if p[0]+p[1]>p[-1]: print(-1) else: for i in r: print(i+1,end=' ') print()
7
PYTHON3
#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; }
7
CPP
for i1 in range(int(input())): n=int(input()) a=list(map(int,input().split())) t1=a[0] t2=a[1] t3=a[-1] if t3>=(t1+t2): print(1,2,n) continue else: print(-1)
7
PYTHON3
for _ in range(int(input())): n = int(input()) a = [*map(int,input().split())] ok = 0 for i in range(2,n): if(a[i]>=a[0]+a[1]): print(1,2,i+1) ok = 1 break if(not ok): print(-1)
7
PYTHON3
import math, sys from collections import defaultdict, Counter, deque INF = float('inf') MOD = (10 ** 9) + 7 def gcd(a, b): while b: a, b = b, a%b return a def isPrime(n): if (n <= 1): return False i = 2 while i ** 2 <= n: if n % i == 0: return False i += 1 return True def primeFactors(n): factors = [] i = 2 while i ** 2 <= n: while n % i == 0: factors.append(i) n //= i i += 1 if n > 1: factors.append(n) return factors def vars(): return map(int, input().split()) def array(): return list(map(int, input().split())) def main(): n = int(input()) arr = array() if arr[0] + arr[1] <= arr[-1]: print(1, 2, n) else: print(-1) if __name__ == "__main__": t = 1 t = int(input()) for _ in range(t): main()
7
PYTHON3
# cook your dish here from sys import stdin, stdout import math from itertools import permutations, combinations from collections import defaultdict from bisect import bisect_left from bisect import bisect_right def L(): return list(map(int, stdin.readline().split())) def In(): return map(int, stdin.readline().split()) def I(): return int(stdin.readline()) P = 1000000007 def main(): for t in range(I()): n = I() arr = L() if arr[0]+arr[1] <= arr[n-1]: print(1, 2, n) else: print(-1) if __name__ == '__main__': main()
7
PYTHON3
for _ in range(int(input())): le = int(input()) f, s, *_, la = [int(i) for i in input().split()] print(1, 2, le) if f + s <= la else print(-1)
7
PYTHON3
#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"; } }
7
CPP
import sys input = sys.stdin.readline I = lambda : list(map(int,input().split())) t,=I() for _ in range(t): n,=I() l=I() an=-1 i=0 if n>=3 and l[i]+l[i+1]<=l[n-1]: print(1,2,n) else: print(-1)
7
PYTHON3
t=int(input()) for i in range(t): n=int(input()) a=list(map(int,input().split())) i,j,k=0,1,2 flag=0 while(i<n and j<n and k<n): if(a[i]+a[j]<=a[k]): flag=1 break else: k+=1 if(flag==1): print(i+1,j+1,k+1) else: print(-1)
7
PYTHON3
import sys import math import heapq import collections fast_reader = sys.stdin.readline fast_writer = sys.stdout.write def input(): return fast_reader().strip() def print(*argv): fast_writer(' '.join((str(i)) for i in argv)) fast_writer('\n') def printspace(*argv): fast_writer(' '.join((str(i)) for i in argv)) fast_writer(' ') def inputnum(): return(int(input())) def inputnums(): return(map(int,input().split())) def inputlist(): return(list(map(int,input().split()))) def inputstring(): return([x for x in input()]) def inputmatrixchar(rows): arr2d = [[j for j in input().strip()] for i in range(rows)] return arr2d def inputmatrixint(rows): arr2d = [] for _ in range(rows): arr2d.append([int(i) for i in input().split()]) return arr2d t = int(input()) for q in range(t): n = inputnum() a = inputlist() if a[0]+a[1] > a[n-1]: print(-1) else: print(1, 2, n)
7
PYTHON3
T=int(input()) for _ in range(T): N=int(input()) A=list(map(int,input().split())) if A[1]+A[0]<=A[-1]: print(1,2,N) else: print(-1)
7
PYTHON3
from math import * import sys, random def nextInt(): return int(input()) def nextStrs(): return input().split() def nextInts(): return list(map(int,nextStrs())) def can(i,j,k): if i+j > k: return True return False def main(): t = nextInt() while t > 0: n = nextInt() arr = nextInts() if can(arr[0],arr[1],arr[n-1]): print(-1) else: print(1,2,n) t-=1 if __name__ == '__main__': exit(main())
7
PYTHON3
import collections as cc I=lambda:list(map(int,input().split())) for tc in range(int(input())): n,=I() l=sorted(I()) if (l[0]+l[1]<=l[-1]): print(1,2,n) else: print(-1)
7
PYTHON3
def checker(n, lst): if lst[0] + lst[1] <= lst[-1]: return 1, 2, n return -1, for _ in range(int(input())): m = int(input()) a = [int(i) for i in input().split()] print(*checker(m, a))
7
PYTHON3