solution
stringlengths 11
983k
| difficulty
int64 0
21
| language
stringclasses 2
values |
---|---|---|
T=int(input())
for _ in range(T):
n=int(input())
arr=list(map(int,input().split()))
if n==3:
if arr[0]+arr[1]>arr[2]:
print(-1)
else:
print(1,2,3)
else:
f1=1
for i in range(n-1):
f=1
if arr[i]+arr[i+1]<=arr[-1]:
f=0
x,y,z=i+1,i+2,n
if f:
continue
else:
f1=0
break
if f1:
print(-1)
else:
print(x,y,z)
| 7 | PYTHON3 |
mod = 10**9 + 7
def solve():
n = int(input())
a = list(map(int, input().split()))
if a[0] + a[1] <= a[n - 1]:
print(1, 2, n)
else:
print(-1)
t = 1
t = int(input())
for _ in range(t):
solve() | 7 | PYTHON3 |
t=int(input())
for i in range(t):
n=int(input())
a=list(map(int,input().strip().split(" ")))
p=a[0];q=a[1];r=a[n-1]
if p+q>r and p+r>q and q+r>p:
print(-1)
else:
print(1,2,n)
| 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,n,sep = ' ')
else:
print(-1)
| 7 | PYTHON3 |
t = int(input())
for i in range(t):
n = int(input())
a = list(map(int, input().split()))
c = a[0] + a[1]
ans = False
for i in range(2, n):
if c <= a[i]:
print(1, 2, i+1)
ans = True
break
if not ans:
print(-1) | 7 | PYTHON3 |
t = int(input())
for _ in range(t):
n = int(input())
a = list(map(int, input().split()))
# print(a)
x = a[0]
y = a[1]
res = 0
for i in range(n-1, 1, -1):
if x + y <= a[i]:
res = i+1
break
if res == 0:
print(-1)
else:
print('1 2', res)
| 7 | PYTHON3 |
for _ in range(int(input())):
n=int(input())
ar=list(map(int,input().split()))
flg=1
for i in range(n-2):
if ar[i]+ar[i+1]<=ar[n-1]:
flg=0
print(i+1,i+2,n)
break
if flg:
print(-1)
| 7 | PYTHON3 |
def solve(a, n):
for i in range(n - 2):
j = i + 1
k = n - 1
if a[i] + a[j] <= a[k]:
print(f"{i+1} {j+1} {k+1}")
return
print(-1)
t = int(input())
for _ in range(t):
n = int(input())
a = list(map(int, input().split()))
solve(a, n)
| 7 | PYTHON3 |
for i in range (int(input())):
n=int(input())
a=list(map(int,input().split()))
k=-1
for i in range (n):
if a[i]>=a[0]+a[1]:
k=i+1
break
if k==-1:
print(k)
else:
print('1 2 '+str(k)) | 7 | PYTHON3 |
t = int(input())
for i in range(t):
n = int(input())
arr = [int(x) for x in input().split()]
if (arr[0] + arr[1] > arr[n - 1]):
print("-1")
else:
print(1,2,n)
| 7 | PYTHON3 |
#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;
}
| 7 | CPP |
T = int(input())
for _ in range(T):
n = int(input())
arr = list(map(int, input().split()))
if arr[0]+arr[1] <= arr[n-1]:
print(f"{1} {2} {n}")
else:
print(-1) | 7 | PYTHON3 |
def fun():
n = int(input())
a = list(map(int, input().split()))
if a[n-1] < (a[0] + a[1]):
print('-1')
else:
print('1 2 '+ str(n))
for i in range(int(input())):
fun() | 7 | PYTHON3 |
for _ in range(int(input())):
n = int(input())
l = list(map(int, input().split()))
if l[0] + l[1] <= l[n - 1]:
print(1,end=" ")
print(2,end=" ")
print(n)
else:
print(-1) | 7 | PYTHON3 |
#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();
}
}
| 7 | CPP |
#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;
}
}
| 7 | CPP |
t=int(input())
for p in range(t):
n=int(input())
x=[int(x) for x in input().split()]
i,j,k=0,1,n-1
a,b,c=x[i],x[j],x[k]
if (a+b)>c:
print(-1)
else:
print(i+1,j+1,k+1) | 7 | PYTHON3 |
"""T=int(input())
for _ in range(0,T):
n=int(input())
a,b=map(int,input().split())
s=input()
s=[int(x) for x in input().split()]
for i in range(0,len(s)):
a,b=map(int,input().split())"""
T=int(input())
for _ in range(0,T):
n=int(input())
s=[int(x) for x in input().split()]
if((s[0]+s[1])<=s[-1]):
print(1,2,n)
else:
print(-1)
| 7 | PYTHON3 |
def findTr(n,a):
apb = a[0]+a[1]
c = a[-1]
if apb<=c: print(1,2,n)
else: print(-1)
return
t = int(input())
for i in range(t):
n = int(input())
a = list(map(int, input().split()))
findTr(n,a) | 7 | PYTHON3 |
#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;
}
| 7 | CPP |
import bisect
def solve(arr,n,ans):
for j in range(1,n):
total = arr[j]+arr[0]
k = bisect.bisect(arr,total-1)
if k != len(arr):
ans.append('1'+' '+str(j+1)+' '+str(k+1))
return
ans.append('-1')
def main():
t = int(input())
ans = []
for i in range(t):
n = int(input())
arr = list(map(int,input().split()))
solve(arr,n,ans)
print('\n'.join(ans))
main()
| 7 | PYTHON3 |
for _ in 'T' * int(input()):
n = int(input())
*k, = [int(x) for x in input().split()]
if k[0] + k[1] <= k[-1]:
print(1, 2, n)
else:
print(-1) | 7 | PYTHON3 |
#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);
}
}
| 7 | CPP |
import sys
input=sys.stdin.readline
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 |
from functools import lru_cache
from sys import stdin, stdout
import sys
from math import *
# from collections import deque
# sys.setrecursionlimit(int(2e5))
input = stdin.readline
# print = stdout.write
# dp=[-1]*100000
for __ in range(int(input())):
n=int(input())
ar=list(map(int,input().split()))
x=0
y=n-1
ans=[]
while(x+1<y):
if(ar[x]+ar[x+1]<=ar[y]):
ans=[x+1,x+2,y+1]
break
x+=1
y-=1
if(len(ans)==0):
print(-1)
else:
print(*ans)
| 7 | PYTHON3 |
#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;
}
| 7 | CPP |
#!/usr/bin/env python
# coding: utf-8
# In[15]:
t = int(input())
for i in range(t):
n = int(input())
a = list(map(int , input().split()))
if sum(a[:2]) > a[-1]:
print(-1)
else:
print(1 , 2 , len(a))
# In[ ]:
| 7 | PYTHON3 |
#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;
}
| 7 | CPP |
t=int(input())
for _ in range(t):
n = int(input())
nums = list(map(int, input().split()))
flag=0
for i in range(len(nums)-2):
x = nums[i] + nums[i+1]
if nums[-1] >= x:
print(i+1, i+2, len(nums))
flag=1
break
if (flag==0):
print(-1)
| 7 | PYTHON3 |
for _ in range(int(input())):
n=int(input())
num=[int(x) for x in input().split()]
s=num[0]+num[1]
#print(s)
for i in range(2,n):
#print(num[i])
if s<=num[i]:
print(1,2,i+1)
break
else:
print(-1)
| 7 | PYTHON3 |
t=int(input())
for _ in range(t):
n=int(input())
list1=list(int(n) for n in input().split())
if(list1[0]+list1[1]<=list1[-1]):
print(1,2,n)
else:
print(-1) | 7 | PYTHON3 |
import sys #another one
inp=sys.stdin.buffer.readline
inin=lambda typ=int: typ(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 |
for _ in range(int(input())):
n, *l = input(), *map(int, input().split())
print(' '.join(['1', '2', n]) if l[0]+l[1]<=l[-1] else -1) | 7 | PYTHON3 |
def main():
test=int(input())
for _ in range(test):
l=int(input())
arr=list(map(int,input().split()))
sum=arr[0]+arr[1]
if arr[-1]>=sum:
print(1,2,l)
else:
print(-1)
main() | 7 | PYTHON3 |
for _ in range(int(input())):
n = int(input())
arr = list(map(int,input().split()))
if arr[0]+arr[1]<=arr[-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()))
if ((a[0] + a[1]) > a[-1]):
print(-1)
else:
print(1,2,n) | 7 | PYTHON3 |
n = int(input())
for i in range(n):
m = int(input())
s = input().split(' ')
a = []
for c in s:
a.append(int(c))
a.sort()
if a[len(a) - 1] >= (a[0] + a[1]):
print(1, 2, len(a))
else:
print(-1)
| 7 | PYTHON3 |
for _ in range(int(input())):
n=int(input())
# flag=0
a=list(map(int,input().split()))
x=a[0]
s1=1
# a.remove(x)
y=a[1]
s2=2
# a.remove(y)
z=a[-1]
s3=n
# a.remove(z)
#print(x,y,z)
if len(set(a))!=1 and x+y<=z or y+z<=x or x+z<=y:
print(s1,s2,s3)
else:
print(-1)
| 7 | PYTHON3 |
for _ in range(int(input())):
n=int(input())
alist=list(map(int,input().split()))
flag=0
a=alist[0]+alist[1]
c=0
for i in range(2,n):
if(a<=alist[i]):
c=i+1
flag=1
break
if(flag==1):
print("1","2",c)
else:
print("-1") | 7 | PYTHON3 |
import sys
from os import path
if(path.exists('input.txt')):
sys.stdin = open("input.txt","r")
sys.stdout = open("output.txt","w")
def solve():
n = int(input().strip())
a = [int(i) for i in input().rstrip().split()]
if(a[-1] - a[0] - a[1]) >= 0 :
print(f"1 2 {n}" )
else:
print(-1)
def main():
tc = int(input().strip())
for case in range(tc):
solve()
if __name__ == '__main__':
main()
| 7 | PYTHON3 |
for _ in range(int(input())):
n=int(input())
lis=list(map(int,input().split()))
if lis[0]+lis[1]>lis[-1]:
print(-1)
else:
print(1,2,n) | 7 | PYTHON3 |
import sys
inp=sys.stdin.readline
inin=lambda typ=int: typ(inp())
inar=lambda typ=int: list(map(typ,inp().split()))
inst=lambda : inp().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 |
# import sys
# sys.stdin = open('CF_E93_D2/input.txt', 'r')
# sys.stdout = open('CF_E93_D2/output.txt', 'w')
#----------------------------------------------------------------
for _ in range(int(input())) :
n = int(input())
l = list(map(int,input().split()))
i = 1
if not (l[i-1]+l[i]>l[-1] and l[i]+l[-1]>l[i] and l[-1]+l[i-1]>l[i]) :
print(1,2,n)
else :
print(-1)
| 7 | PYTHON3 |
for t 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, l = int(input()), list(map(int, input().split()))
if l[0]+l[1]<=l[n-1]: print(1, 2, n)
else: print(-1)
| 7 | PYTHON3 |
t = int(input())
for i in range(t):
n = int(input())
nums = list(map(lambda x: int(x),input().split()))
if nums[0] + nums[1] <= nums[n-1]:
print(1, 2, n)
else:
print(-1) | 7 | PYTHON3 |
"""
Code of Ayush Tiwari
Codeforces: servermonk
Codechef: ayush572000
"""
import sys
input = sys.stdin.buffer.readline
def solution():
# This is the main code
n=int(input())
l=list(map(int,input().split()))
i=0
k=n-1
j=1
if(l[i]+l[j]<=l[k]):
print(i+1,j+1,k+1)
else:
print(-1)
t=int(input())
for _ in range(t):
solution() | 7 | PYTHON3 |
import math
import sys
import re
n = int(input())
for x in range(n):
l = int(input())
a = list(map(int , input().rstrip().split()))
if a[0] + a[1] > a[-1]:
print(-1)
else:
print(1,2,l) | 7 | PYTHON3 |
t=int(input())
for T in range(t):
n=int(input())
a=list(map(int,input().split()))
if(a[0]+a[1]<=a[n-1]):
print(1,2,n)
else:
print(-1) | 7 | PYTHON3 |
n = input()
for i in range(int(n)):
a = int(input())
li = []
li = input().split()
if int(li[0]) + int(li[1]) <= int(li[a-1]):
print(str(1) + " " + str(2) + " " + str(a))
else:
print("-1")
| 7 | PYTHON3 |
T = int(input())
for i in range(T):
N = int(input())
A = list(map(int, input().split()))
z = A[0] + A[1]
flag = 0
for j in range(2,N):
if A[j]>=z:
flag = 1
break
if flag==1:
print(1, 2, j+1)
else:
print(-1) | 7 | PYTHON3 |
# Design_by_JOKER
from math import *
from cmath import *
from itertools import *
from decimal import * # su dung voi so thuc
from fractions import * # su dung voi phan so
from sys import *
# getcontext().prec = x # lay x-1 chu so sau giay phay ( thuoc decimal)
# Decimal('12.3') la 12.3 nhung Decimal(12.3) la 12.30000000012
# Fraction(a) # tra ra phan so bang a (Fraction('1.23') la 123/100 Fraction(1.23) la so khac (thuoc Fraction)
# a = complex(c, d) a = c + d(i) (c = a.real, d = a.imag)
# a.capitalize() bien ki tu dau cua a(string) thanh chu hoa, a.lower() bien a thanh chu thuong, tuong tu voi a.upper()
# a.swapcase() doi nguoc hoa thuong, a.title() bien chu hoa sau dau cach, a.replace('a', 'b', slg)
# a.join['a', 'b', 'c'] = 'a'a'b'a'c, a.strip('a') bo dau va cuoi ki tu 'a'(rstrip, lstrip)
# a.split('a', slg = -1) cat theo ki tu 'a' slg lan(rsplit(), lsplit()), a.count('aa', dau = 0, cuoi= len(a)) dem slg
# a.startswith('a', dau = 0, cuoi = len(a)) co bat dau bang 'a' ko(tuong tu endswith())
# a.index("aa") vi tri dau tien xuat hien (rfind())
# input = open(".inp", mode='r') a = input.readline()
# out = open(".out", mode='w')# a.index(val)
for _ in range(int(input())):
n = int(input())
a = [int(x) for x in input().split()]
ok = 0
for x in range(2, n):
if a[x] >= a[0] + a[1]:
print(1, 2, x+1)
ok = 1
break
if not ok:
print(-1) | 7 | PYTHON3 |
t = int(input())
for _ in range(t):
n = int(input())
arr = list(map(int,input().split()))
if arr[0] + arr[1] <= arr[-1]:
print(1,2,n)
else:
print(-1) | 7 | PYTHON3 |
t=int(input())
while(t):
n=int(input())
a=list(map(int,input().split()))
if n>2:
flag=0
for i in range(len(a)-2):
if(a[i]+a[i+1]>a[n-1]):
continue
else:
flag=1
print(i+1,end=" ")
print(i+2,end=" ")
print(n)
break
if(flag!=1):
print("-1")
t=t-1 | 7 | PYTHON3 |
for _ in range(int(input())):
rets = [-1]
lens = int(input())
arrs = sorted([int(x) for x in input().split()])
if arrs[0] + arrs[1] <= arrs[-1]:
rets = [1, 2, lens]
print(*rets) | 7 | PYTHON3 |
n=int(input())
for i in range(n):
m=int(input())
a=[int(i) for i in input().split()]
a=sorted(a)
if((a[0]+a[1])>a[len(a)-1] and (a[len(a)-1]-a[1])<a[0]):
print(-1)
else:
print(1,2,len(a)) | 7 | PYTHON3 |
for i in range(int(input())):
n=int(input())
l=list(map(int,input().split()))
sum1=l[0]+l[1]
zero=0
for j in range(2,n):
if l[j]>=sum1:
print(1,2,j+1)
zero=1
break
if zero==0:
print('-1') | 7 | PYTHON3 |
def bins(lo, hi, a, val):
while lo < hi:
mid = (lo+hi) // 2
if val <= a[mid]:
return mid
else:
lo = mid + 1
return lo
t = int(input())
for i in range(t):
n = int(input())
arr = list(map(int, input().split()))
chk = 1
s = arr[0] + arr[1]
idx = bins(2, n-1, arr, s)
ss = arr[idx]
if s <= ss:
print(1, 2, idx+1)
else:
print(-1)
| 7 | PYTHON3 |
for i in range(int(input())):
n = int(input())
m = list(map(int, input().split()))
if n < 3: rez = (-1)
elif m[0]+m[1] > m[-1]: rez = (-1)
else: rez = 1, 2, len(m)
if rez == -1: print(rez)
else: print(*rez)
| 7 | PYTHON3 |
# import sys
# sys.stdin = open('input.txt', 'r')
# sys.stdout = open('output.txt', 'w')
t = 1
t = int(input())
while t:
t -= 1
n = int(input())
a = list(map(int, input().split()))
# s = input()
if a[0] + a[1] > a[-1]:
print(-1)
else:
print(1,2,n)
| 7 | PYTHON3 |
for _ in range(int(input())):n,a = int(input()),list(map(int,input().split()));print(1,2,n) if a[0]+a[1] <= a[-1] else print(-1) | 7 | PYTHON3 |
#: Author - Soumya Saurav
import sys,io,os,time
from collections import defaultdict
from collections import OrderedDict
from collections import deque
from itertools import combinations
from itertools import permutations
import bisect,math,heapq
alphabet = "abcdefghijklmnopqrstuvwxyz"
input = sys.stdin.readline
########################################
for ii in range(int(input())):
n = int(input())
arr = list(map(int , input().split()))
if arr[0] + arr[1] > arr[n-1]:
print(-1)
else:
print(1,2,n)
| 7 | PYTHON3 |
import sys
def minp():
return sys.stdin.readline().strip()
def mint():
return int(minp())
def mints():
return map(int, minp().split())
def solve():
n = mint()
d = [None]*n
i = 0
for v in mints():
d[i] = (v, i+1)
i += 1
d.sort()
a, b, c = d[0],d[1],d[-1]
if a[0]+b[0] <= c[0]:
print(*sorted([a[1],b[1],c[1]]))
else:
print(-1)
for i in range(mint()):
solve()
| 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 |
n = int(input())
for i in range(n):
k = int(input())
a = [int(x) for x in input().split()]
if a[0] + a[1] > a[-1]:
print(-1)
else:
print(1, 2, k) | 7 | PYTHON3 |
def main():
n = int(input())
arr = list(map(int, input().split()))
if arr[0] + arr[1] <= arr[n-1]:
print("1 2 {}".format(n))
else:
print("-1")
for _ in range(int(input())):
main()
| 7 | PYTHON3 |
t = int(input())
while t:
n = int(input())
a = [int(i) for i in input().split()]
val1 = a[0]+a[1]
if val1<=a[-1]:
print(1,2,n)
else:
print(-1)
t-=1 | 7 | PYTHON3 |
t=int(input())
for i in range(t):
n=int(input())
a=list(map(int,input().split()))
if((a[0]+a[1])<=a[-1]):
print("1 2 "+str(n))
else:
print(-1) | 7 | PYTHON3 |
for _ in range(int(input())):
n = int(input())
arr = list(map(int, input().split()))
present = dict()
# for ind, a in enumerate(arr):
# if not present.get(a):
# present[a] = ind
# arr = list(present.keys())
if arr[0] + arr[1] <= arr[-1]:
print(1, 2, len(arr))
else:
print(-1)
| 7 | PYTHON3 |
# ------------------- fast io --------------------
import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192
class FastIO(IOBase):
newlines = 0
def __init__(self, file):
self._fd = file.fileno()
self.buffer = BytesIO()
self.writable = "x" in file.mode or "r" not in file.mode
self.write = self.buffer.write if self.writable else None
def read(self):
while True:
b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
if not b:
break
ptr = self.buffer.tell()
self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
self.newlines = 0
return self.buffer.read()
def readline(self):
while self.newlines == 0:
b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
self.newlines = b.count(b"\n") + (not b)
ptr = self.buffer.tell()
self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
self.newlines -= 1
return self.buffer.readline()
def flush(self):
if self.writable:
os.write(self._fd, self.buffer.getvalue())
self.buffer.truncate(0), self.buffer.seek(0)
class IOWrapper(IOBase):
def __init__(self, file):
self.buffer = FastIO(file)
self.flush = self.buffer.flush
self.writable = self.buffer.writable
self.write = lambda s: self.buffer.write(s.encode("ascii"))
self.read = lambda: self.buffer.read().decode("ascii")
self.readline = lambda: self.buffer.readline().decode("ascii")
sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)
input = lambda: sys.stdin.readline().rstrip("\r\n")
# ------------------- fast io --------------------
from math import gcd, ceil
def pre(s):
n = len(s)
pi = [0] * n
for i in range(1, n):
j = pi[i - 1]
while j and s[i] != s[j]:
j = pi[j - 1]
if s[i] == s[j]:
j += 1
pi[i] = j
return pi
def prod(a):
ans = 1
for each in a:
ans = (ans * each)
return ans
def lcm(a, b): return a * b // gcd(a, b)
def binary(x, length=16):
y = bin(x)[2:]
return y if len(y) >= length else "0" * (length - len(y)) + y
for _ in range(int(input()) if True else 1):
n = int(input())
#n, k = map(int, input().split())
#a, b = map(int, input().split())
#c, d = map(int, input().split())
a = list(map(int, input().split()))
#b = list(map(int, input().split()))
#s = input()
found = False
if a[0] + a[1] <= a[-1]:
print(1, 2, n)
found=True
if not found:
print(-1) | 7 | PYTHON3 |
for _ in range(int(input())):
n=int(input())
a=list(map(int,input().split()[:n]))
if a[0]+a[1]>a[-1]:
print(-1)
else:
print(1,2,n) | 7 | PYTHON3 |
t=int(input())
for you in range(t):
n=int(input())
l=input().split()
li=[int(i) for i in l]
if(li[0]+li[1]<=li[-1]):
print(1,2,n)
else:
print(-1)
| 7 | PYTHON3 |
#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;
}
| 7 | CPP |
for _ in range(int(input())):
n = int(input())
x = list(map(int, input().split()))
f = 0
mx = max(x)
h = x.index(mx)
for i in range(n - 2):
if i != h and i + 1 != h and x[i] + x[i + 1] <= mx:
print(i + 1, i + 2, h + 1)
f = 1
break
if not f:
print(-1)
| 7 | PYTHON3 |
import sys
sys.setrecursionlimit(10 ** 5)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")
def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def SI(): return sys.stdin.readline()[:-1]
for _ in range(II()):
n=II()
aa=LI()
if aa[0]+aa[1]>aa[-1]:print(-1)
else:print(1,2,n)
| 7 | PYTHON3 |
from sys import stdin
from collections import deque
# https://codeforces.com/contest/1354/status/D
mod = 10**9 + 7
import sys
import random
sys.setrecursionlimit(10**6)
from queue import PriorityQueue
from collections import Counter as cc
# def rl():
# return [int(w) for w in stdin.readline().split()]
from bisect import bisect_right
from bisect import bisect_left
from collections import defaultdict
from math import sqrt,factorial,gcd,log2,inf,ceil
# map(int,input().split())
# # l = list(map(int,input().split()))
# from itertools import permutations
import heapq
# input = lambda: sys.stdin.readline().rstrip()
# from sys import stdin
# input = lambda : sys.stdin.readline()
from collections import deque
# https://codeforces.com/contest/1354/status/D
mod = 10**9 + 7
import sys
import random
sys.setrecursionlimit(10**6)
from queue import PriorityQueue
from collections import Counter as cc
# def rl():
# return [int(w) for w in stdin.readline().split()]
from bisect import bisect_right
from bisect import bisect_left
from collections import defaultdict
from math import sqrt,factorial,gcd,log2,inf,ceil
# map(int,input().split())
# # l = list(map(int,input().split()))
# from itertools import permutations
import heapq
# input = lambda: sys.stdin.readline().rstrip()
input = lambda : sys.stdin.readline().rstrip()
from sys import stdin, stdout
from heapq import heapify, heappush, heappop
from itertools import permutations
from math import factorial as f
# def ncr(x, y):
# return f(x) // (f(y) * f(x - y))
def ncr(n, r, p):
num = den = 1
for i in range(r):
num = (num * (n - i)) % p
den = (den * (i + 1)) % p
return (num * pow(den,
p - 2, p)) % p
import sys
# input = sys.stdin.readline
# LCA
# def bfs(na):
#
# queue = [na]
# boo[na] = True
# level[na] = 0
#
# while queue!=[]:
#
# z = queue.pop(0)
#
# for i in hash[z]:
#
# if not boo[i]:
#
# queue.append(i)
# level[i] = level[z] + 1
# boo[i] = True
# dp[i][0] = z
#
#
#
# def prec(n):
#
# for i in range(1,20):
#
# for j in range(1,n+1):
# if dp[j][i-1]!=-1:
# dp[j][i] = dp[dp[j][i-1]][i-1]
#
#
# def lca(u,v):
# if level[v] < level[u]:
# u,v = v,u
#
# diff = level[v] - level[u]
#
#
# for i in range(20):
# if ((diff>>i)&1):
# v = dp[v][i]
#
#
# if u == v:
# return u
#
#
# for i in range(19,-1,-1):
# # print(i)
# if dp[u][i] != dp[v][i]:
#
# u = dp[u][i]
# v = dp[v][i]
#
#
# return dp[u][0]
#
# dp = []
#
#
# n = int(input())
#
# for i in range(n + 10):
#
# ka = [-1]*(20)
# dp.append(ka)
# class FenwickTree:
# def __init__(self, x):
# """transform list into BIT"""
# self.bit = x
# for i in range(len(x)):
# j = i | (i + 1)
# if j < len(x):
# x[j] += x[i]
#
# def update(self, idx, x):
# """updates bit[idx] += x"""
# while idx < len(self.bit):
# self.bit[idx] += x
# idx |= idx + 1
#
# def query(self, end):
# """calc sum(bit[:end])"""
# x = 0
# while end:
# x += self.bit[end - 1]
# end &= end - 1
# return x
#
# def find_kth_smallest(self, k):
# """Find largest idx such that sum(bit[:idx]) <= k"""
# idx = -1
# for d in reversed(range(len(self.bit).bit_length())):
# right_idx = idx + (1 << d)
# if right_idx < len(self.bit) and k >= self.bit[right_idx]:
# idx = right_idx
# k -= self.bit[idx]
# return idx + 1
# import sys
# def rs(): return sys.stdin.readline().strip()
# def ri(): return int(sys.stdin.readline())
# def ria(): return list(map(int, sys.stdin.readline().split()))
# def prn(n): sys.stdout.write(str(n))
# def pia(a): sys.stdout.write(' '.join([str(s) for s in a]))
#
#
# import gc, os
#
# ii = 0
# _inp = b''
#
#
# def getchar():
# global ii, _inp
# if ii >= len(_inp):
# _inp = os.read(0, 100000)
# gc.collect()
# ii = 0
# if not _inp:
# return b' '[0]
# ii += 1
# return _inp[ii - 1]
#
#
# def input():
# c = getchar()
# if c == b'-'[0]:
# x = 0
# sign = 1
# else:
# x = c - b'0'[0]
# sign = 0
# c = getchar()
# while c >= b'0'[0]:
# x = 10 * x + c - b'0'[0]
# c = getchar()
# if c == b'\r'[0]:
# getchar()
# return -x if sign else x
# fenwick Tree
# n,q = map(int,input().split())
#
#
# l1 = list(map(int,input().split()))
#
# l2 = list(map(int,input().split()))
#
# bit = [0]*(10**6 + 1)
#
# def update(i,add,bit):
#
# while i>0 and i<len(bit):
#
# bit[i]+=add
# i = i + (i&(-i))
#
#
# def sum(i,bit):
# ans = 0
# while i>0:
#
# ans+=bit[i]
# i = i - (i & ( -i))
#
#
# return ans
#
# def find_smallest(k,bit):
#
# l = 0
# h = len(bit)
# while l<h:
#
# mid = (l+h)//2
# if k <= sum(mid,bit):
# h = mid
# else:
# l = mid + 1
#
#
# return l
#
#
# def insert(x,bit):
# update(x,1,bit)
#
# def delete(x,bit):
# update(x,-1,bit)
# fa = set()
#
# for i in l1:
# insert(i,bit)
#
#
# for i in l2:
# if i>0:
# insert(i,bit)
#
# else:
# z = find_smallest(-i,bit)
#
# delete(z,bit)
#
#
# # print(bit)
# if len(set(bit)) == 1:
# print(0)
# else:
# for i in range(1,n+1):
# z = find_smallest(i,bit)
# if z!=0:
# print(z)
# break
#
# service time problem
# def solve2(s,a,b,hash,z,cnt):
# temp = cnt.copy()
# x,y = hash[a],hash[b]
# i = 0
# j = len(s)-1
#
# while z:
#
# if s[j] - y>=x-s[i]:
# if temp[s[j]]-1 == 0:
# j-=1
# temp[s[j]]-=1
# z-=1
#
#
# else:
# if temp[s[i]]-1 == 0:
# i+=1
#
# temp[s[i]]-=1
# z-=1
#
# return s[i:j+1]
#
#
#
#
#
# def solve1(l,s,posn,z,hash):
#
# ans = []
# for i in l:
# a,b = i
# ka = solve2(s,a,b,posn,z,hash)
# ans.append(ka)
#
# return ans
#
# def consistent(input, window, min_entries, max_entries, tolerance):
#
# l = input
# n = len(l)
# l.sort()
# s = list(set(l))
# s.sort()
#
# if min_entries<=n<=max_entries:
#
# if s[-1] - s[0]<window:
# return True
# hash = defaultdict(int)
# posn = defaultdict(int)
# for i in l:
# hash[i]+=1
#
# z = (tolerance*(n))//100
# poss_window = set()
#
#
# for i in range(len(s)):
# posn[i] = l[i]
# for j in range(i+1,len(s)):
# if s[j]-s[i] == window:
# poss_window.add((s[i],s[j]))
#
# if poss_window!=set():
# print(poss_window)
# ans = solve1(poss_window,s,posn,z,hash)
# print(ans)
#
#
# else:
# pass
#
# else:
# return False
#
#
#
#
# l = list(map(int,input().split()))
#
# min_ent,max_ent = map(int,input().split())
# w = int(input())
# tol = int(input())
# consistent(l, w, min_ent, max_ent, tol)
# t = int(input())
#
# for i in range(t):
#
# n,x = map(int,input().split())
#
# l = list(map(int,input().split()))
#
# e,o = 0,0
#
# for i in l:
# if i%2 == 0:
# e+=1
# else:
# o+=1
#
# if e+o>=x and o!=0:
# z = e+o - x
# if z == 0:
# if o%2 == 0:
# print('No')
# else:
# print('Yes')
# continue
# if o%2 == 0:
# o-=1
# z-=1
# if e>=z:
# print('Yes')
# else:
# z-=e
# o-=z
# if o%2!=0:
# print('Yes')
# else:
# print('No')
#
# else:
#
# if e>=z:
# print('Yes')
# else:
# z-=e
# o-=z
# if o%2!=0:
# print('Yes')
# else:
# print('No')
# else:
# print('No')
#
#
#
#
#
#
#
# def dfs(n):
# boo[n] = True
# dp2[n] = 1
# for i in hash[n]:
# if not boo[i]:
#
# dfs(i)
# dp2[n] += dp2[i]
#
#
# n = int(input())
# x = 0
# l = list(map(int,input().split()))
# for i in range(n):
#
# x = l[i]|x
#
# z = list(bin(x)[2:])
# ha = z.copy()
# k = z.count('1')
# ans = 0
# # print(z)
# cnt = 0
# for i in range(20):
#
#
# maxi = 0
# idx = -1
#
# for j in range(n):
# k = bin(l[j])[2:]
# k = '0'*(len(z) -len(k)) + k
# cnt = 0
# for i in range(len(z)):
# if k[i] == z[i] == '1':
# cnt+=1
#
# maxi = max(maxi,cnt)
# if maxi == cnt:
# idx = j
# if idx!=-1:
#
# k = bin(l[idx])[2:]
# k = '0'*(len(z) -len(k)) + k
#
# for i in range(len(z)):
# if k[i] == z[i] == '1':
# z[i] = '0'
# l[idx] = 0
#
#
# ans = 0
# for i in range(len(z)):
# if z[i] == '0' and ha[i] == '1':
# ans+=1
# flip = 0
# for i in range(ans):
# flip+=2**i
#
#
#
# print(flip)
# def search(k,l,low):
#
# high = len(l)-1
# z = bisect_left(l,k,low,high)
#
# return z
#
#
#
#
#
#
# n,x = map(int,input().split())
#
# l = list(map(int,input().split()))
#
# prefix = [0]
# ha = [0]
# for i in l:
# prefix.append(i + prefix[-1])
# ha.append((i*(i+1))//2 + ha[-1])
# fin = 0
# print(prefix)
# for i in range(n):
# ans = 0
# if l[i]<x:
#
#
# if prefix[-1]-prefix[i]>=x:
#
# z = search(x+prefix[i],prefix,i+1)
# print(z)
# z+=i+1
# k1 = x-(prefix[z-1]-prefix[i])
# ans+=ha[z-1]
# ans+=(k1*(k1+1))//2
#
#
# else:
# z1 = x - (prefix[-1]-prefix[i])
# z = search(z1,prefix,1)
#
# k1 = x-prefix[z-1]
# ans+=ha[z-1]
# ans+=(k1*(k1+1))//2
#
#
#
#
# elif l[i]>x:
# z1 = ((l[i])*(l[i]+1))//2
# z2 = ((l[i]-x)*(l[i]-x+1))//2
# ans+=z1-z2
# else:
# ans+=(x*(x+1))//2
# t = int(input())
#
# for _ in range(t):
#
# s = list(input())
# ans = [s[0]]
#
# for i in range(1,len(s)-1,2):
# ans.append(s[i])
#
# ans.append(s[-1])
# print(''.join(ans))
#
#
#
# t = int(input())
#
# for _ in range(t):
#
# n = int(input())
# l = list(map(int,input().split()))
# ans = 0
# for i in range(n):
# if l[i]%2!=i%2:
# ans+=1
#
# if ans%2 == 0:
# print(ans//2)
# else:
# print(-1)
# t = int(input())
#
# for _ in range(t):
#
# n,k = map(int,input().split())
# s = input()
#
#
# ans = 0
# ba = []
# for i in range(n):
# if s[i] == '1':
# ba.append(i)
# if ba == []:
# for i in range(0,n,k+1):
# ans+=1
#
# print(ans)
# continue
#
# i = s.index('1')
# c = 0
# for x in range(i-1,-1,-1):
# if c == k:
# c = 0
# ans+=1
# else:
# c+=1
#
#
# while i<len(s):
# count = 0
# dis = 0
# while s[i] == '0':
# dis+=1
# if dis == k:
# dis = 0
# count+=1
# if dis<k and s[i] == '1':
# count-=1
# break
# i+=1
# if i == n:
# break
# i+=1
#
# print(ans)
#
#
#
#
# q1
# def poss1(x):
# cnt = 1
# mini = inf
# for i in l:
# if cnt%2 != 0:
# cnt+=1
# else:
# if i<=x:
# cnt+=1
# mini = min()
# if cnt == k:
# return
#
# return -1
#
#
#
#
# def poss2(x):
# cnt = 1
# for i in l:
# if cnt%2 == 0:
# cnt+=1
# else:
# if i<=x:
# cnt+=1
# if cnt == k:
# return
#
# return -1
#
#
#
# n,k = map(int,input().split())
# l = list(map(int,input().split()))
#
# z1 = min(l)
# z2 = max(l)
# t = int(input())
#
# for _ in range(t):
#
# n,k = map(int,input().split())
# l = list(map(int,input().split()))
#
# for i in range(n):
# z = l[i]%k
#
# if z!=0:
#
# l[i] = k-z
# else:
# l[i] = 0
#
# l.sort()
# count = 0
# ans = 0
# x = 0
# print(l)
# for i in range(n):
#
# z = l[i]
# if z == 0:
# continue
# if x>z:
# z2 = ceil((x-l[i])/k)
# z1 = l[i] + k*z2
# # print(x,z1)
# ans += z1-x + 1
# x = z1+1
# elif z == x:
# ans+=1
# x+=1
# else:
#
# ans += z-x + 1
# x = z+1
# # print(i,x)
# print(ans)
#
#
#
# print(ans)
# t = int(input())
#
# for _ in range(t):
#
# n = int(input())
# seti = set()
# ans = []
# for i in range(1,1001):
# if i not in seti:
# def dfs_cycle(u, p, color,
# mark, par):
# global cyclenumber
#
# # already (completely) visited vertex.
# if color[u] == 2:
# return
#
# # seen vertex, but was not
# # completely visited -> cycle detected.
# # backtrack based on parents to
# # find the complete cycle.
# if color[u] == 1:
# cyclenumber += 1
# cur = p
# mark[cur] = cyclenumber
#
# # backtrack the vertex which are
# # in the current cycle thats found
# while cur != u:
# cur = par[cur]
# mark[cur] = cyclenumber
#
# return
#
# par[u] = p
#
# # partially visited.
# color[u] = 1
#
# # simple dfs on graph
# for v in hash[u]:
#
# # if it has not been visited previously
# if v == par[u]:
# continue
# dfs_cycle(v, u, color, mark, par)
#
# # completely visited.
# color[u] = 2
#
# def printCycles(edges, mark):
#
# # push the edges that into the
# # cycle adjacency list
# for i in range(1, edges + 1):
# if mark[i] != 0:
# cycles[mark[i]].append(i)
#
# # print all the vertex with same cycle
# for i in range(1, cyclenumber + 1):
#
# # Print the i-th cycle
# print("Cycle Number %d:" % i, end = " ")
# for x in cycles[i]:
# print(x, end = " ")
# print()
#
# t = int(input())
#
# for _ in range(t):
#
# n,m = map(int,input().split())
#
# hash = defaultdict(list)
# seti = set()
# for i in range(m):
#
# type,a,b = map(int,input().split())
# hash[a].append(b)
# hash[b].append(a)
# if type == 1:
# seti.add((a,b))
#
# cycles = defaultdict(list)
# color = defaultdict(int)
# par = defaultdict(int)
# mark = defaultdict(int)
# cyclenumber = 0
# dfs_cycle(1, 0, color, mark, par)
# printCycles(m, mark)
#
#
#
#
#
#
# binary lifting Technique
# n = int(input())
# max_log = int(input())
# dp = []
# for i in range(n+1):
# c = [0]*(max_log + 1)
# dp.append(c)
# par = []
# for i in range(1,n+1):
# for j in range(0,n+1):
# if (1<<j)>n:
# break
# dp[i][j] = -1
#
# for i in range(1,n+1):
# dp[i][0] = par[i]
#
# for j in range(1,n+1):
# if (1<<j)>n:
# break
# for i in range(1,n+1):
# if dp[i][j-1]!=-1:
# dp[i][j] = dp[dp[i][j-1]][j-1]
#
# level = defaultdict(int)
# def lca(u,v):
# if level[u] < level[v]:
# u,v = v,u
#
# dist = level[u] - level[v]
# while dist>0:
# raise_by = int(log2(dist))
# u = dp[u][raise_by]
# dist-=1<<raise_by
#
# if u == v:
# return u
#
# for j in range(max_log,-1,-1):
#
# if dp[u][j]!=-1 and dp[u][j]!=dp[v][j]:
# u = dp[u][j]
# v = dp[v][j]
#
#
#
#
#
#
# return par[u]
# n = int(input())
# t = int(input())
#
# for _ in range(t):
#
# n = int(input())
# l = list(map(int,input().split()))
# ans = ['']*(n+1)
# cnt = 1
# id = 99
# for i in range(n-1):
# a = l[i]
# s1,s2 = ans[i],ans[i+1]
# if a == 0:
#
# ans[i] = chr((id)%97 + 97)*(cnt)
# if id%97 == 0:
# cnt+=1
# id+=1
#
# elif s1 == 0:
# ans[i],ans[i+1] = 'a'*a,'a'*a
# elif len(s1)<=a:
# ans[i] = s1 + 'a'*(a-len(s1))
# ans[i+1] = ans[i]
# else:
# ans[i+1] = s1[:a]
# a = l[-1]
# s1 = ans[-2]
#
# if a == 0:
# ans[-2] = chr((id+1)%97 + 97)*(cnt)
# if id%97 == 0:
# cnt+=1
# id+=1
# ans[-1] = chr((id+1)%97 + 97)*(cnt)
# elif len(s1)<=a:
# ans[-2] = s1 + 'a'*(a-len(s1))
# ans[-1] = ans[-2]
# else:
# ans[-1] = s1[:a]
# for i in ans:
# print(i)
#
#
#
# q1
# class Solution:
# # @param A : string
# # @param B : list of strings
# # @return a list of strings
# def wordBreak(self, A, B):
# count = 0
#
#
# for i in range(6,150):
# for j in range(7,150):
# for k in range(8,150):
# for e in range(1,150):
# if i+j+k+e == 150:
# count+=1
#
# print(count)
# q1
# t = int(input())
# for _ in range(t):
#
# n = int(input())
# l = [i+1 for i in range(n)]
# l.reverse()
#
#
#
# print(*l)
# q2
# def solvehist(l):
#
# stack = []
# i = 0
# maxi = 0
# while i<len(l):
#
# if stack == []:
# stack.append(i)
# i+=1
# elif l[stack[-1]]<=l[i]:
# stack.append(i)
# i+=1
#
# else:
# z = stack.pop()
# if stack:
# area = l[z] * (i-stack[-1]-1)
# else:
# area = l[z]*(i)
# maxi = max(maxi,area)
#
# while stack:
# z = stack.pop()
# if stack:
# area = l[z] * (i-stack[-1]-1)
# else:
# area = l[z]*(i)
# maxi = max(maxi,area)
#
# return maxi
# Trie for arrays
# class Node():
# def __init__(self,value):
# self.value = value
# self.left = None
# self.right = None
#
# def insert(n,head):
# cur_node = head
#
# for i in range(31,-1,-1):
# b = (n>>i)&1
#
# if b == 0:
# if cur_node.left == None:
# cur_node.left = Node(b)
#
# cur_node = cur_node.left
# elif b == 1:
# if cur_node.right == None:
# cur_node.right = Node(b)
#
# cur_node = cur_node.right
#
# def sol(n,head):
# cur_node = head
# st = '0'
#
# for i in range(31,-1,-1):
# b = (n>>i)&1
# if b == 0:
#
# if cur_node.left!=None:
#
# cur_node = cur_node.left
# st+='0'
# else:
# if cur_node.right != None:
# cur_node = cur_node.right
# st+='1'
#
# elif b == 1:
# if cur_node.right != None:
# cur_node = cur_node.right
# st+='1'
# else:
# if cur_node.left != None:
# cur_node = cur_node.left
# st+='0'
#
#
# ans = int(st,2)
# return ans
#
#
#
# head = Node(0)
# Trie For strings
# from collections import defaultdict
# class Trie:
#
# def __init__(self,st):
# self.child = []
# self.terminate = False
# self.st = st
# self.val = 0
#
# def counti(cur_node):
# ans = 0
# if cur_node.child == []:
# return 0
#
#
#
#
#
# for i in cur_node.child:
# if i.terminate == True:
#
# ans += i.val+counti(i)
# else:
# ans += counti(i)
#
# return ans
#
#
#
#
# def insert(s,head,val):
#
# cur_node = head
#
# for i in s:
# flag = 0
# for j in cur_node.child:
# # print(i,j.st)
# if j.st == i:
#
# cur_node = j
# flag = 1
# break
# if not flag:
# z = Trie(i)
# cur_node.child.append(z)
#
# cur_node = z
#
# cur_node.terminate = True
# cur_node.val = val
#
#
# def query(s,head):
# cur_node = head
#
# for i in s:
# flag = 0
# for j in cur_node.child:
# if j.st == i:
# cur_node = j
# flag = 1
# break
# if not flag:
# return 0
#
# count = cur_node.val if cur_node.terminate == True else 0
#
# count+=counti(cur_node)
#
# return count
#
#
# hash = defaultdict(int)
#
#
# head = Trie('0')
# n,q = map(int,input().split())
# for i in range(n):
# hash[input()]+=1
#
# for i in hash:
# insert(i,head,hash[i])
#
# for i in range(q):
# print(query(input(),head))
#q1
# t = int(input())
# for _ in range(t):
#
# x1,y1,z1 = map(int,input().split())
# x2,y2,z2 = map(int,input().split())
# ans = 0
# ans+=2*min(z1,y2)
# k = min(z1,y2)
# y2-=k
# z1-=k
# y1-=min(y1,x2+y2)
# if y1 == 0:
# print(ans)
# else:
# z2-=min(z1+x1,z2)
# ans-=2*(min(z2,y1))
#
from sys import stdin, stdout
from heapq import heapify, heappush, heappop
from itertools import permutations
from math import factorial as f
# def ncr(x, y):
# return f(x) // (f(y) * f(x - y))
def ncr(n, r, p):
num = den = 1
for i in range(r):
num = (num * (n - i)) % p
den = (den * (i + 1)) % p
return (num * pow(den,
p - 2, p)) % p
import sys
# input = sys.stdin.readline
# LCA
# def bfs(na):
#
# queue = [na]
# boo[na] = True
# level[na] = 0
#
# while queue!=[]:
#
# z = queue.pop(0)
#
# for i in hash[z]:
#
# if not boo[i]:
#
# queue.append(i)
# level[i] = level[z] + 1
# boo[i] = True
# dp[i][0] = z
#
#
#
# def prec(n):
#
# for i in range(1,20):
#
# for j in range(1,n+1):
# if dp[j][i-1]!=-1:
# dp[j][i] = dp[dp[j][i-1]][i-1]
#
#
# def lca(u,v):
# if level[v] < level[u]:
# u,v = v,u
#
# diff = level[v] - level[u]
#
#
# for i in range(20):
# if ((diff>>i)&1):
# v = dp[v][i]
#
#
# if u == v:
# return u
#
#
# for i in range(19,-1,-1):
# # print(i)
# if dp[u][i] != dp[v][i]:
#
# u = dp[u][i]
# v = dp[v][i]
#
#
# return dp[u][0]
#
# dp = []
#
#
# n = int(input())
#
# for i in range(n + 10):
#
# ka = [-1]*(20)
# dp.append(ka)
# class FenwickTree:
# def __init__(self, x):
# """transform list into BIT"""
# self.bit = x
# for i in range(len(x)):
# j = i | (i + 1)
# if j < len(x):
# x[j] += x[i]
#
# def update(self, idx, x):
# """updates bit[idx] += x"""
# while idx < len(self.bit):
# self.bit[idx] += x
# idx |= idx + 1
#
# def query(self, end):
# """calc sum(bit[:end])"""
# x = 0
# while end:
# x += self.bit[end - 1]
# end &= end - 1
# return x
#
# def find_kth_smallest(self, k):
# """Find largest idx such that sum(bit[:idx]) <= k"""
# idx = -1
# for d in reversed(range(len(self.bit).bit_length())):
# right_idx = idx + (1 << d)
# if right_idx < len(self.bit) and k >= self.bit[right_idx]:
# idx = right_idx
# k -= self.bit[idx]
# return idx + 1
# import sys
# def rs(): return sys.stdin.readline().strip()
# def ri(): return int(sys.stdin.readline())
# def ria(): return list(map(int, sys.stdin.readline().split()))
# def prn(n): sys.stdout.write(str(n))
# def pia(a): sys.stdout.write(' '.join([str(s) for s in a]))
#
#
# import gc, os
#
# ii = 0
# _inp = b''
#
#
# def getchar():
# global ii, _inp
# if ii >= len(_inp):
# _inp = os.read(0, 100000)
# gc.collect()
# ii = 0
# if not _inp:
# return b' '[0]
# ii += 1
# return _inp[ii - 1]
#
#
# def input():
# c = getchar()
# if c == b'-'[0]:
# x = 0
# sign = 1
# else:
# x = c - b'0'[0]
# sign = 0
# c = getchar()
# while c >= b'0'[0]:
# x = 10 * x + c - b'0'[0]
# c = getchar()
# if c == b'\r'[0]:
# getchar()
# return -x if sign else x
# fenwick Tree
# n,q = map(int,input().split())
#
#
# l1 = list(map(int,input().split()))
#
# l2 = list(map(int,input().split()))
#
# bit = [0]*(10**6 + 1)
#
# def update(i,add,bit):
#
# while i>0 and i<len(bit):
#
# bit[i]+=add
# i = i + (i&(-i))
#
#
# def sum(i,bit):
# ans = 0
# while i>0:
#
# ans+=bit[i]
# i = i - (i & ( -i))
#
#
# return ans
#
# def find_smallest(k,bit):
#
# l = 0
# h = len(bit)
# while l<h:
#
# mid = (l+h)//2
# if k <= sum(mid,bit):
# h = mid
# else:
# l = mid + 1
#
#
# return l
#
#
# def insert(x,bit):
# update(x,1,bit)
#
# def delete(x,bit):
# update(x,-1,bit)
# fa = set()
#
# for i in l1:
# insert(i,bit)
#
#
# for i in l2:
# if i>0:
# insert(i,bit)
#
# else:
# z = find_smallest(-i,bit)
#
# delete(z,bit)
#
#
# # print(bit)
# if len(set(bit)) == 1:
# print(0)
# else:
# for i in range(1,n+1):
# z = find_smallest(i,bit)
# if z!=0:
# print(z)
# break
#
# service time problem
# def solve2(s,a,b,hash,z,cnt):
# temp = cnt.copy()
# x,y = hash[a],hash[b]
# i = 0
# j = len(s)-1
#
# while z:
#
# if s[j] - y>=x-s[i]:
# if temp[s[j]]-1 == 0:
# j-=1
# temp[s[j]]-=1
# z-=1
#
#
# else:
# if temp[s[i]]-1 == 0:
# i+=1
#
# temp[s[i]]-=1
# z-=1
#
# return s[i:j+1]
#
#
#
#
#
# def solve1(l,s,posn,z,hash):
#
# ans = []
# for i in l:
# a,b = i
# ka = solve2(s,a,b,posn,z,hash)
# ans.append(ka)
#
# return ans
#
# def consistent(input, window, min_entries, max_entries, tolerance):
#
# l = input
# n = len(l)
# l.sort()
# s = list(set(l))
# s.sort()
#
# if min_entries<=n<=max_entries:
#
# if s[-1] - s[0]<window:
# return True
# hash = defaultdict(int)
# posn = defaultdict(int)
# for i in l:
# hash[i]+=1
#
# z = (tolerance*(n))//100
# poss_window = set()
#
#
# for i in range(len(s)):
# posn[i] = l[i]
# for j in range(i+1,len(s)):
# if s[j]-s[i] == window:
# poss_window.add((s[i],s[j]))
#
# if poss_window!=set():
# print(poss_window)
# ans = solve1(poss_window,s,posn,z,hash)
# print(ans)
#
#
# else:
# pass
#
# else:
# return False
#
#
#
#
# l = list(map(int,input().split()))
#
# min_ent,max_ent = map(int,input().split())
# w = int(input())
# tol = int(input())
# consistent(l, w, min_ent, max_ent, tol)
# t = int(input())
#
# for i in range(t):
#
# n,x = map(int,input().split())
#
# l = list(map(int,input().split()))
#
# e,o = 0,0
#
# for i in l:
# if i%2 == 0:
# e+=1
# else:
# o+=1
#
# if e+o>=x and o!=0:
# z = e+o - x
# if z == 0:
# if o%2 == 0:
# print('No')
# else:
# print('Yes')
# continue
# if o%2 == 0:
# o-=1
# z-=1
# if e>=z:
# print('Yes')
# else:
# z-=e
# o-=z
# if o%2!=0:
# print('Yes')
# else:
# print('No')
#
# else:
#
# if e>=z:
# print('Yes')
# else:
# z-=e
# o-=z
# if o%2!=0:
# print('Yes')
# else:
# print('No')
# else:
# print('No')
#
#
#
#
#
#
#
# def dfs(n):
# boo[n] = True
# dp2[n] = 1
# for i in hash[n]:
# if not boo[i]:
#
# dfs(i)
# dp2[n] += dp2[i]
#
#
# n = int(input())
# x = 0
# l = list(map(int,input().split()))
# for i in range(n):
#
# x = l[i]|x
#
# z = list(bin(x)[2:])
# ha = z.copy()
# k = z.count('1')
# ans = 0
# # print(z)
# cnt = 0
# for i in range(20):
#
#
# maxi = 0
# idx = -1
#
# for j in range(n):
# k = bin(l[j])[2:]
# k = '0'*(len(z) -len(k)) + k
# cnt = 0
# for i in range(len(z)):
# if k[i] == z[i] == '1':
# cnt+=1
#
# maxi = max(maxi,cnt)
# if maxi == cnt:
# idx = j
# if idx!=-1:
#
# k = bin(l[idx])[2:]
# k = '0'*(len(z) -len(k)) + k
#
# for i in range(len(z)):
# if k[i] == z[i] == '1':
# z[i] = '0'
# l[idx] = 0
#
#
# ans = 0
# for i in range(len(z)):
# if z[i] == '0' and ha[i] == '1':
# ans+=1
# flip = 0
# for i in range(ans):
# flip+=2**i
#
#
#
# print(flip)
# def search(k,l,low):
#
# high = len(l)-1
# z = bisect_left(l,k,low,high)
#
# return z
#
#
#
#
#
#
# n,x = map(int,input().split())
#
# l = list(map(int,input().split()))
#
# prefix = [0]
# ha = [0]
# for i in l:
# prefix.append(i + prefix[-1])
# ha.append((i*(i+1))//2 + ha[-1])
# fin = 0
# print(prefix)
# for i in range(n):
# ans = 0
# if l[i]<x:
#
#
# if prefix[-1]-prefix[i]>=x:
#
# z = search(x+prefix[i],prefix,i+1)
# print(z)
# z+=i+1
# k1 = x-(prefix[z-1]-prefix[i])
# ans+=ha[z-1]
# ans+=(k1*(k1+1))//2
#
#
# else:
# z1 = x - (prefix[-1]-prefix[i])
# z = search(z1,prefix,1)
#
# k1 = x-prefix[z-1]
# ans+=ha[z-1]
# ans+=(k1*(k1+1))//2
#
#
#
#
# elif l[i]>x:
# z1 = ((l[i])*(l[i]+1))//2
# z2 = ((l[i]-x)*(l[i]-x+1))//2
# ans+=z1-z2
# else:
# ans+=(x*(x+1))//2
# t = int(input())
#
# for _ in range(t):
#
# s = list(input())
# ans = [s[0]]
#
# for i in range(1,len(s)-1,2):
# ans.append(s[i])
#
# ans.append(s[-1])
# print(''.join(ans))
#
#
#
# t = int(input())
#
# for _ in range(t):
#
# n = int(input())
# l = list(map(int,input().split()))
# ans = 0
# for i in range(n):
# if l[i]%2!=i%2:
# ans+=1
#
# if ans%2 == 0:
# print(ans//2)
# else:
# print(-1)
# t = int(input())
#
# for _ in range(t):
#
# n,k = map(int,input().split())
# s = input()
#
#
# ans = 0
# ba = []
# for i in range(n):
# if s[i] == '1':
# ba.append(i)
# if ba == []:
# for i in range(0,n,k+1):
# ans+=1
#
# print(ans)
# continue
#
# i = s.index('1')
# c = 0
# for x in range(i-1,-1,-1):
# if c == k:
# c = 0
# ans+=1
# else:
# c+=1
#
#
# while i<len(s):
# count = 0
# dis = 0
# while s[i] == '0':
# dis+=1
# if dis == k:
# dis = 0
# count+=1
# if dis<k and s[i] == '1':
# count-=1
# break
# i+=1
# if i == n:
# break
# i+=1
#
# print(ans)
#
#
#
#
# q1
# def poss1(x):
# cnt = 1
# mini = inf
# for i in l:
# if cnt%2 != 0:
# cnt+=1
# else:
# if i<=x:
# cnt+=1
# mini = min()
# if cnt == k:
# return
#
# return -1
#
#
#
#
# def poss2(x):
# cnt = 1
# for i in l:
# if cnt%2 == 0:
# cnt+=1
# else:
# if i<=x:
# cnt+=1
# if cnt == k:
# return
#
# return -1
#
#
#
# n,k = map(int,input().split())
# l = list(map(int,input().split()))
#
# z1 = min(l)
# z2 = max(l)
# t = int(input())
#
# for _ in range(t):
#
# n,k = map(int,input().split())
# l = list(map(int,input().split()))
#
# for i in range(n):
# z = l[i]%k
#
# if z!=0:
#
# l[i] = k-z
# else:
# l[i] = 0
#
# l.sort()
# count = 0
# ans = 0
# x = 0
# print(l)
# for i in range(n):
#
# z = l[i]
# if z == 0:
# continue
# if x>z:
# z2 = ceil((x-l[i])/k)
# z1 = l[i] + k*z2
# # print(x,z1)
# ans += z1-x + 1
# x = z1+1
# elif z == x:
# ans+=1
# x+=1
# else:
#
# ans += z-x + 1
# x = z+1
# # print(i,x)
# print(ans)
#
#
#
# print(ans)
# t = int(input())
#
# for _ in range(t):
#
# n = int(input())
# seti = set()
# ans = []
# for i in range(1,1001):
# if i not in seti:
# def dfs_cycle(u, p, color,
# mark, par):
# global cyclenumber
#
# # already (completely) visited vertex.
# if color[u] == 2:
# return
#
# # seen vertex, but was not
# # completely visited -> cycle detected.
# # backtrack based on parents to
# # find the complete cycle.
# if color[u] == 1:
# cyclenumber += 1
# cur = p
# mark[cur] = cyclenumber
#
# # backtrack the vertex which are
# # in the current cycle thats found
# while cur != u:
# cur = par[cur]
# mark[cur] = cyclenumber
#
# return
#
# par[u] = p
#
# # partially visited.
# color[u] = 1
#
# # simple dfs on graph
# for v in hash[u]:
#
# # if it has not been visited previously
# if v == par[u]:
# continue
# dfs_cycle(v, u, color, mark, par)
#
# # completely visited.
# color[u] = 2
#
# def printCycles(edges, mark):
#
# # push the edges that into the
# # cycle adjacency list
# for i in range(1, edges + 1):
# if mark[i] != 0:
# cycles[mark[i]].append(i)
#
# # print all the vertex with same cycle
# for i in range(1, cyclenumber + 1):
#
# # Print the i-th cycle
# print("Cycle Number %d:" % i, end = " ")
# for x in cycles[i]:
# print(x, end = " ")
# print()
#
# t = int(input())
#
# for _ in range(t):
#
# n,m = map(int,input().split())
#
# hash = defaultdict(list)
# seti = set()
# for i in range(m):
#
# type,a,b = map(int,input().split())
# hash[a].append(b)
# hash[b].append(a)
# if type == 1:
# seti.add((a,b))
#
# cycles = defaultdict(list)
# color = defaultdict(int)
# par = defaultdict(int)
# mark = defaultdict(int)
# cyclenumber = 0
# dfs_cycle(1, 0, color, mark, par)
# printCycles(m, mark)
#
#
#
#
#
#
# binary lifting Technique
# n = int(input())
# max_log = int(input())
# dp = []
# for i in range(n+1):
# c = [0]*(max_log + 1)
# dp.append(c)
# par = []
# for i in range(1,n+1):
# for j in range(0,n+1):
# if (1<<j)>n:
# break
# dp[i][j] = -1
#
# for i in range(1,n+1):
# dp[i][0] = par[i]
#
# for j in range(1,n+1):
# if (1<<j)>n:
# break
# for i in range(1,n+1):
# if dp[i][j-1]!=-1:
# dp[i][j] = dp[dp[i][j-1]][j-1]
#
# level = defaultdict(int)
# def lca(u,v):
# if level[u] < level[v]:
# u,v = v,u
#
# dist = level[u] - level[v]
# while dist>0:
# raise_by = int(log2(dist))
# u = dp[u][raise_by]
# dist-=1<<raise_by
#
# if u == v:
# return u
#
# for j in range(max_log,-1,-1):
#
# if dp[u][j]!=-1 and dp[u][j]!=dp[v][j]:
# u = dp[u][j]
# v = dp[v][j]
#
#
#
#
#
#
# return par[u]
# n = int(input())
# t = int(input())
#
# for _ in range(t):
#
# n = int(input())
# l = list(map(int,input().split()))
# ans = ['']*(n+1)
# cnt = 1
# id = 99
# for i in range(n-1):
# a = l[i]
# s1,s2 = ans[i],ans[i+1]
# if a == 0:
#
# ans[i] = chr((id)%97 + 97)*(cnt)
# if id%97 == 0:
# cnt+=1
# id+=1
#
# elif s1 == 0:
# ans[i],ans[i+1] = 'a'*a,'a'*a
# elif len(s1)<=a:
# ans[i] = s1 + 'a'*(a-len(s1))
# ans[i+1] = ans[i]
# else:
# ans[i+1] = s1[:a]
# a = l[-1]
# s1 = ans[-2]
#
# if a == 0:
# ans[-2] = chr((id+1)%97 + 97)*(cnt)
# if id%97 == 0:
# cnt+=1
# id+=1
# ans[-1] = chr((id+1)%97 + 97)*(cnt)
# elif len(s1)<=a:
# ans[-2] = s1 + 'a'*(a-len(s1))
# ans[-1] = ans[-2]
# else:
# ans[-1] = s1[:a]
# for i in ans:
# print(i)
#
#
#
# q1
# class Solution:
# # @param A : string
# # @param B : list of strings
# # @return a list of strings
# def wordBreak(self, A, B):
# count = 0
#
#
# for i in range(6,150):
# for j in range(7,150):
# for k in range(8,150):
# for e in range(1,150):
# if i+j+k+e == 150:
# count+=1
#
# print(count)
# q1
# t = int(input())
# for _ in range(t):
#
# n = int(input())
# l = [i+1 for i in range(n)]
# l.reverse()
#
#
#
# print(*l)
# q2
# def solvehist(l):
#
# stack = []
# i = 0
# maxi = 0
# while i<len(l):
#
# if stack == []:
# stack.append(i)
# i+=1
# elif l[stack[-1]]<=l[i]:
# stack.append(i)
# i+=1
#
# else:
# z = stack.pop()
# if stack:
# area = l[z] * (i-stack[-1]-1)
# else:
# area = l[z]*(i)
# maxi = max(maxi,area)
#
# while stack:
# z = stack.pop()
# if stack:
# area = l[z] * (i-stack[-1]-1)
# else:
# area = l[z]*(i)
# maxi = max(maxi,area)
#
# return maxi
# Trie for arrays
# class Node():
# def __init__(self,value):
# self.value = value
# self.left = None
# self.right = None
#
# def insert(n,head):
# cur_node = head
#
# for i in range(31,-1,-1):
# b = (n>>i)&1
#
# if b == 0:
# if cur_node.left == None:
# cur_node.left = Node(b)
#
# cur_node = cur_node.left
# elif b == 1:
# if cur_node.right == None:
# cur_node.right = Node(b)
#
# cur_node = cur_node.right
#
# def sol(n,head):
# cur_node = head
# st = '0'
#
# for i in range(31,-1,-1):
# b = (n>>i)&1
# if b == 0:
#
# if cur_node.left!=None:
#
# cur_node = cur_node.left
# st+='0'
# else:
# if cur_node.right != None:
# cur_node = cur_node.right
# st+='1'
#
# elif b == 1:
# if cur_node.right != None:
# cur_node = cur_node.right
# st+='1'
# else:
# if cur_node.left != None:
# cur_node = cur_node.left
# st+='0'
#
#
# ans = int(st,2)
# return ans
#
#
#
# head = Node(0)
# Trie For strings
# from collections import defaultdict
# class Trie:
#
# def __init__(self,st):
# self.child = []
# self.terminate = False
# self.st = st
# self.val = 0
#
# def counti(cur_node):
# ans = 0
# if cur_node.child == []:
# return 0
#
#
#
#
#
# for i in cur_node.child:
# if i.terminate == True:
#
# ans += i.val+counti(i)
# else:
# ans += counti(i)
#
# return ans
#
#
#
#
# def insert(s,head,val):
#
# cur_node = head
#
# for i in s:
# flag = 0
# for j in cur_node.child:
# # print(i,j.st)
# if j.st == i:
#
# cur_node = j
# flag = 1
# break
# if not flag:
# z = Trie(i)
# cur_node.child.append(z)
#
# cur_node = z
#
# cur_node.terminate = True
# cur_node.val = val
#
#
# def query(s,head):
# cur_node = head
#
# for i in s:
# flag = 0
# for j in cur_node.child:
# if j.st == i:
# cur_node = j
# flag = 1
# break
# if not flag:
# return 0
#
# count = cur_node.val if cur_node.terminate == True else 0
#
# count+=counti(cur_node)
#
# return count
#
#
# hash = defaultdict(int)
#
#
# head = Trie('0')
# n,q = map(int,input().split())
# for i in range(n):
# hash[input()]+=1
#
# for i in hash:
# insert(i,head,hash[i])
#
# for i in range(q):
# print(query(input(),head))
#q1
# def bfs(color,no,root):
#
#
# color[root] = no
# queue = [no]
# boo = defaultdict(bool)
# while queue:
#
#
#
#
# t = int(input())
#
# for _ in range(t):
#
# n = int(input())
# hash = defaultdict(list)
# for i in range(n-1):
# a,b = map(int,input().split())
# hash[a].append(b)
# hash[b].append(a)
#
# color1 = defaultdict(int)
# color2 = defaultdict(int)
t = int(input())
for _ in range(t):
n = int(input())
l = list(map(int,input().split()))
i,j,k = 1,2,-1
for K in range(3,n+1):
if l[K-1]>=l[i-1]+l[j-1]:
k = K
break
if k == -1:
print(-1)
else:
print(i,j,k)
| 7 | PYTHON3 |
t = int(input())
for _ in range(t):
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 x in range(int(input())):
n=int(input())
a=list(map(int,input().split()))
i=0
if a[i]+a[i+1]<=a[n-1]:
print(i+1,i+2,n)
else:
print('-1')
| 7 | PYTHON3 |
def main(case):
n = int(input())
lst = list(map(int, input().split()))
if lst[0] + lst[1] <= lst[-1]:
print(1, 2, n)
return
print(-1)
if __name__ == '__main__':
t = int(input())
for i in range(t):
main(i + 1)
| 7 | PYTHON3 |
def solve(n,a):
i = 0
j = 1
for idx in range(2, n):
c = a[idx]
if c+a[i] <= a[j] or c + a[j] <= a[i] or a[i] + a[j] <= c:
c = idx
print(i+1,j+1,idx+1)
return
print(-1)
t = int(input())
for test in range(t):
n = int(input())
a = list(map(int, input().split()))
solve(n,a)
| 7 | PYTHON3 |
from bisect import bisect_left as bl
from bisect import bisect_right as br
from heapq import heappush,heappop,heapify
import math
from collections import *
from functools import reduce,cmp_to_key
import sys
input = sys.stdin.readline
from itertools import accumulate
from functools import lru_cache
M = mod = 998244353
def factors(n):return sorted(set(reduce(list.__add__, ([i, n//i] for i in range(1, int(n**0.5) + 1) if n % i == 0))))
def inv_mod(n):return pow(n, mod - 2, mod)
def li():return [int(i) for i in input().rstrip('\n').split()]
def st():return input().rstrip('\n')
def val():return int(input().rstrip('\n'))
def li2():return [i for i in input().rstrip('\n')]
def li3():return [int(i) for i in input().rstrip('\n')]
for _ in range(val()):
n = val()
l = li()
ans = [-1]
if l[0] + l[1] <= l[-1]:
print(1, 2, n)
else:print(-1) | 7 | PYTHON3 |
for _ in range(int(input())):
n = int(input())
arr = list(map(int, input().split()))
if arr[0] + arr[1] <= arr[-1]:
print(1, 2, len(arr))
else:
print(-1) | 7 | PYTHON3 |
#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--;
}
}
| 7 | CPP |
import sys
# sys.setrecursionlimit(10**6)
input=sys.stdin.readline
t=int(input())
for t1 in range(t):
n=int(input())
l=list(map(int,input().split(" ")))
if(l[0]+l[1]<=l[-1]):
print(1,2,n)
else:
print(-1) | 7 | PYTHON3 |
for _ in range(int(input())):
inp = input()
y = list(map(int,input().split()))
if y[0]+y[1] <= y[-1]:
print(1,2,len(y))
else:
print(-1) | 7 | PYTHON3 |
import sys
T = int(sys.stdin.readline().strip())
for t in range (0, T):
n = int(sys.stdin.readline().strip())
a = list(map(int, sys.stdin.readline().strip().split()))
b = [[a[i], i+1] for i in range (0, n)]
if b[0][0] + b[1][0] <= b[-1][0]:
print(b[0][1], b[1][1], b[-1][1])
else:
print(-1) | 7 | PYTHON3 |
import sys
for bruh in range(0,int(sys.stdin.readline())):
leng = int(sys.stdin.readline())
vals = list(map(int,sys.stdin.readline().split()))
if vals[0] + vals[1] > vals[leng-1]:
sys.stdout.write("-1\n")
else:
sys.stdout.write("1 2 "+str(leng)+"\n")
| 7 | PYTHON3 |
for t in range(int(input())):
n=int(input())
a=list(map(int,input().split()))
a.sort()
c=a[0]+a[1]
d=['1','2']
for i in range(2,len(a)):
if a[i]>=c:
d.append(str(i+1))
break
if len(d)==2:
print(-1)
else:
print(' '.join(d))
| 7 | PYTHON3 |
for _ in range(int(input())):
n=int(input())
l=[int(x) for x in input().split()]
f=0
for i in range(n-2):
temp=l[i]+l[i+1]
if l[n-1]>=temp:
print(i+1,i+2,n)
f=1
break
if f==0:
print(-1) | 7 | PYTHON3 |
for _ in range(int(input())):
ans = 0
n = int(input())
tri = list(map(int, input().split()))
if tri[0] + tri[1] <= tri[-1]:
print(1, 2, len(tri))
ans += 1
if ans == 0:
print(-1) | 7 | PYTHON3 |
#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;
}
}
}
| 7 | CPP |
for i in range(int(input())):
n=int(input())
chk=[int(i) for i in input().split()]
if(chk[0]+chk[1]>chk[-1]):
print(-1)
else:
print(1,2,n) | 7 | PYTHON3 |
#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();
}
| 7 | CPP |
t=int(input())
for i in range(t):
n=int(input())
l=list(map(int,input().split()))
if l[-1]<l[0]+l[1]:
print(-1)
else:
print(1,2,n)
| 7 | PYTHON3 |
t = int(input())
for _ in range(t):
n = int(input())
s = list(map(int,input().split()))
i=0
j=1
k=-1
z=j+1
while z<n:
if s[i]+s[j]<=s[z]:
k=z
break
else:
z+=1
if k==-1:
print(k)
else:
print(str(i+1)+" "+str(j+1)+" "+str(k+1)) | 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 |
# 3
# 7
# 4 6 11 11 15 18 20
# 4
# 10 10 10 11
# 3
# 1 1 1000000000
def subString(test_str):
res = [test_str[i: j] for i in range(len(test_str))for j in range(i + 1, len(test_str) + 1)]
return res
for i in range(int(input())):
n = int(input())
l =list(map(int,input().split()))
if l[0]+l[1] > l[n-1]:
print(-1)
else:
print("{} {} {}".format(1,2,n))
| 7 | PYTHON3 |
#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;
}
| 7 | CPP |
#!/usr/bin/env python3
import sys
input = sys.stdin.readline
t = int(input())
for _ in range(t):
n = int(input())
a = [int(item) for item in input().split()]
if a[0] + a[1] <= a[-1]:
print(1, 2, n)
else:
print(-1) | 7 | PYTHON3 |
def solve(n,ar):
if ar[n-1] >= ar[0]+ar[1]:
print(1, 2, n)
else:
print(-1)
if __name__ == '__main__':
t = int(input())
for _ in range(t):
n = int(input())
ar = list(map(int,input().split()))
solve(n,ar) | 7 | PYTHON3 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.