solution
stringlengths 11
983k
| difficulty
int64 0
21
| language
stringclasses 2
values |
---|---|---|
t=int(input())
for _ in range(t):
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 |
for _ in range(int(input())):
n=int(input())
a=list(map(int,input().split()))
if(a[0]+a[1]>a[-1]):
print(-1)
else:
print(1,2,n)
| 7 | PYTHON3 |
for _ in range(int(input())):
n = int(input())
ls = list(map(int, input().split()))
if ls[0] + ls[1] > ls[-1]:
print(-1)
else:
print(1, 2, n)
| 7 | PYTHON3 |
T = int(input())
for t in range(T):
n = int(input())
xs = [int(x) for x in input().split()]
# for i in range(len(xs)-2):
# if xs[i]+xs[i+1] >= xs[i+2]:
# print(i+1, i+2, i+3)
# break
# else:
# print(-1)
# lol I thought the prompt was the inverse
if xs[0] + xs[1] <= xs[len(xs)-1]:
print(1, 2, len(xs))
else:
print(-1) | 7 | PYTHON3 |
for i in range(int(input())):
n = int(input())
k = 0
mas = [int(i) for i in input().split()]
for i in range(2, n):
if mas[0] + mas[1] <= mas[i]:
print(1, 2, i+1)
k += 1
break
if k == 0:
print(-1) | 7 | PYTHON3 |
import math
from collections import deque
from sys import stdin, stdout
from string import ascii_letters
input = stdin.readline
#print = stdout.write
letters = ascii_letters[:26]
for _ in range(int(input())):
n = int(input())
arr = list(map(int, input().split()))
first = arr[0]
second = arr[-1]
can = False
res = 0
for i in range(1, n - 1):
if arr[i] + first <= second or arr[i] + second <= first:
can = True
res = i
break
if can:
print(*[1, res + 1, n])
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 |
import math
from collections import Counter,defaultdict
I =lambda:int(input())
M =lambda:map(int,input().split())
LI=lambda:list(map(int,input().split()))
for _ in range(I()):
n=I()
a=LI()
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())
arr = [int(elem) for elem in input().split()]
if arr[0]+arr[1] <= arr[-1]:
print(1, 2, len(arr))
else:
print(-1) | 7 | PYTHON3 |
import math
t=int(input())
for w in range(t):
n=int(input())
l=sorted([int(i) for i in input().split()])
if(l[0]+l[1]>l[-1]):
print(-1)
else:
print(1,2,n) | 7 | PYTHON3 |
t = int(input())
for i in range(0 ,t):
input()
A = list(map(lambda x: int(x), input().split()))
A.sort()
if A[0]+A[1] <= A[-1]:
print(1, 2, len(A))
else:
print(-1) | 7 | PYTHON3 |
t=int(input())
for _ in range(0,t):
n=int(input())
a=list(map(int,input().split()))
p=0
for i in range(len(a)-1,1,-1):
if a[0]+a[1]<=a[i]:
p=1
break
if p==1:
print(1,2,(i+1))
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: sys.stdin.readline().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 |
t = int(input())
for i in range(t):
n = int(input())
s = input().split()
a = list(map(int, s))
if a[0] + a[1] > a[len(a)-1]:
print(-1)
else:
print(1, 2, len(a))
| 7 | PYTHON3 |
from sys import stdin
###############################################################
def iinput(): return int(stdin.readline())
def minput(): return map(int, stdin.readline().split())
def linput(): return list(map(int, stdin.readline().split()))
###############################################################
t = iinput()
while t:
t-=1
n = iinput()
a = linput()
for i in range(2, n):
if a[i] >= a[0]+a[1]:
print(1, 2, i+1)
break
else: print(-1) | 7 | PYTHON3 |
import sys
import math
from functools import reduce
import bisect
def getN():
return int(input())
def getNM():
return map(int, input().split())
def getList():
return list(map(int, input().split()))
def input():
return sys.stdin.readline().rstrip()
def index(a, x):
i = bisect.bisect_left(a, x)
if i != len(a) and a[i] == x:
return i
return False
#############
# MAIN CODE #
#############
for _ in range(int(input())):
n = getN()
arr = getList()
if arr[0] + arr[1] <= arr[-1]:
print(1, 2, n)
else:
print(-1)
| 7 | PYTHON3 |
def run():
num = int(input())
nums = [int(i) for i in input().split()]
if nums[0] + nums[1] <= nums[-1]:
print(1, 2, num)
else:
print(-1)
n = int(input())
for i in range(n):
run()
| 7 | PYTHON3 |
#include <bits/stdc++.h>
using namespace std;
int main() {
int prmin, mn, mx, n, hh, x, prmini, mni = -1, mxi;
cin >> n;
for (int i = 0; i < n; i++) {
cin >> hh;
prmin = 1000000001;
mn = 1000000001;
mx = -1;
for (int j = 0; j < hh; j++) {
cin >> x;
if (x < mn) {
prmin = mn;
mn = x;
prmini = mni;
mni = j;
} else if (x < prmin) {
prmin = x;
prmini = j;
} else if (x > mx) {
mx = x;
mxi = j;
}
}
if (mn + prmin > mx) {
cout << -1 << endl;
} else {
cout << mni + 1 << " " << prmini + 1 << " " << mxi + 1 << endl;
}
}
return 0;
}
| 7 | CPP |
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()
out = False
i = 0
j = 2
while j < n:
if a[i] + a[i+1] <= a[j]:
out = True
break
else:
j += 1
if out:
ans.append(f"{i+1} {i+2} {j+1}")
else:
ans.append("-1")
print('\n'.join(ans)) | 7 | PYTHON3 |
import sys, collections, math
def get_ints(): return map(int, sys.stdin.readline().strip().split())
def get_array(): return list(map(int, sys.stdin.readline().strip().split()))
def input(): return sys.stdin.readline().strip()
mod = 1000000007
for _ in range(int(input())):
n = int(input())
arr = get_array(); flag = False
if (arr[0] + arr[1] > arr[n - 1]):
if (arr[1] + arr[n - 1] > arr[0]):
if (arr[n - 1] + arr[0] > arr[1]):
print(-1)
else:
print(1, 2, n)
else:
print(1,2,n)
else:
print(1,2,n) | 7 | PYTHON3 |
import sys
t = int(sys.stdin.readline())
for _ in range(t):
n = int(sys.stdin.readline())
m = {}
A = list(map(int, sys.stdin.readline().split()))
i = 0
j = n - 2
k = n - 1
f = False
while i < j:
if A[i] + A[j] <= A[k]:
f = True
break
else:
j -= 1
if f:
print(i + 1, j + 1, k + 1)
else:
print(-1)
| 7 | PYTHON3 |
tc=int(input())
for _ in range(tc):
n=int(input())
a=list(map(int,input().split()))
i,j,k=0,1,n-1
if a[i]+a[j]<=a[k]:
print(i+1,j+1,k+1)
else:
print(-1)
| 7 | PYTHON3 |
n = int(input())
for _ in range(n):
a = int(input())
l = list(map(int,input().split()))
if l[0]+l[1]<=l[a-1]:
print(1,2,a,sep = ' ')
else:
print(-1)
| 7 | PYTHON3 |
t=int(input())
for _ in range(t):
n=int(input())
l=list(map(int,input().split()))
flag=0
if(len(l)<=2):
print(-1)
else:
for i in range(n-1):
if(l[i]+l[i+1]<=l[-1]):
flag=1
ans=i+1
ans1=i+2
ans3=n
break
if(flag==0):
print(-1)
else:
print(ans,ans1,ans3) | 7 | PYTHON3 |
t=int(input())
for i in range(t):
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 |
import math
def gcd(a,b):
if (b == 0):
return a
return gcd(b, a%b)
def lcm(a,b):
return (a*b) / gcd(a,b)
def bs(arr, l, r, x):
while l <= r:
mid = l + (r - l)//2;
if(arr[mid]==x):
return arr[mid]
elif(arr[mid]<x):
l = mid + 1
else:
r = mid - 1
return -1
def swap(list, pos1, pos2):
list[pos1], list[pos2] = list[pos2], list[pos1]
return list
def subarrayBitwiseOR(A):
res = set()
pre = {0}
for x in A:
pre = {x | y for y in pre} | {x}
res |= pre
return len(res)
t = int(input())
for _ in range(t):
n = int(input())
a = list(map(int,input().split()))
x = a[0]
y = a[1]
for i in range(2,n):
z = a[i]
if(x+y<=z or y+z<=x or z+x<=y):
print(1,2,i+1)
break
else:
print(-1)
| 7 | PYTHON3 |
for _ in range(int(input())):
n=int(input())
a=list(map(int,input().split()))
if a[n-1] >= a[0] + a[1]:
print(1,2,n)
else:
print(-1) | 7 | PYTHON3 |
for _ in range(int(input())):
n = int(input())
A = list(map(int, input().split()))
if A[0]+A[1] <= A[n-1]:
print(1, 2, n)
else:
print(-1) | 7 | PYTHON3 |
for _ in range(int(input())):
n=int(input())
l=list(map(int,input().split()))
if l[-1]>=l[0]+l[1]:
print(1,2,n)
else:
print(-1) | 7 | PYTHON3 |
#include <bits/stdc++.h>
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
int T;
cin >> T;
while (T--) {
int n, i, j, k;
cin >> n;
int a[n];
vector<pair<int, int>> v;
for (i = 0; i < n; i++) {
cin >> a[i];
v.push_back({a[i], i});
}
sort(v.begin(), v.end());
if (v[0].first + v[1].first <= v[v.size() - 1].first ||
v[0].first + v[v.size() - 1].first <= v[1].first ||
v[v.size() - 1].first + v[1].first <= v[1].first) {
cout << 1 << " " << 2 << " " << v.size() << endl;
} else
cout << -1 << endl;
}
}
| 7 | CPP |
import math
from decimal import Decimal
import heapq
import copy
import heapq
from collections import deque
from collections import defaultdict
MOD = 1000000007
def na():
n = int(input())
b = [int(x) for x in input().split()]
return n,b
def nab():
n = int(input())
b = [int(x) for x in input().split()]
c = [int(x) for x in input().split()]
return n,b,c
def dv():
n, m = map(int, input().split())
return n,m
def da():
n, m = map(int, input().split())
a = list(map(int, input().split()))
return n,m, a
def dva():
n, m = map(int, input().split())
a = [int(x) for x in input().split()]
b = [int(x) for x in input().split()]
return n,m,b
def eratosthenes(n):
sieve = list(range(n + 1))
for i in sieve:
if i > 1:
for j in range(i + i, len(sieve), i):
sieve[j] = 0
return sorted(set(sieve))
def lol(lst,k):
k=k%len(lst)
ret=[0]*len(lst)
for i in range(len(lst)):
if i+k<len(lst) and i+k>=0:
ret[i]=lst[i+k]
if i+k>=len(lst):
ret[i]=lst[i+k-len(lst)]
if i+k<0:
ret[i]=lst[i+k+len(lst)]
return(ret)
def nm():
n = int(input())
b = [int(x) for x in input().split()]
m = int(input())
c = [int(x) for x in input().split()]
return n,b,m,c
def dvs():
n = int(input())
m = int(input())
return n, m
def fact(n):
tc = []
ans = {}
d = 2
while d * d <= n:
if n % d == 0:
tc.append(d)
n //= d
else:
d += 1
if n > 1:
tc.append(n)
for i in tc:
ans[i] = ans.get(i, 0) + 1
return ans
def to_zero(n, s):
lst = s[0]
ans = []
for i in range(n):
if lst == s[i]:
continue
else:
if lst == '0':
lst = '1'
ans.append(i)
else:
lst = '0'
ans.append(i)
if lst == '1':
ans.append(n)
return ans
for _ in range(int(input())):
n, a = na()
if a[-1] < a[0] + a[1]:
print(-1)
else:
print(1, 2, n)
| 7 | PYTHON3 |
T = int(input())
for _ in range(T):
N = int(input())
a = [int(x) for x in input().split()]
if a[0] + a[1] <= a[-1]:
print(1, 2, N)
else: print(-1)
| 7 | PYTHON3 |
for test in range(int(input())):
n = int(input())
arr = list(map(int,input().split()))
if arr[0] + arr[1] > arr[-1]:
print(-1)
else:
print(1,2,n) | 7 | PYTHON3 |
# -*- coding: utf-8 -*-
"""
Created on Fri Aug 14 20:14:36 2020
@author: sachd
"""
t=int(input())
for i in range(t):
n=int(input())
s=input().split()
ls=[]
for j in range(len(s)):
ls.append(int(s[j]))
c=ls[n-1]
a=ls[0]
b=ls[1]
if a+b>c:
print(-1)
else:
print(1),
print(2),
print(n)
| 7 | PYTHON3 |
for _ in range(int(input())):
n = int(input())
a = list(map(int, input().split()))
s = a[0] + a[1]
# i = 2
f = 0
for i in range(2, n):
if a[i] >= s:
print(1, 2, i + 1)
f = 1
break
if f == 0:
print(-1) | 7 | PYTHON3 |
import sys #another one
inp=sys.stdin.buffer.readline
read=lambda: list(map(int,inp().split()))
input=lambda : inp().decode().strip()
_T_,=read()
for _t_ in range(_T_):
n,=read()
a=read()
if a[0]+a[1]>a[n-1]:
print(-1)
else:
print(1,2,n)
| 7 | PYTHON3 |
import os
inp=os.read(0,os.fstat(0).st_size).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 |
T = int(input())
def solve():
n = int(input())
a = list(map(int, input().split()))
#print(a[-1])
if(a[0] + a[1] <= a[-1]):
print("%d %d %d" % (1, 2, n))
else:
print(-1)
for t in range(T):
solve()
| 7 | PYTHON3 |
for _ in range(int(input())):
n=int(input())
a=list(map(int,input().split()))
c=1
if a[-1]>=a[0]+a[1]:
print(1,2,n)
else:print(-1) | 7 | PYTHON3 |
import sys
input = sys.stdin.readline
def inInt():
return int(input())
def inStr():
return input().strip("\n")
def inIList():
return(list(map(int,input().split())))
def inSList():
return(input().split())
def solve(n, nums):
if nums[0] + nums[1] <= nums[len(nums)-1]:
print(1, 2, len(nums))
else:
print("-1")
t = inInt()
for case in range(t):
n = inInt()
nums = inIList()
solve(n, nums) | 7 | PYTHON3 |
n=int(input())
for _ in range(n):
m = int(input())
a=list(map(int,input().split()))
if a[0]+a[1]<=a[-1]:
print(1,2,m)
else:
print(-1) | 7 | PYTHON3 |
t = int(input())
for case in range(t):
n = int(input())
a = [int(s) for s in input().split(' ')]
if a[-1] >= a[0] + a[1]:
print(1, 2, n)
else:
print(-1)
| 7 | PYTHON3 |
t = int(input())
for i in range(t):
s = int(input())
arr = list(map(int, input().split()))
if ((arr[0]+arr[1])<=arr[-1]):
print(1,2,s)
else:
print("-1")
| 7 | PYTHON3 |
import collections
def solve(lst):
if len(lst) < 3:
return -1
if lst[0] + lst[1] <= lst[len(lst)-1]:
return str(1) + " "+str(2)+ " " +(str(len(lst)))
return -1
def sort(key):
return key[0]
ans=[]
n = int(input())
for i in range(n):
k=int(input())
lst= list(map(int,input().split()))
ans.append(solve(lst))
for i in ans:
print(i)
# for i in ans:
# print(i)
| 7 | PYTHON3 |
#!/usr/bin/env python
# coding: utf-8
# In[1]:
try:
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,2,n)
else:
print(-1)
t = t-1
except EOFError:
print(" ")
# In[ ]:
| 7 | PYTHON3 |
import sys
n = int(sys.stdin.readline())
for _ in range(n):
m = int(sys.stdin.readline())
arr = list(map(int, sys.stdin.readline().split()))
if arr[0]+arr[1] <= arr[-1]:
print(f"1 2 {len(arr)}")
else:
print("-1") | 7 | PYTHON3 |
import bisect
def multiple_input(): return map(int, input().split())
def list_input(): return list(map(int, input().split()))
for _ in range(int(input())):
n = int(input())
a = list_input()
s = a[0] + a[1]
x = a[-1]
if s > x:
print(-1)
else:
print(1, 2, n) | 7 | PYTHON3 |
def call():
n=int(input())
l=[int(x) for x in input().split()]
if(l[0]+l[1]>l[-1]):
print(-1)
else:
print(1,2,n)
for _ in range(int(input())):
call() | 7 | PYTHON3 |
def bad_triangle(n, a):
if(len(a)<3):
return -1
if(a[-1]<a[0]+a[1]):
return -1
else:
return [1, 2, n]
test = int(input())
for i in range(test):
n = int(input())
a = list(map(int, input().split()))
ans = bad_triangle(n, a)
if(ans==-1):
print(-1)
else:
print(*ans)
| 7 | PYTHON3 |
from sys import stdin,stdout
from collections import defaultdict
input=lambda:stdin.readline().strip()
for _ in range(int(input())):
n=int(input())
lst=list(map(int,input().split()))
sum1=lst[0]+lst[1]
if sum1<=lst[-1]:
print(1,2,n)
else:
print(-1)
| 7 | PYTHON3 |
def solver(arr):
k = len(arr)-1
if arr[0]+arr[1]<=arr[k]:
return [1,2,k+1]
else:
return [-1]
for t in range(int(input())):
_ = int(input())
arr = list(map(int,input().split()))
for i in solver(arr):
print(i,end=' ')
print() | 7 | PYTHON3 |
T = int(input())
for _ in range(T):
N = int(input())
A = list(map(int,input().split()))
a,b,c = A[0],A[1],A[-1]
if a+b <= c:
print(1,2,N)
else:
print(-1)
| 7 | PYTHON3 |
def fun(a, n):
if a[0] + a[1] <= a[-1]:
return [1, 2, n]
return [-1]
for _ in range(int(input())):
n = int(input())
a = list(map(int,input().split()))
print(*fun(a,n))
| 7 | PYTHON3 |
#include <bits/stdc++.h>
using namespace std;
int main() {
int t;
cin >> t;
while (t--) {
int n, x, a = 0, b = -1;
cin >> n;
for (int i = 0; i < n; i++) {
cin >> x;
if (i == 0 || i == 1) a += x;
if (i == n - 1 && x >= a) b = i + 1;
}
if (b == -1)
cout << -1 << "\n";
else
cout << 1 << " " << 2 << " " << b << "\n";
}
return 0;
}
| 7 | CPP |
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, n)
else:
print(-1) | 7 | PYTHON3 |
for _ in range(int(input())):
n = int(input())
a = list(map(int,input().split()))
i = n-3
while i>=0 and a[i]+a[i+1]>a[n-1]:
i-=1
if i==-1:
print(-1)
else:
print(i+1,i+2,n)
| 7 | PYTHON3 |
from sys import stdin
inp = lambda : stdin.readline().strip()
t = int(inp())
for _ in range(t):
n = int(inp())
a = [int(x) for x in inp().split()]
flag = False
for i in range(2, n):
if a[i] >= a[0] + a[1]:
print(1, 2, i+1)
flag = True
break
if not flag:
print(-1) | 7 | PYTHON3 |
#include <bits/stdc++.h>
using namespace std;
const int N = 5e4 + 5;
long long a[N];
void solve() {
long long n, i;
cin >> n;
for (i = 0; i < n; i++) cin >> a[i];
long long x, y, z;
x = a[0];
y = a[1];
z = a[n - 1];
if (x + y <= z) {
cout << "1 2 " << n << '\n';
return;
}
cout << "-1\n";
}
int main() {
int t;
cin >> t;
while (t--) solve();
}
| 7 | CPP |
numCases=int(input())
cases=[]
values=[]
for i in range(numCases):
cases.append(input())
values.append(list(map(int, input().split(" "))))
ret=[]
for x in values:
if (x[0]+x[1]>x[-1]):
ret.append("-1")
else:
ret.append([1,2,x.index(x[-1])+1])
for i in ret:
k=[]
if(i!="-1"):
for x in i:
k.append(str(x))
print(" ".join(k))
else:
print(-1)
| 7 | PYTHON3 |
def solve(arr):
ans = []
s = arr[0]+arr[1]
if s <= arr[-1]:
print(1,2,len(arr))
else:
print(-1)
t = int(input())
for i in range(t):
input()
solve(list(map(int, input().split()))) | 7 | PYTHON3 |
#include <bits/stdc++.h>
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
int t;
cin >> t;
while (t-- > 0) {
int n;
cin >> n;
vector<int> a(n);
for (int& v : a) cin >> v;
if (a[0] + a[1] > a[n - 1])
cout << "-1\n";
else
cout << "1 2 " << n << '\n';
}
return 0;
}
| 7 | CPP |
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 |
from sys import stdin,stdout
# stdin = open("input.txt","r")
# stdout = open("output.txt","w")
t = int(stdin.readline().strip())
for _ in range(t):
n = int(stdin.readline().strip())
narr = list(map(int,stdin.readline().strip().split(' ')))
if n==3:
arr=narr
if arr[0]+arr[1]<=arr[2]:
stdout.write(str(1)+" "+str(2)+" "+str(3)+"\n")
else:
stdout.write("-1\n")
else:
arr=[narr[0],narr[1],narr[-1]]
if arr[0]+arr[1]<=arr[2]:
stdout.write(str(1)+" "+str(2)+" "+str(n)+"\n")
else:
stdout.write("-1\n") | 7 | PYTHON3 |
t=int(input())
for _ in range(t):
n=int(input())
arr=input().split()
for i in range(n):
arr[i]=int(arr[i])
if arr[0]+arr[1]<=arr[-1]:
print("1 2 "+str(n))
else:
print("-1") | 7 | PYTHON3 |
from bisect import bisect_left, bisect_right
from itertools import combinations
from itertools import permutations
from bisect import bisect_left
from math import ceil
from math import radians
from heapq import heapify, heappush, heappop
import bisect
from math import pi
from collections import deque
from math import factorial
from math import log, ceil
from collections import defaultdict
from math import *
from sys import stdin, stdout
import itertools
import os
import sys
import threading
from collections import deque, Counter, OrderedDict, defaultdict
from heapq import *
# from math import ceil, floor, log, sqrt, factorial, pow, pi, gcd
# from bisect import bisect_left,bisect_right
# from decimal import *,threading
from fractions import Fraction
mod = int(pow(10, 9)+7)
# mod = 998244353
def ii(): return int(input())
def si(): return str(input())
def mi(): return map(int, input().split())
def li1(): return list(mi())
def fii(): return int(stdin.readline())
def fsi(): return str(stdin.readline())
def fmi(): return map(int, stdin.readline().split())
def fli(): return list(fmi())
abd = {'a': 0, 'b': 1, 'c': 2, 'd': 3, 'e': 4, 'f': 5, 'g': 6, 'h': 7, 'i': 8, 'j': 9, 'k': 10, 'l': 11, 'm': 12,
'n': 13, 'o': 14, 'p': 15, 'q': 16, 'r': 17, 's': 18, 't': 19, 'u': 20, 'v': 21, 'w': 22, 'x': 23, 'y': 24,
'z': 25}
def getKey(item): return item[0]
def sort2(l): return sorted(l, key=getKey)
def d2(n, m, num): return [[num for x in range(m)] for y in range(n)]
def isPowerOfTwo(x): return (x and (not (x & (x - 1))))
def decimalToBinary(n): return bin(n).replace("0b", "")
def ntl(n): return [int(i) for i in str(n)]
def powerMod(x, y, p):
res = 1
x %= p
while y > 0:
if y & 1:
res = (res * x) % p
y = y >> 1
x = (x * x) % p
return res
graph = defaultdict(list)
visited = [0] * 1000000
col = [-1] * 1000000
def bfs(d, v):
q = []
q.append(v)
visited[v] = 1
while len(q) != 0:
x = q[0]
q.pop(0)
for i in d[x]:
if visited[i] != 1:
visited[i] = 1
q.append(i)
print(x)
def make_graph(e):
d = {}
for i in range(e):
x, y = mi()
if x not in d:
d[x] = [y]
else:
d[x].append(y)
if y not in d:
d[y] = [x]
else:
d[y].append(x)
return d
def gr2(n):
d = defaultdict(list)
for i in range(n):
x, y = mi()
d[x].append(y)
return d
def connected_components(graph):
seen = set()
def dfs(v):
vs = set([v])
component = []
while vs:
v = vs.pop()
seen.add(v)
vs |= set(graph[v]) - seen
component.append(v)
return component
ans = []
for v in graph:
if v not in seen:
d = dfs(v)
ans.append(d)
return ans
def primeFactors(n):
s = set()
while n % 2 == 0:
s.add(2)
n = n // 2
for i in range(3, int(sqrt(n)) + 1, 2):
while n % i == 0 and i % 2 == 1:
s.add(i)
n = n // i
if n > 2 and n % 2 == 1:
s.add(n)
return s
def find_all(a_str, sub):
start = 0
while True:
start = a_str.find(sub, start)
if start == -1:
return
yield start
start += len(sub)
def SieveOfEratosthenes(n, isPrime):
isPrime[0] = isPrime[1] = False
for i in range(2, n):
isPrime[i] = True
p = 2
while (p * p <= n):
if (isPrime[p] == True):
i = p * p
while (i <= n):
isPrime[i] = False
i += p
p += 1
return isPrime
def dijkstra(edges, f, t):
g = defaultdict(list)
for l, r, c in edges:
g[l].append((c, r))
q, seen, mins = [(0, f, ())], set(), {f: 0}
while q:
(cost, v1, path) = heappop(q)
if v1 not in seen:
seen.add(v1)
path = (v1, path)
if v1 == t:
return (cost, path)
for c, v2 in g.get(v1, ()):
if v2 in seen:
continue
prev = mins.get(v2, None)
next = cost + c
if prev is None or next < prev:
mins[v2] = next
heappush(q, (next, v2, path))
return float("inf")
def binsearch(a, l, r, x):
while l <= r:
mid = l + (r-1)//2
if a[mid]:
return mid
elif a[mid] > x:
l = mid-1
else:
r = mid+1
return -1
# def input():
# return stdin.buffer.readline()
def readTree(n):
adj = [set() for _ in range(n)]
for _ in range(n-1):
u, v = map(int, input().split())
adj[u-1].add(v-1)
adj[v-1].add(u-1)
return adj
def treeOrderByDepth(n, adj, root=0):
parent = [-2] + [-1]*(n-1)
ordered = []
q = deque()
q.append(root)
depth = [0] * n
while q:
c = q.popleft()
ordered.append(c)
for a in adj[c]:
if parent[a] == -1:
parent[a] = c
depth[a] = depth[c] + 1
q.append(a)
return (ordered, parent, depth)
def isSubSequence(str1, str2):
m = len(str1)
n = len(str2)
j = 0 # Index of str1
i = 0 # Index of str2
# Traverse both str1 and str2
# Compare current character of str2 with
# first unmatched character of str1
# If matched, then move ahead in str1
while j < m and i < n:
if str1[j] == str2[i]:
j = j+1
i = i + 1
# If all characters of str1 matched, then j is equal to m
return j == m
def nextPowerOf2(n):
count = 0
# First n in the below
# condition is for the
# case where n is 0
if (n and not(n & (n - 1))):
return n
while(n != 0):
n >>= 1
count += 1
return 1 << count
def cou(n):
c = 0
while n > 1:
c += 1
n //= 2
return c
def sortsec(l):
return sorted(l, key=lambda x: x[1])
def BinarySearch(a, x):
i = bisect_left(a, x)
if i:
return (i-1)
else:
return - 1
def subarray(A):
r = set()
p = {0}
for x in A:
p = {x | y for y in p} | {x}
r |= p
return len(r)
for _ in range(ii()):
n = ii()
l = li1()
if l[0] + l[1] > l[-1]:
print(-1)
else:
print(1, 2, n)
| 7 | PYTHON3 |
t = int(input())
for _ in range(t):
n = int(input())
a = list(map(int,input().split()))
find = False
x = a[0]
z = a[-1]
for i in range(1,n-1):
y = a[i]
if x + y <= z:
find = True
break
if find:
print(1,i+1,n)
else:
print(-1) | 7 | PYTHON3 |
import sys
from functools import lru_cache, cmp_to_key
from heapq import merge, heapify, heappop, heappush
from math import *
from collections import defaultdict as dd, deque, Counter as C
from itertools import combinations as comb, permutations as perm
from bisect import bisect_left as bl, bisect_right as br, bisect
from time import perf_counter
from fractions import Fraction
import copy
# import numpy as np
mod = int(pow(10, 9) + 7)
mod2 = 998244353
def data(): return sys.stdin.readline().strip()
def out(*var, end="\n"): sys.stdout.write(' '.join(map(str, var))+end)
def L(): return list(sp())
def sl(): return list(ssp())
def sp(): return map(int, data().split())
def ssp(): return map(str, data().split())
def l1d(n, val=0): return [val for i in range(n)]
def l2d(n, m, val=0): return [l1d(n, val) for j in range(m)]
try:
# sys.setrecursionlimit(int(pow(10,6)))
sys.stdin = open("input.txt", "r")
# sys.stdout = open("../output.txt", "w")
except:
pass
for _ in range(L()[0]):
n=L()[0]
A=L()
x=A[0]
y=A[1]
z=A[-1]
if (x+y)<=z:
print(1,2,n)
else:
print(-1) | 7 | PYTHON3 |
import sys
from math import sqrt, gcd, ceil, log, floor
from bisect import bisect, bisect_left
from collections import defaultdict, Counter, deque
from heapq import heapify, heappush, heappop
input = sys.stdin.readline
read = lambda: list(map(int, input().strip().split()))
# sys.setrecursionlimit(200000)
# MOD = 10**9 + 7
def main():
# ans_ = []
for _ in range(int(input())):
n = int(input()); arr = read()
if arr[0]+arr[1] <= arr[-1]:
print(1, 2, n)
else:
print(-1)
# ans_.append(str(ans))
# print(("\n").join(ans_))
if __name__ == "__main__":
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 "+str(n))
else:
print("-1") | 7 | PYTHON3 |
t = int(input())
for _ in range(t):
n = int(input())
a = list(map(int,input().split()))
a.sort()
if a[0]+a[1] > a[n-1] :
print(-1)
else:
print(1,2,n)
| 7 | PYTHON3 |
for _ in range(int(input())):
n = int(input())
a = list(map(int,input().split()))
i = 2
while(i < n):
if(a[i] >= a[0]+a[1]): break
i += 1
if i == n: print(-1)
else: print(1,2,i+1)
| 7 | PYTHON3 |
#Problem F Shreyansh
from math import *
t=int(input())
while t:
t=t-1
#n,m=map(int,input().split())
n=int(input())
a=list(map(int,input().split()))
s=a[0]+a[1]
flag=1
for i in range(2,n):
if s<=a[i]:
print(1,2,i+1)
flag=0
break
if flag:
print(-1)
| 7 | PYTHON3 |
#include <bits/stdc++.h>
using namespace std;
int main() {
int64_t cases, total, elements, i;
cin >> cases;
for (i = 0; i < cases; i++) {
int flag = 0, val = 0;
vector<int> x = {};
cin >> total;
for (int j = 0; j < total; j++) {
cin >> elements;
x.push_back(elements);
}
for (int l = 1; l <= x.size() - 2; l++) {
if (x[0] + x[l] <= x[x.size() - 1]) {
flag = 1;
val = l;
break;
}
}
if (flag == 0) {
cout << -1 << endl;
} else {
cout << 1 << " " << val + 1 << " " << x.size() << endl;
}
}
return 0;
}
| 7 | CPP |
for _ in range(int(input())):
n = int(input())
*a, = map(int, input().split())
if a[-1] >= a[0] + a[1]:
print(1, 2, n)
else:
print(-1) | 7 | PYTHON3 |
import sys
from functools import lru_cache, cmp_to_key
from heapq import merge, heapify, heappop, heappush
# from math import *
from collections import defaultdict as dd, deque, Counter as C
from itertools import combinations as comb, permutations as perm
from bisect import bisect_left as bl, bisect_right as br, bisect
from time import perf_counter
from fractions import Fraction
import copy
import time
# import numpy as np
starttime = time.time()
# import numpy as np
mod = int(pow(10, 9) + 7)
mod2 = 998244353
def data(): return sys.stdin.readline().strip()
def out(*var, end="\n"): sys.stdout.write(' '.join(map(str, var))+end)
def L(): return list(sp())
def sl(): return list(ssp())
def sp(): return map(int, data().split())
def ssp(): return map(str, data().split())
def l1d(n, val=0): return [val for i in range(n)]
def l2d(n, m, val=0): return [l1d(n, val) for j in range(m)]
try:
# sys.setrecursionlimit(int(pow(10,6)))
sys.stdin = open("input.txt", "r")
# sys.stdout = open("../output.txt", "w")
except:
pass
for _ in range(L()[0]):
n=L()[0]
A=sorted(L())
if A[0]+A[1]<=A[-1]:
print(1,2,n)
else:
print(-1)
endtime = time.time()
# print(f"Runtime of the program is {endtime - starttime}")
| 7 | PYTHON3 |
#include <bits/stdc++.h>
using namespace std;
long long int isprime[1000001];
void sieve() {
long long int i, j, k;
isprime[0] = isprime[1] = 1;
for (i = 2; i <= sqrt(1000000); i++) {
if (!isprime[i]) {
for (j = 2 * i; j <= 1000000; j += i) {
isprime[j] = 1;
}
}
}
}
long long int modInverse(long long int a, long long int m) {
long long int m0 = m;
long long int y = 0, x = 1;
if (m == 1) return 0;
while (a > 1) {
long long int q = a / m;
long long int t = m;
m = a % m;
a = t;
t = y;
y = x - q * y;
x = t;
}
if (x < 0) x += m0;
return x;
}
long long int mod(long long int x, long long int n) {
if (n == 0) return 1;
if (n % 2 == 0) {
long long int y = mod(x, n / 2);
return ((y % 1000000007) * (y % 1000000007)) % 1000000007;
} else {
return ((x % 1000000007) * (mod(x, (n - 1)) % 1000000007)) % 1000000007;
}
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
;
long long int t;
cin >> t;
while (t--) {
long long int n;
cin >> n;
long long int a[n], i;
for (i = 0; i < n; i++) {
cin >> a[i];
}
if (a[0] + a[1] > a[n - 1]) {
cout << "-1" << endl;
} else {
cout << 1 << " " << 2 << " " << n << endl;
}
}
return 0;
}
| 7 | CPP |
from fractions import Fraction
from collections import defaultdict
import math
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)
def input(): return sys.stdin.readline().rstrip("\r\n")
#----------------------------------------Code Starts Here--------------------------------------------#
t = int(input())
for _ in range(t):
n = int(input())
l = list([int(x) for x in input().split()])
a = l[0]
b = l[1]
c = l[n-1]
if(a+b <= c):
print(1, 2, n)
else:
print('-1')
| 7 | PYTHON3 |
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
int t;
cin >> t;
while (t--) {
int n;
cin >> n;
vector<int> a(n);
for (int i = 0; i < n; i++) cin >> a[i];
if (a[0] + a[1] <= a[n - 1]) {
cout << 1 << ' ' << 2 << ' ' << n << endl;
} else
cout << -1 << endl;
}
}
| 7 | CPP |
for _ in range(int(input())):
n = int(input())
a = list(map(int, input().split()))
if a[n-1]<a[1]+a[0]:
print('-1')
else:
for i in range(2, n):
if a[i]>=a[0]+a[1]:
print('1 2 '+str(i+1))
break | 7 | PYTHON3 |
for _ in range (int(input())):
n=int(input())
a=list(map(int,input().split()))
a1,a2,a3=a[0],a[1],a[-1]
if a1+a2>a3:
print(-1)
else:
print(1,2,n) | 7 | PYTHON3 |
#include <bits/stdc++.h>
using namespace std;
int main() {
int t;
scanf("%d", &t);
while (t--) {
int n;
cin >> n;
int a[n];
for (int i = 0; i < n; i++) {
scanf("%d", &a[i]);
}
if (a[0] + a[1] > a[n - 1]) {
printf("-1");
printf("\n");
} else {
printf("1");
printf(" ");
printf("2");
printf(" ");
printf("%d", n);
printf("\n");
}
}
return 0;
}
| 7 | CPP |
tc = int(input())
for _ in range(tc):
n = int(input())
arr = list(map(int, input().split()))
A,B = arr[0], arr[1]
f = 1
for i in range(2, n):
C = arr[i]
if(A+B <= C or B + C <= A or C + A <= B):
print(1, 2, i+1)
f = 0
break
if(f):
print(-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 ar[n + 1];
for (long long int i = 1; i <= n; i++) cin >> ar[i];
long long int x = ar[1], y = ar[2], z = ar[n];
if ((x + y) <= z || (y + z) <= x || (z + x) <= y)
cout << 1 << " " << 2 << " " << n << endl;
else
cout << -1 << endl;
}
return 0;
}
| 7 | CPP |
t = int(input())
for _ in range(t):
n = int(input())
lol=[int(n) for n in input().split()]
z=lol.copy()
z.sort()
if(z[0] + z[1] <=z[-1]):
#if(z[0]==z[1]):
print(1,2,n)
'''print(lol.index(z[0]),end=' ')
lol.remove(z[0])
print(lol.index(z[1]),end=' ')
print(lol.index(z[-1]),end=' ')'''
else:
print(-1)
| 7 | PYTHON3 |
t=int(input())
for _ in range(t):
n=int(input())
ls=list(map(int,input().split()))
ls.sort()
if ls[0]+ls[1]<=ls[-1]:
print("1 2",n)
else:
print("-1") | 7 | PYTHON3 |
#include <bits/stdc++.h>
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
int t;
cin >> t;
while (t--) {
long long int n;
long long int ar[50009];
cin >> n;
for (int i = 1; i <= n; i++) {
cin >> ar[i];
}
if ((ar[1] + ar[2]) > ar[n]) {
cout << "-1" << endl;
} else
cout << "1"
<< " "
<< "2"
<< " " << n << endl;
}
}
| 7 | CPP |
import sys
input=sys.stdin.buffer.readline
#arr[i]+arr[j]!=arr[k]
t=int(input())
for _ in range(t):
n=int(input())
arr=[int(x) for x in input().split()]
if arr[0]+arr[1]<=arr[n-1]:
print('{} {} {}'.format(1,2,n))
else:
print(-1) | 7 | PYTHON3 |
def main():
for i in range(int(input())):
n = int(input())
arr = list(map(int,input().split()))
if arr[n-1]>=arr[0]+arr[1]:
print('1 2 {}'.format(n))
else:
print(-1)
if __name__ == "__main__":
main() | 7 | PYTHON3 |
for t in range(int(input())):
num=int(input())
arr=list(map(int,input().split()))
if arr[0]+arr[1]>arr[num-1]:
print(-1)
else:
print(1,2,num)
| 7 | PYTHON3 |
t = int(input())
for test in range(0, t):
n = int(input())
sides = list(map(int, input().split(' ')))
if sides[0] + sides[1] <= sides[n-1]:
print(1, 2, n)
else:
print(-1)
| 7 | PYTHON3 |
#include <bits/stdc++.h>
using namespace std;
long long mod = 1e9 + 7;
long long C(int n, int r) {
if (r > n) return 0;
if (r > n - r) r = n - r;
long long ans = 1;
int i;
for (i = 1; i <= r; i++) {
ans *= n - r + i;
ans /= i;
}
return ans;
}
vector<long long> sieve(long long n) {
vector<long long> is_prime(n + 1, true);
is_prime[0] = is_prime[1] = false;
for (int i = 2; i <= n; i++) {
if (is_prime[i] && (long long)i * i <= n) {
for (int j = i * i; j <= n; j += i) is_prime[j] = false;
}
}
return is_prime;
}
void test() {
long long n;
cin >> n;
vector<long long> v(n);
for (long long(i) = 0; (i) < n; ++(i)) cin >> v[i];
long long i = 0, j = 1, k = n - 1;
if (v[i] + v[j] <= v[k]) {
cout << i + 1 << " " << j + 1 << " " << k + 1 << "\n";
return;
}
cout << "-1\n";
}
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
long long t = 1;
cin >> t;
for (long long T = 0; T < t; T++) {
test();
}
cerr << "Time : " << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC
<< "ms\n";
}
| 7 | CPP |
#include <bits/stdc++.h>
using namespace std;
void solve() {
long long int n;
long long int a[50007];
cin >> n;
for (int i = 0; i < n; i++) {
cin >> a[i];
}
if (a[0] + a[1] <= a[n - 1]) {
cout << 1 << " " << 2 << " " << n << endl;
} else
cout << -1 << endl;
}
int main() {
long long int t;
cin >> t;
for (int i = 0; i < t; i++) {
solve();
}
}
| 7 | CPP |
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)
else:
print(1,2,n) | 7 | PYTHON3 |
t = int(input())
for _ in range(t):
n = input()
a = [int(x) for x in input().split()]
if a[-1] >= (a[0] + a[1]):
print("1 2 "+n)
else:
print("-1")
| 7 | PYTHON3 |
for _ in range(int(input())):
n = int(input())
a=list(map(int,input().split()))
if a[0]+a[1]<=a[n-1]:
print("1 2 ",n,sep="")
else:
print("-1") | 7 | PYTHON3 |
import sys
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
ns = lambda: readline().rstrip()
ni = lambda: int(readline().rstrip())
nm = lambda: map(int, readline().split())
nl = lambda: list(map(int, readline().split()))
T = ni()
for _ in range(T):
n = ni()
a = nl()
if a[0] + a[1] <= a[n-1]:
print(1,2,n)
else:
print(-1) | 7 | PYTHON3 |
for _ in range(int(input())):
n=int(input())
l=list(map(int,input().split()))
s=l[0]+l[1]
flag=0
for i in range(2,n):
if(s<=l[i]):
print("1","2",i+1)
flag=1
break
if(flag==0):
print("-1") | 7 | PYTHON3 |
t = int(input())
for i in range(t):
n = int(input())
pole = input().split()
for j in range(n):
pole[j] = int(pole[j])
hran = pole[0]+pole[1]
pravda = False
for j in range(n):
if pole[j] >= hran:
pravda = True
break
if pravda == True:
print(1,2,j+1)
else:
print(-1) | 7 | PYTHON3 |
t=int(input())
for i in range(t):
n=int(input())
lst=list(map(int,input().split()))
m=max(lst)
index=lst.index(m)
flag=0
lst.pop(index)
for i in range(len(lst)-1):
if(lst[i]+lst[i+1]<=m):
print(i+1,i+2,index+1)
flag=1
break
if(flag==0):
print('-1')
| 7 | PYTHON3 |
#include <bits/stdc++.h>
using namespace std;
int main() {
int t;
cin >> t;
while (t--) {
int n, a[100000];
cin >> n;
for (int i = 0; i < n; i++) cin >> a[i];
if (a[0] + a[1] <= a[n - 1]) {
cout << 0 + 1 << " " << 1 + 1 << " " << n << "\n";
} else
cout << "-1\n";
}
}
| 7 | CPP |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.