solution
stringlengths 11
983k
| difficulty
int64 0
21
| language
stringclasses 2
values |
---|---|---|
n = int(input())
for i in range(n):
t = int(input())
l = input()
i_l = [int(x) for x in l.split(" ")]
if i_l[t-1] >= (i_l[0] + i_l[1]):
print("1 2 " + str(t))
else:
print("-1") | 7 | PYTHON3 |
for _ in range(int(input())):
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 |
ll = lambda: list(map(int, input().split()))
lls=lambda: list(map(str, input().split()))
st= lambda: input()
v = lambda: map(int, input().split())
ii = lambda: int(input())
from math import *
from sys import *
from datetime import datetime
from sys import stdin, stdout
import sys
def lcm(a,b):
return (a*b)//gcd(a,b)
from collections import *
def modFact(n):
p=(10**9)+7
if n >= p:
return 0
result = 1
for i in range(1, n + 1):
result = (result * i) % p
return result
def sol(y,i,cost):
if(i>=len(y)-1):
return cost
o=sol(y,i+1,cost)
e=sol(y,i+2,cost)
if(abs(y[i]-o)>abs(e-y[i])):
cost+=abs(y[i]-e)
else:
cost+=abs(y[i]-o)
for _ in range(ii()):
n=ii()
l=ll()
a=l[0]+l[1]
f=1
for i in range(2,n):
if(a<=l[i]):
f=0
break
if(f):
print(-1)
else:
print(1,2,i+1)
# x=ii()
# y=ll()
# cost=y[0]
# print(sol(y,0,cost))
# print(cost)
| 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,2,n)
else:
print(-1) | 7 | PYTHON3 |
t = int(input())
for _ in range(t):
n = int(input())
inp = [int(i) for i in input().split()]
if inp[0]+inp[1] <= inp[n-1]:
print(1, 2, n)
else:
print(-1)
| 7 | PYTHON3 |
def solve(n,arr):
if arr[0] + arr[1] > arr[-1]:
print("-1")
else:
print(f"1 2 {n}")
t=int(input())
for i in range(t):
n=int(input())
arr=list(map(int,input().split()))
solve(n,arr)
| 7 | PYTHON3 |
import sys
inp=sys.stdin.buffer.read().split(b"\n");_ii=-1
def rdln():
global _ii
_ii+=1
return inp[_ii]
inin=lambda: int(rdln())
inar=lambda: [int(x) for x in rdln().split()]
inst=lambda: rdln().strip().decode()
_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>
int main() {
int t;
scanf("%d", &t);
while (t--) {
long long int n, i, j, k, f = 0;
scanf("%lld", &n);
long long int a[n];
for (i = 0; i < n; i++) scanf("%lld", &a[i]);
if (a[0] + a[1] <= a[n - 1])
printf("1 2 %lld\n", n);
else
printf("-1\n");
}
return 0;
}
| 7 | CPP |
def solve():
N = int(input())
A = list(map(int, input().split()))
if A[0] + A[1] <= A[-1]:
return '{} {} {}'.format(1, 2, N)
return '-1'
TC = int(input())
for _ in range(TC):
print(solve()) | 7 | PYTHON3 |
for _ in range(int(input())):
i,a=int(input()),list(map(int,input().split()))
[print('1 2 {}'.format(str(i)) if a[0]+a[1]<=a[i-1] else '-1')] | 7 | PYTHON3 |
from bisect import *
T = int(input())
for i in range(T):
N = int(input())
A = list(map(int, input().split()))
for i in range(N-2):
if A[i]+A[i+1]>A[-1]:
continue
ind = bisect_left(A,A[i]+A[i+1])+1
print(i+1,i+2,ind)
break
else:
print(-1)
| 7 | PYTHON3 |
for _ in range(int(input())):
n = int(input())
a = list(map(int, input().split()))
f = False
s = a[0] + a[1]
if s <= a[-1]:
print(1, 2, n)
else:
print(-1)
| 7 | PYTHON3 |
import math
for _ in range(int(input())):
n = int(input())
arr = list(map(int, input().split()))
a,b = arr[0], arr[1]
c = -1
for i in range(2, n):
if(arr[i]>= a+b):
c = i+1
break
if(c!= -1):
print(1,2,c)
else:
print(-1)
| 7 | PYTHON3 |
def answ():
x=int(input())
s=list(map(int,input().split()))
a=s[0]
b=s[1]
for n in range(x-1,1,-1):
c=s[n]
if a+b<=c or a+c<=b or b+c<=a:
print(1,2,n+1)
return
b=s[-1]
for n in range(x-2,0,-1):
c=s[n]
if a+b<=c or a+c<=b or b+c<=a:
print(1,n+1,x)
return
print(-1)
for i in range(int(input())):
answ()
| 7 | PYTHON3 |
def do():
n = int(input())
dat = list(map(int, input().split()))
dat.sort()
a = dat[0] + dat[1]
for i in range(2, n):
if dat[i] >= a:
print(1,2, i+1)
return
print(-1)
q = int(input())
import bisect
for _ in range(q):
do() | 7 | PYTHON3 |
l=[]
for _ in range(int(input())):
n=int(input())
a=list(map(int,input().split()))
if a[0]+a[1]>a[-1]:
l.append(-1)
else:
l.append(f"{1} {2} {len(a)}")
for i in l:
print(i) | 7 | PYTHON3 |
t = int(input())
for _ in range(t):
n = int(input())
a = list(map(int,input().split()))
flag = 0
if(a[0]+a[1]<=a[-1]):
print(1,2,n)
else:
print(-1) | 7 | PYTHON3 |
def fun(arr,N):
l=[1,2,N]
#print("sum of 1 and 2 elem: {}".format(arr[0]+arr[1]))
#print("value of N-1: {}".format(arr[N-1]))
if(arr[0]+arr[1]>arr[N-1]):
l1=[-1]
return l1
else:
return l
out=[]
test=int(input())
for x in range(test):
N=int(input())
arr=list(map(int,input().split()))
out.append(fun(arr,N))
for x in range(len(out)):
for k in range(len(out[x])):
#print("len of column: {}".format(len(out[x])))
print(out[x][k],end=" ")
if x<len(out)-1:
print()
| 7 | PYTHON3 |
from random import randint
t = int(input())
for _ in range(t):
n = int(input())
arr = [int(j) for j in 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;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
const long long maxn = 3e6;
const long long mod = 1e9 + 7;
const long double PI = acos((long double)-1);
long long pw(long long a, long long b, long long md = mod) {
long long res = 1;
while (b) {
if (b & 1) {
res = (a * res) % md;
}
a = (a * a) % md;
b >>= 1;
}
return (res);
}
int n, q;
int a[maxn];
int srt[maxn];
bool comp(int i, int j) { return (a[i] < a[j]); }
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
cin >> q;
while (q--) {
cin >> n;
for (int i = 1; i <= n; i++) {
cin >> a[i];
srt[i] = i;
}
sort(srt + 1, srt + 1 + n, comp);
int x = a[srt[1]], y = a[srt[2]], z = a[srt[n]];
if (z < x + y) {
cout << -1 << '\n';
continue;
} else {
int b[] = {srt[1], srt[2], srt[n]};
sort(b, b + 3);
cout << b[0] << ' ' << b[1] << ' ' << b[2] << '\n';
}
}
return (0);
}
| 7 | CPP |
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 |
# -*- coding: utf-8 -*-
"""
Created on Fri Aug 14 20:27:10 2020
@author: Dark Soul
"""
t=int(input(''))
arr=[]
for i in range(t):
int(input(''))
arr.append(list(map(int,input().split())))
for i in arr:
n=len(i)
s=i[0]+i[1]
flag=0
for j in range(2,n):
if i[j]>=s:
print(1,2,j+1)
flag=1
break
if flag==0:
print(-1) | 7 | PYTHON3 |
from collections import defaultdict as dd
import sys
input=sys.stdin.readline
t=int(input())
while t:
n=int(input())
#n,m=map(int,input().split())
l=list(map(int,input().split()))
lol=0
if(l[0]+l[1]<=l[-1]):
print(1,2,n)
lol=1
if(lol==0):
print(-1)
t-=1
| 7 | PYTHON3 |
t=int(input())
for t 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 |
t = int(input())
while t:
n = int(input())
a = list(map(int, input().split()))
if a[0] + a[1] <= a[-1]:
print("1 2 {}".format(n))
else:
print(-1)
t -= 1
| 7 | PYTHON3 |
#include <bits/stdc++.h>
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
long long int t, i, j, a, n;
cin >> t;
while (t--) {
cin >> n;
long long int a[n + 5], f = 0;
for (i = 0; i < n; i++) cin >> a[i];
for (i = 0; i < n - 2; i++) {
if (a[i] + a[i + 1] <= a[n - 1]) {
cout << i + 1 << " " << i + 2 << " " << n << '\n';
f = 1;
break;
}
}
if (f == 0) cout << -1 << '\n';
}
return 0;
}
| 7 | CPP |
# for _ in range(int(input())):
# s = input()
# z = []
# c = 0
# for i in range(len(s)):
# if s[i]=="1":
# c+=1
# else:
# if c:
# z.append(c)
# c=0
# if c:
# z.append(c)
# z.sort(reverse=True)
# su = 0
# if z:
# for i in range(0,len(z),2):
# su+= z[i]
#
# print(su)
for _ in range(int(input())):
n = int(input())
l = list(map(int, input().rstrip().split(" ")))
if l[1]+l[0] <= l[-1]:
print(1,2,n)
else:
print(-1)
| 7 | PYTHON3 |
for _ in range(int(input())):
n=int(input())
a=list(map(int,input().split()))
print(*([1,2,n],[-1])[a[0]+a[1]>a[n-1]]) | 7 | PYTHON3 |
t=int(input(""))
while t>0:
n=int(input(""))
a=list(map(int,input().split()))
if(a[0]+a[1]<=a[-1]):
print(1,2,n)
elif(a[0]<=(a[-1]-a[-2])):
print(1,n,n-1)
else:
print(-1)
t-=1 | 7 | PYTHON3 |
Q=int(input())
for q in range(Q):
N=int(input())
L=list(map(int,input().split()))
L.sort()
if L[-1]>=(L[0]+L[1]):
print(1,2,N)
else:
print(-1) | 7 | PYTHON3 |
for j in range(int(input())):
n=int(input())
l=list(map(int,input().split()))
if len(l)==3:
if l[0]+l[1]<=l[2]:
print(1,2,3)
else:
print(-1)
else:
x=0
for i in range(len(l)-2):
if l[i]+l[i+1]<=l[-1]:
print(i+1,i+2,len(l))
x=1
break
if x==0:
print(-1) | 7 | PYTHON3 |
for i in range(int(input())):
numLen = int(input())
nums = input()
nums = list(map(int, nums.split()))
numLen = len(nums) # more reliable than usr input
if numLen < 3: # prevent hacking
print(-1)
continue
answer = False
for x in range(numLen):
if x == numLen-1: break
a = nums[x]
b = nums[x+1]
c = nums[numLen-x-1]
if not a+b>c and a+c>b and b+c>a:
print(" ".join(list(map(str, [x+1, x+2, numLen-x]))))
answer = True
break
if not answer: print(-1)
| 7 | PYTHON3 |
n = int(input().strip())
printing = []
for test in range(n):
m = input()
a = input().strip().split(" ")
b= []
for c in a:
b.append(int(c))
b.sort()
if int(b[0]) + int(b[1]) <= int(b[-1]):
d = []
d.append(a.index(str(b[0]))+1)
d.append(a.index(str(b[1]))+1)
count = 0
while d[1] == d[0]:
a[int(d[0])-1]=-1
d[1] = a.index(str(b[1]))+1
d.append(a.index(str(b[-1]))+1)
d.sort()
printing.append(" ".join(map(str,d)))
else:
printing.append("-1")
for item in printing:
print(item)
| 7 | PYTHON3 |
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,2,n)
else:
print(-1) | 7 | PYTHON3 |
t = int(input())
def solve(n, a):
if a[0] + a[1] <= a[-1]:
print(1, 2, n)
return
else:
print(-1)
return
for _ in range(t):
n = int(input())
a = list(map(int, input().split()))
solve(n, a)
| 7 | PYTHON3 |
t=int(input())
for _ in range(t):
flag=0
n=int(input())
inp=list(map(int,input().split()))
if inp[0]+inp[1]<=inp[-1]:
print (1,end=" ")
print (2,end=" ")
print (len(inp))
continue
else:
print (-1) | 7 | PYTHON3 |
import sys
input=sys.stdin.buffer.readline
inin=lambda: int(input())
inar=lambda: list(map(int,input().split()))
inst=lambda: input().decode().rstrip('\n\r')
INF=float('inf')
#from collections import deque as que, defaultdict as vector, Counter
#from bisect import bisect as bsearch
#from heapq import heapify, heappush as hpush, heappop as hpop
'''from types import GeneratorType
def recursive(f, stack=[]):
def wrappedfunc(*args, **kwargs):
if stack:
return f(*args, **kwargs)
else:
to = f(*args, **kwargs)
while True:
if type(to) is GeneratorType:
stack.append(to)
to = next(to)
else:
stack.pop()
if not stack:
break
to = stack[-1].send(to)
return to
return wrappedfunc'''
_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 |
### START FAST IO ###
import os
os_input = os.read(0, int(1e7)).split()
os_input_pos = -1
answer_list = []
def read_s():
global os_input_pos
os_input_pos += 1
return os_input[os_input_pos].decode()
def read_i():
return int(read_s())
def write_s(v):
answer_list.append(v)
def write_i(v):
write_s(str(v))
def print_ans():
os.write(1, "\n".join(answer_list).encode())
os.write(1, "\n".encode())
#### END FAST IO ####
### START ITERATE RECURSION ###
from types import GeneratorType
def iterative(f, stack=[]):
def wrapped_func(*args, **kwargs):
if stack: return f(*args, **kwargs)
to = f(*args, **kwargs)
while True:
if type(to) is GeneratorType:
stack.append(to)
to = next(to)
else:
stack.pop()
if not stack: break
to = stack[-1].send(to)
return to
return wrapped_func
#### END ITERATE RECURSION ####
T = read_i()
while T:
T -= 1
n = read_i()
a = sorted([(read_i(), i+1) for i in range(n)])
if a[0][0] + a[1][0] > a[-1][0]:
write_i(-1)
else:
ans = sorted([a[0][1], a[1][1], a[-1][1]])
write_s(" ".join([str(x) for x in ans]))
print_ans()
| 7 | PYTHON3 |
#Consistency is the key.
#code by: amrit00
from sys import stdin,stdout
import math
input=stdin.readline
def print(*args,end='\n'):
s=[]
for i in args:
s.append(str(i)+' ')
s=''.join(s)
stdout.write(s+end)
def solve():
n=int(input())
l=list(map(int,input().split()))
if l[0]+l[1]<=l[-1]:
print(1,2,n)
else:
print(-1)
tt=1
tt=int(input())
for __ in range(tt):
solve()
| 7 | PYTHON3 |
t = int(input())
while t:
t -= 1
n = int(input())
arr = list(map(int,input().split()))
i = 0
# for i in range(n-2):
if arr[i]+arr[i+1]<= arr[n-1]:
print(i+1,i+2,n)
else:
print(-1)
| 7 | PYTHON3 |
def solve():
n=int(input())
arr=[int(i) for i in input().split()]
arr.sort()
if(arr[0]+arr[1]<=arr[-1]):
print(1,2,n)
return
print(-1)
test=int(input())
while test:
solve()
test-=1
| 7 | PYTHON3 |
for _ in range(int(input())):
n = int(input())
a = list(map(int, input().split()))
mi, mi_idx, ma, ma_idx = 10**10, 0, 0, 0
for i in range(n):
if a[i] < mi:
mi, mi_idx = a[i], i
if a[i] > ma:
ma, ma_idx = a[i], i
ans = [mi_idx+1, ma_idx+1]
for i in range(n):
if i == mi_idx or i == ma_idx:
continue
if not(mi-ma < a[i] < mi+ma and mi-a[i] < ma < mi+a[i] and ma-a[i] < mi < ma+a[i]):
ans.append(i+1)
break
if len(ans) == 2:
print(-1)
else:
print(*sorted(ans)) | 7 | PYTHON3 |
for _ in range(int(input())):
n = int(input())
x = list(map(int, input().split()))
if x[0] + x[1] <= x[-1]:
print(1, 2, n)
else:
print(-1) | 7 | PYTHON3 |
for _ in range(int(input())):
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())
for _ in range(t):
n=int(input())
a=list(map(int,input().split(" ")))
chk=0
for x in range(n-2):
if a[x]+a[x+1]<=a[n-1]:
print(x+1,x+2,n)
chk=1
break;
if chk==0:
print(-1) | 7 | PYTHON3 |
import math
for i in range(int(input())):
n = int(input())
ar = list(map(int,input().split()))
if ar[0] + ar[1] <= ar[-1]:
print(1,2,n)
else:
print(-1)
| 7 | PYTHON3 |
t=int(input())
while(t>0):
n=int(input())
a=list(map(int,input().split()))
s=a[0]+a[1]
ans=-1
for i in range(2,n):
if(a[i]>=s):
ans=i
else:
continue
if(ans!=-1):
print("1 2 "+str(ans+1))
else:
print(ans)
t-=1
| 7 | PYTHON3 |
import sys
def input(): return sys.stdin.readline().strip()
def iinput(): return int(input())
def rinput(): return map(int, sys.stdin.readline().strip().split())
def get_list(): return list(map(int, sys.stdin.readline().strip().split()))
mod = int(1e9)+7
def checkValidity(a, b, c):
if (a + b <= c) or (a + c <= b) or (b + c <= a) :
return True
else:
return False
for _ in range(iinput()):
n = iinput()
a = get_list()
if checkValidity(a[0], a[1], a[-1]):
print(1, 2, n)
else:
print(-1) | 7 | PYTHON3 |
import sys
input = sys.stdin.readline
ins = lambda: input().rstrip()
ini = lambda: int(input().rstrip())
inm = lambda: map(int, input().split())
inl = lambda: list(map(int, input().split()))
ans = []
t = ini()
for _ in range(t):
n = ini()
a = inl()
if a[0] + a[1] <= a[n-1]:
ans.append(f"{1} {2} {n}")
else:
ans.append("-1")
print('\n'.join(ans)) | 7 | PYTHON3 |
t=int(input())
while t:
t-=1
n=int(input())
lst=list(map(int,input().split()))
res=-1
a=lst[0]
b=lst[1]
if n==3:
if a+b<=lst[2]:
res=3
else:
for i in range(2,n):
if a+b<=lst[i]:
res=i+1
break
if res==-1:
print(-1)
else:
print(1,2,res) | 7 | PYTHON3 |
for i in range(int(input())):
n=int(input())
l=list(map(int,input().split()))
if (l[0]+l[1]<=l[len(l)-1]):
print(1,2,len(l))
else:
print(-1) | 7 | PYTHON3 |
# [int(s) for s in input().split()]
# int(input())
# input()
T = int(input())
for t in range(1,T+1):
N = int(input())
A = [int(s) for s in 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(void) {
int n;
cin >> n;
while (n--) {
int t;
cin >> t;
map<int, int> mp;
int a[t], b[3];
for (int i = 0; i < t; i++) {
cin >> a[i];
mp[a[i]] = i + 1;
}
sort(b, b + 3);
if (a[0] + a[1] > a[t - 1]) {
cout << -1;
} else {
cout << 1 << " " << 2 << " " << t;
}
cout << endl;
}
}
| 7 | CPP |
def solve(n, a):
a, b, c = a[0], a[1], a[-1]
if a + b > c:
print(-1)
else:
print(1, 2, n)
return
def main():
inp = lambda: [int(x) for x in input().split()]
tc = int(input())
for _ in range(tc):
n, a = int(input()), inp()
solve(n, a)
if __name__ == '__main__':
main()
| 7 | PYTHON3 |
def no_triangle(arr):
arr.sort()
if arr[0]+arr[1]<=arr[-1]:
l = [1,2,len(arr)]
else:
l = []
return l
t = int(input())
for _ in range(t):
n = int(input())
arr = list(map(int,input().split()))
result = no_triangle(arr)
if result:
print(*result,sep=" ")
else:
print(-1) | 7 | PYTHON3 |
test=int(input())
for _ in range(test):
n=int(input())
list1=list(map(int,input().split()))
if list1[0]+list1[1]<=list1[n-1]:
print(1,2,n)
else:
print("-1") | 7 | PYTHON3 |
#include <bits/stdc++.h>
using namespace std;
int main() {
int t;
cin >> t;
while (t--) {
int n, flag1 = 0, flag2 = 0;
cin >> n;
long long a[n];
for (int i = 0; i < n; i++) cin >> a[i];
if ((a[0] + a[1]) <= a[n - 1]) {
cout << "1 "
<< "2 " << n << endl;
} else {
cout << "-1" << endl;
}
}
return 0;
}
| 7 | CPP |
# cook your dish here
t = int(input())
while t>0:
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 = t-1 | 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,2,n)
else :
print(-1) | 7 | PYTHON3 |
t = int(input())
for _ in range(t):
n = int(input())
v = [int(x) for x in input().split()]
if v[0] + v[1] <= v[-1]:
print(1,2,n)
else:
print(-1)
| 7 | PYTHON3 |
#include <bits/stdc++.h>
using namespace std;
struct HASH {
static uint64_t splitmix64(uint64_t x) {
x += 0x9e3779b97f4a7c15;
x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
return x ^ (x >> 31);
}
size_t operator()(uint64_t x) const {
static const uint64_t FIXED_RANDOM =
chrono::steady_clock::now().time_since_epoch().count();
return splitmix64(x + FIXED_RANDOM);
}
static uint64_t splitmix64(const pair<long long, long long>& p) {
static const uint64_t FIXED_RANDOM =
chrono::steady_clock::now().time_since_epoch().count();
long long x = p.first + FIXED_RANDOM, y = p.second + FIXED_RANDOM;
x += 0x9e3779b97f4a7c15;
x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
y += 0x9e3779b97f4a7c15;
y = (y ^ (y >> 30)) * 0xbf58476d1ce4e5b9;
y = (y ^ (y >> 27)) * 0x94d049bb133111eb;
return x ^ (x >> 31) ^ y ^ (y >> 31);
}
size_t operator()(const pair<long long, long long>& p) const {
static const uint64_t FIXED_RANDOM =
chrono::steady_clock::now().time_since_epoch().count();
return splitmix64(p);
}
};
const int dx4[4] = {-1, 0, 1, 0}, dy4[4] = {0, 1, 0, -1};
const int dx8[8] = {-1, -1, 0, 1, 1, 1, 0, -1},
dy8[8] = {0, 1, 1, 1, 0, -1, -1, -1};
int n;
string str;
void solve() {
int m, a, b, c;
cin >> n;
int arr[n];
for (int i = 0; i < (int)n; i++) cin >> arr[i];
sort(arr, arr + n);
if (arr[0] + arr[1] <= arr[n - 1]) {
cout << "1 2 " << n << endl;
return;
}
cout << "-1\n";
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
;
int tc = 1;
cin >> tc;
while (tc--) {
solve();
}
return 0;
}
| 7 | CPP |
#!/usr/bin/env python3
import io
import os
import sys
input = io.BytesIO(os.read(0,os.fstat(0).st_size)).readline
def prdbg(*args, **kwargs):
print(*args, **kwargs)
pass
def get_str():
return input().decode().strip()
def rint():
return map(int, input().split())
def oint():
return int(input())
t = oint()
for _ in range(t):
n = oint()
a = list(rint())
b = a[0] + a[1]
for i in range(n-1, 1, -1):
if a[i] >= b:
print(1, 2, i+1)
break
else:
print(-1)
| 7 | PYTHON3 |
for j in range(int(input())):
a = int(input())
li = list(map(int,input().split()))
ma = li[a-1]
mi = li[0]
val = ma - mi
for j in range(1,a):
if li[j] <=val:
mid = j
print(1,j+1,a)
break
else:
print(-1)
| 7 | PYTHON3 |
# 2200 rating
t=int(input())
for i in range(t):
n=input()
l=list(map(int,input().split()))
# print(l)
if l[0]+l[1]<=l[-1]:
print(1,2,n)
else:
print(-1) | 7 | PYTHON3 |
t = int(input())
for _ in range(t):
n = int(input())
a = [int(i) for i in input().split()]
if a[0] + a[1] <= a[-1]:
print(1, 2, n)
else:
print(-1)
| 7 | PYTHON3 |
t = int(input())
for _ in range(t):
n = int(input())
a = list(map(int,input().split()))
flag = 0
for i in range(2,n):
if(a[0]+a[1]<=a[i]):
print(1,2,i+1)
flag = 1
break
if (flag==0):
print(-1)
| 7 | PYTHON3 |
import sys
input = sys.stdin.readline
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("{} {} {}".format(1,2,n))
else:
print(-1) | 7 | PYTHON3 |
t = int(input())
for i in range(t):
n = int(input())
mas = list(map(int, input().split()))
if (len(mas) < 3):
print(-1)
else:
if (mas[0]+mas[1] > mas[-1]):
print(-1)
else:
print(1,2,len(mas)) | 7 | PYTHON3 |
def triangle(a,b,c):
if a+b>c and b+c>a and a+c>b:
return True
else:
return False
for _ in range(int(input())):
a = int(input())
b = list(int(x) for x in input().split())
if triangle(b[0],b[1],b[-1])==False:
print(1,2,a)
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[50001];
for (int i = 0; i < n; i++) cin >> a[i];
if (a[0] + a[1] > a[n - 1]) {
cout << -1 << endl;
} else {
cout << 1 << " " << 2 << " " << n << endl;
}
}
return 0;
}
| 7 | CPP |
t=int(input())
for _ in range(t):
n=int(input())
a=list(map(int,input().split()))
a.sort()
if a[0]+a[1]<=a[-1]:
print(1,2,n)
else:
print(-1) | 7 | PYTHON3 |
for i in range(int(input())):
n=int(input())
l=list(map(int,input().split()))
for i in range(2,len(l)):
if l[0]+l[1]<=l[i]:
print(1,2,i+1)
break
else:
print(-1) | 7 | PYTHON3 |
for _ in range(int(input())):
n=int(input())
l=list(map(int,input().split()))
c=l[n-1]
ok=False
p,q,r=0,0,0
for i in range(1,n-1):
if l[i]+l[i-1]<= c:
p,q=i,i-1
ok=True
if(ok):
print(q+1,p+1,n)
else:
print("-1") | 7 | PYTHON3 |
def solve(a):
if a[0] + a[1] <= a[-1]:
return 1, 2, len(a)
return [-1]
for _ in range(int(input())):
n = int(input())
a = [int(x) for x in input().split()]
print(*solve(a))
| 7 | PYTHON3 |
#import sys
#input = sys.stdin.readline
def solve():
n = int( input())
A = list( map( int, input().split()))
if A[0] + A[1] <= A[-1]:
return " ".join( map( str, [1,2,n]))
else:
return -1
def main():
t = int( input())
ANS = [ solve() for _ in range(t)]
print("\n".join( map(str, ANS)))
if __name__ == '__main__':
main()
| 7 | PYTHON3 |
for _ in range(int(input())):
n=int(input())
a=[int(i) for i in input().split()]
if a[0]+a[1]<=a[n-1]:
print(1,2,n)
else:
print(-1) | 7 | PYTHON3 |
t = int(input())
for _ in range(t):
n = int(input())
l1 = [int(x) for x in input().split()]
flag = 0
if l1[0]+l1[1]<=l1[-1]:
flag = 1
if flag:
print(1,2,n)
else:
print(-1) | 7 | PYTHON3 |
#include <bits/stdc++.h>
#pragma GCC optimizer("O3")
#pragma GCC target("sse4")
using namespace std;
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int t;
cin >> t;
while (t--) {
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 << " " << 2 << " " << n << endl;
} else
cout << "-1\n";
}
}
| 7 | CPP |
t = int(input().split()[0])
for case in range(t):
n = int(input().split()[0])
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 i in range(t):
n=int(input())
list1=list(map(int,input().split()))
for i in range(n-1):
j=i+1
if (list1[i]+list1[j])>list1[n-1]:
print(-1)
break
else:
print(i+1,j+1,n)
break | 7 | PYTHON3 |
#include <bits/stdc++.h>
using namespace std;
int32_t main() {
long long t;
cin >> t;
while (t--) {
long long n;
cin >> n;
long long arr[n];
for (long long i = 0; i < n; i++) {
cin >> arr[i];
}
vector<long long> ans;
long long temp = arr[n - 1] - arr[0];
long long i = 0;
for (i = 1; i < n; i++) {
if (arr[i] <= temp) {
cout << "1 " << i + 1 << " " << n << "\n";
break;
}
}
if (i == n) {
cout << "-1\n";
}
}
}
| 7 | CPP |
import sys
inp=sys.stdin.buffer.read().split(b"\n");_ii=-1
def rdln():
global _ii
_ii+=1
return inp[_ii]
inin=lambda typ=int: typ(rdln())
inar=lambda typ=int: [typ(x) for x in rdln().split()]
inst=lambda: rdln().strip().decode()
_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;
int main() {
int t, n, val;
vector<int> v;
cin >> t;
for (int i = 0; i < t; i++) {
cin >> n;
for (int j = 0; j < n; j++) {
cin >> val;
v.push_back(val);
}
if (v[0] + v[1] > v[n - 1]) {
cout << -1 << endl;
} else {
cout << "1 "
<< "2 " << n << endl;
}
v.clear();
}
return 0;
}
| 7 | CPP |
test_case = int(input())
for _ in range(test_case):
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 |
for _ in range(int(input())):
i_liczb = int(input())
liczby = list(map(int, input().split()))
a, b, c = liczby[0], liczby[1], liczby[-1]
if a + b <= c:
print(1, 2, i_liczb)
else:
print(-1) | 7 | PYTHON3 |
#include <bits/stdc++.h>
using namespace std;
int main() {
int t;
cin >> t;
vector<vector<int>> v(t);
int n;
int temp;
for (int i = 0; i < t; i++) {
cin >> n;
v[i].reserve(n);
for (int j = 0; j < n; j++) {
cin >> temp;
v[i].push_back(temp);
}
}
for (int i = 0; i < t; i++) {
if (v[i][v[i].size() - 1] >= v[i][0] + v[i][1])
cout << 1 << " " << 2 << " " << v[i].size() << endl;
else
cout << -1 << endl;
}
return 0;
}
| 7 | CPP |
t = int(input())
while(t>0):
n = int(input())
arr = list(map(int, input().split()))
if(arr[0]+arr[1]>arr[n-1]):
print(-1)
else:
print(1, 2, n)
t-=1
| 7 | PYTHON3 |
#include <bits/stdc++.h>
using namespace std;
int main() {
int t;
cin >> t;
while (t--) {
long long int n;
cin >> n;
long long int a[n];
for (int i = 0; i < n; i++) cin >> a[i];
if (a[0] + a[1] > a[n - 1])
cout << -1 << endl;
else
cout << 1 << " " << 2 << " " << n << endl;
}
return 0;
}
| 7 | CPP |
#include <bits/stdc++.h>
using namespace std;
void solve(bool& flag) {
int n;
cin >> n;
vector<int> a(n);
for (int i = 0; i < n; i++) {
cin >> a[i];
}
if (n < 3) {
return;
} else {
if (a[0] + a[1] <= a[n - 1]) {
cout << 1 << " " << 2 << " " << n << endl;
flag = true;
}
}
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
int test;
cin >> test;
while (test--) {
bool flag = false;
solve(flag);
if (not flag) {
cout << -1 << endl;
}
}
}
| 7 | CPP |
t = int(input())
for _ in range(t):
n = int(input())
a = list(map(int,input().split(' ')))
i,j,k = 0,1,2
while i < n-2:
while j < n-1 :
while k < n:
if a[i] + a[j] <= a[k]:
print(i+1,j+1,k+1)
i,j,k = n,n,n
break
else:
k += 1
j += 1
i += 1
if i == n-2 and j == n - 1 and k == n:
print(-1)
| 7 | PYTHON3 |
#!/usr/bin/env python
import os
import re
import sys
from bisect import bisect, bisect_left, insort, insort_left
from collections import Counter, defaultdict, deque
from copy import deepcopy
from decimal import Decimal
from fractions import gcd
from io import BytesIO, IOBase
from itertools import (
accumulate, combinations, combinations_with_replacement, groupby,
permutations, product)
from math import (
acos, asin, atan, ceil, cos, degrees, factorial, hypot, log2, pi, radians,
sin, sqrt, tan)
from operator import itemgetter, mul
from string import ascii_lowercase, ascii_uppercase, digits
def inp():
return(int(input()))
def inlist():
return(list(map(int, input().split())))
def instr():
s = input()
return(list(s[:len(s)]))
def invr():
return(map(int, input().split()))
def main():
t = inp()
for _ in range(t):
n = inp()
d = inlist()
a = d[0]
b = d[1]
c = d[-1]
if a + b > c and a + c > b and b + c > a:
print(-1)
else:
print(1, 2, n)
# region fastio
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)
def input(): return sys.stdin.readline().rstrip("\r\n")
# endregion
if __name__ == "__main__":
main()
| 7 | PYTHON3 |
t=int(input())
dict={}
for i in range(t):
a=input()
b=input().split(" ")
m=len(b)
for i in range(m):
if int(b[0])+int(b[1])>int(b[m-1]):
print(-1)
break
else:
print(1,2,m)
break
| 7 | PYTHON3 |
t=int(input())
for i in range(t):
n=int(input())
a=[int(v) for v in input().split()]
p=a[0]
q=a[1]
r=a[-1]
if p+q<=r:
print(1,2,n)
else:
print(-1) | 7 | PYTHON3 |
t = int(input())
for _ in range(t):
n = int(input())
arr = list(map(int,input().split()))
print("-1" if arr[0]+arr[1]>arr[n-1] else f"1 2 {n}") | 7 | PYTHON3 |
def tc():
n = int(input())
a = list(map(int, input().split()))
if a[0] + a[1] > a[-1]:
print(-1)
else:
print(1, 2, n)
#################
T = int(input())
for _ in range(T):
tc()
| 7 | PYTHON3 |
for time in range(int(input())):
l=int(input())
op=[]
rt=input().split()
op=rt
for er in range(l):
op[er]=int(op[er])
x=op[0]
y=op[1]
z=op[-1]
if z>=x+y:
print(1,2,l)
else:
print(-1) | 7 | PYTHON3 |
T=int(input())
for t in range(T):
n=int(input())
l=[int(k) for k in input().split()]
i=0
j=1
k=2
f=0
for m in range(2,n):
if(l[i]+l[j]<=l[m]):
k=m
f=1
break
if(f==1):
print(i+1,j+1,k+1)
else:
print(-1) | 7 | PYTHON3 |
import io,os
from collections import deque
import bisect
from collections import deque
#input = io.BytesIO(os.read(0,os.fstat(0).st_size)).readline
RL = lambda : list(map(int, input().split(' ')))
T = int(input())
for _ in range(T):
n = int(input())
l = RL()
if l[0]+l[1]<=l[-1]:
print(1,2,n)
else:
print(-1) | 7 | PYTHON3 |
import sys #
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 |
t = int(input())
for i in range(t):
a = [-1]
n=int(input())
arr = list(map(int,input().split()))
for j in range(2,n):
if arr[0]+arr[1]<=arr[j]:
a=[1,2,j+1]
for item in a:
print(item, end=" ") | 7 | PYTHON3 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.