solution
stringlengths 11
983k
| difficulty
int64 0
21
| language
stringclasses 2
values |
---|---|---|
t=int(input())
while(t):
t=t-1
n=int(input())
a=list(map(int,input().split()))
if(a[0]+a[1]<=a[-1]):
print(1,2,n)
else:
print(-1)
| 7 | PYTHON3 |
#include <bits/stdc++.h>
using namespace std;
int main() {
int t;
cin >> t;
while (t--) {
int n;
cin >> n;
int arr[n];
for (int i = 0; i < n; i++) cin >> arr[i];
if (arr[0] + arr[1] > arr[n - 1])
cout << -1 << endl;
else
cout << "1"
<< " "
<< "2"
<< " " << n << endl;
}
return 0;
}
| 7 | CPP |
#include <bits/stdc++.h>
using namespace std;
long long n, a[100005], T, c;
int main() {
cin >> T;
for (long long j = 1; j <= T; j++) {
cin >> n;
long long op;
for (long long i = 1; i <= n; i++) {
cin >> a[i];
}
if (a[n] >= a[1] + a[2])
cout << "1 2 " << n << endl;
else
cout << "-1\n";
}
return 0;
}
| 7 | CPP |
t = int(input())
myList = []
for _ in range(t):
n = int(input())
a = list(map(int, input().split()))
if a[0] + a[1] > a[-1]:
myList.append([-1])
else:
elem = [1, 2, n]
myList.append(elem)
for thing in myList:
print(*thing)
| 7 | PYTHON3 |
try:
for i1 in range(int(input())):
n=int(input())
a=list(map(int,input().split()))
t=0
if a[0]+a[1]<=a[-1] :
print(1,2,n)
else:
print(-1)
except:
pass | 7 | PYTHON3 |
t=int(input())
for i in range(t):
n=int(input())
lista=list(map(int,input().split()))
if(lista[0]+lista[1]>lista[-1]):
print(-1)
else:
print(1,2,n) | 7 | PYTHON3 |
t=int(input())
while(t):
n=int(input())
l=list(map(int,input().split()))
l.sort()
if(l[0]+l[1]<=l[-1]):
print(1,2,n)
else:
print(-1)
t=t-1 | 7 | PYTHON3 |
import sys
import math
import bisect
from sys import stdin, stdout
from math import gcd, floor, sqrt, log
from collections import defaultdict as dd
from bisect import bisect_left as bl, bisect_right as br
from collections import Counter
#sys.setrecursionlimit(100000000)
inp = lambda: int(input())
strng = lambda: input().strip()
jn = lambda x, l: x.join(map(str, l))
strl = lambda: list(input().strip())
mul = lambda: map(int, input().strip().split())
mulf = lambda: map(float, input().strip().split())
seq = lambda: list(map(int, input().strip().split()))
ceil = lambda x: int(x) if (x == int(x)) else int(x) + 1
ceildiv = lambda x, d: x // d if (x % d == 0) else x // d + 1
flush = lambda: stdout.flush()
stdstr = lambda: stdin.readline()
stdint = lambda: int(stdin.readline())
stdpr = lambda x: stdout.write(str(x))
stdarr = lambda: map(int, stdstr().split())
mod = 1000000007
for _ in range(stdint()):
n = stdint()
arr = list(stdarr())
a = arr[-1]
b = arr[1]
c = arr[0]
if(b+c > a):
print(-1)
else:
print(1, 2, n)
| 7 | PYTHON3 |
t = int(input())
for i in range(t):
n = int(input())
a = list(map(int, input().split()))
found = False
for j in range(2, n):
if a[0] + a[1] <= a[j]:
print(1, 2, j + 1)
found = True
break
if not found:
print(-1)
| 7 | PYTHON3 |
n = int(input())
a = []
b = []
for i in range(n):
s = input()
a.append(list(map(int, input().split())))
a[-1].sort()
if a[-1][0] + a[-1][1] > a[-1][-1]:
print(-1)
else:
print(1, 2, len(a[i])) | 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 |
def calc(n,A):
f=A[0]
l=A[1]
bool=False
for i in range(2,n):
if A[i]>=f+l:
print(1,2,i+1)
bool =True
break
if bool is False:
print(-1)
for _ in range(int(input())):
n=int(input())
A=list(int(i)for i in input().split())
calc(n,A)
| 7 | PYTHON3 |
t=int(input())
for i in range(t):
n=int(input())
arr=[int(item) for item in input().split()]
if(arr[0]+arr[1]<=arr[-1]):
print(1,2,n)
else:
print(-1)
| 7 | PYTHON3 |
for _ in range(int(input())):
n = int(input())
a = list(map(int,input().split()))
s = a[0]+a[1]
t = a[-1]
if s <= t:
print(1,2,n)
else:
print(-1)
| 7 | PYTHON3 |
import sys
import math
import itertools
import functools
import collections
import operator
import fileinput
import copy
ORDA = 97 # a
def ii(): return int(input())
def mi(): return map(int, input().split())
def li(): return [int(i) for i in input().split()]
def lcm(a, b): return abs(a * b) // math.gcd(a, b)
def revn(n): return str(n)[::-1]
def dd(): return collections.defaultdict(int)
def ddl(): return collections.defaultdict(list)
def sieve(n):
if n < 2: return list()
prime = [True for _ in range(n + 1)]
p = 3
while p * p <= n:
if prime[p]:
for i in range(p * 2, n + 1, p):
prime[i] = False
p += 2
r = [2]
for p in range(3, n + 1, 2):
if prime[p]:
r.append(p)
return r
def divs(n, start=2):
r = []
for i in range(start, int(math.sqrt(n) + 1)):
if (n % i == 0):
if (n / i == i):
r.append(i)
else:
r.extend([i, n // i])
return r
def divn(n, primes):
divs_number = 1
for i in primes:
if n == 1:
return divs_number
t = 1
while n % i == 0:
t += 1
n //= i
divs_number *= t
def prime(n):
if n == 2: return True
if n % 2 == 0 or n <= 1: return False
sqr = int(math.sqrt(n)) + 1
for d in range(3, sqr, 2):
if n % d == 0: return False
return True
def convn(number, base):
new_number = 0
while number > 0:
new_number += number % base
number //= base
return new_number
def cdiv(n, k): return n // k + (n % k != 0)
def ispal(s):
for i in range(len(s) // 2 + 1):
if s[i] != s[-i - 1]:
return False
return True
for _ in range(ii()):
n = ii()
a = li()
if a[0] + a[1] <= a[-1]:
print(1, 2, n)
else:
print(-1) | 7 | PYTHON3 |
t = int(input())
while(t>0):
t -= 1
n = int(input())
line = input().split(" ")
numbers = []
for i in line:
numbers.append(int(i))
found = False
# print(numbers)
aa = -1
bb = -1
cc = -1
i = 0
j = 1
k = n - 1
a = numbers[i]
b = numbers[j]
c = numbers[k]
if a+b>c and a+c>b and b+c>a:
found = True
else:
found = False
aa = i + 1
bb = j + 1
cc = k + 1
if found:
print("-1")
else:
print("{} {} {}".format(aa, bb, cc))
| 7 | PYTHON3 |
for i in range(int(input())):
n = int(input())
L = list(map(int, input().split()))
if L[n - 1] >= L[0] + L[1]:
print(1, 2, n)
else:
print(-1)
| 7 | PYTHON3 |
t = int(input())
answer = [0]*t
for i in range(t):
s = int(input())
a = [int(i) for i in input().split()]
if a[0] + a[1] <= a[-1]:
answer[i] = '1 2 '+str(s)
else:
answer[i] = -1
for i in range(t):
print(answer[i]) | 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[-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()))
if a[-1]>=a[0]+a[1]:
print(1,2,n)
else:
print(-1) | 7 | PYTHON3 |
for t in range(int(input())):
n=int(input())
arr=[int(k) for k in input().split()]
if arr[0]+arr[1]<=arr[-1]:
print(1,2,n)
else:
print(-1)
| 7 | PYTHON3 |
import sys,math
try:sys.stdin,sys.stdout=open('input.txt','r'),open('out.txt','w')
except:pass
from sys import stdin,stdout;mod=int(1e9 + 7);from statistics import mode
from collections import *;from math import ceil,floor,inf,factorial,gcd,log2,sqrt,log
ii1=lambda:int(stdin.readline().strip())
is1=lambda:stdin.readline().strip()
iia=lambda:list(map(int,stdin.readline().strip().split()))
isa=lambda:stdin.readline().strip().split()
# print('{:.3f}'.format(1),round(1.123456789,4))
# sys.setrecursionlimit(500000)
def lcm(a,b): return (a*b)//gcd(a,b)
def setbits(n):return bin(n).count('1')
def resetbits(n):return bin(n).count('0')
def modinv(n,p):return pow(n,p-2,p)
def ncr(n,r):
num,den=1,1;r=min(n,n-r)
for i in range(r):num*=(n-i);den*=(i+1)
return num//den
def ncr_p(n, r, p):
num,den=1,1;r=min(r,n-r)
for i in range(r):num = (num * (n - i)) % p ;den = (den * (i + 1)) % p
return (num * modinv(den,p)) % p
def isPrime(num) :
if num<=1:return False
if num==2 or n==3:return True
if (num % 2 == 0 or num % 3 == 0) :return False
m = int(num**0.5)+1
for i in range(5,m,6):
if (num % i == 0 or num % (i + 2) == 0) :return False
return True
def bin_search(arr, low, high, val):
while low <= high:
mid = low + (high - low) // 2;
if arr[mid] == val:return mid
elif arr[mid] < val:low = mid + 1
else:high = mid - 1
return -1
def sumofdigit(num):
count=0;
while num : count+=num % 10;num //= 10;
return count;
def inputmatrix():
r,c=iia();mat=[0]*r;
for i in range(r):mat[i]=iia();
return r,c,mat;
def prefix_sum(n,arr):
for i in range(1,n):arr[i]+=arr[i-1]
return arr;
def binomial(n, k):
if 0 <= k <= n:
ntok = 1;ktok = 1
for t in range(1, min(k, n - k) + 1):ntok *= n;ktok *= t;n -= 1
return ntok // ktok
else:return 0
def divisors(n):
res = [];
for i in range(1,ceil(sqrt(n))+1):
if n%i == 0:
if i==n//i:res.append(i)
else:res.append(i);res.append(n//i)
return res;
# code start from here-control and click on different places to change samethings to diff.
for _ in range(ii1()):
n = ii1()
arr = iia()
if arr[-1]>=arr[0]+arr[1]:
print(1,2,n)
else:
print(-1)
| 7 | PYTHON3 |
for _ in range(int(input())):
input()
arr=[int(x) for x in input().split()]
print(*([1,2,len(arr)],[-1])[arr[0]+arr[1]>arr[-1]]) | 7 | PYTHON3 |
#include <bits/stdc++.h>
using namespace std;
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
int t;
cin >> t;
while (t--) {
int n;
cin >> n;
int a[n];
for (int i = 0; i < n; i++) cin >> a[i];
if ((long long)a[0] + a[1] > (long long)a[n - 1])
cout << -1 << '\n';
else {
cout << 1 << ' ' << 2 << ' ' << n << '\n';
}
}
}
| 7 | CPP |
def main():
t = int(input())
for _ in range(t):
n = int(input())
a = list(map(int, input().split()))
x, y = a[0], a[1]
z = x + y
ans = 0
for i in range(2, n):
if a[i] >= z:
ans = i+1
break
if ans == 0:
print(-1)
else:
print(1, 2, ans)
main() | 7 | PYTHON3 |
t = int(input())
while (t):
n = int(input())
a = input().split()
a = list(map(int,a))
if (a[0]+a[1] <= a[-1]):
print(1,2,n)
else:
print(-1)
t -= 1 | 7 | PYTHON3 |
for _ in range((int(input()))):
n=int(input())
a=list(map(int,input().split()))
ok=False
for i in range(n-1):
#print(a[i]+a[i+1]-a[n-1-i])
if a[i]+a[i+1]<=a[n-1-i]:
ok=True
print(i+1,i+2,n-i)
break
if not ok:
print(-1) | 7 | PYTHON3 |
for _ in " "*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 s in[*open(0)][2::2]:x,y,*a,z=map(int,s.split());print(*([1,2,len(a)+3],[-1])[x+y>z]) | 7 | PYTHON3 |
# for s in[*open(0)][2::2]:a=s;print(s)
for s in[*open(0)][2::2]:x,y,*a,z=map(int,s.split());print(*([1,2,len(a)+3],[-1])[x+y>z]) | 7 | PYTHON3 |
for _ in range (int(input())):
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 |
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 |
for _ in range(int(input())):
n=int(input())
l=list(map(int,input().split()))[:n]
if l[0]+l[1]<=l[-1]:
print(1,2,n)
else:
print(-1) | 7 | PYTHON3 |
for T in range(int(input())):
n = int(input())
l= list(map(int,input().split()))
a1 = l[0]
a2 = l[1]
a3 = l[-1]
if(a1+a2 <= a3):
print(str(1)+" "+str(2)+" "+str(n))
else:
print(-1)
| 7 | PYTHON3 |
for _ in range(int(input())):
n = int(input())
s = list(map(int,input().split()))
k = s[0] + s[1]
if k <= s[-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()))
if a[0] + a[1] <= a[n - 1]:
print(1, 2, n)
else:
print(-1) | 7 | PYTHON3 |
n1=int(input())
for test in range (n1):
n = int(input())
set1=[int(y) for y in input().split()]
m=set1[0]+set1[1]
booli = False
track=0
for i in range(2,n):
if(set1[i]>=m):
track=i+1
break
if(track!=0):
print("1 "+"2 "+str(track))
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[n-1]:
print(1,2,n)
else:
print(-1)
| 7 | PYTHON3 |
t= int(input())
ans=[]
for i in range(t):
n= int(input())
d=[int(i) for i in input().split()]
q=1
x,y=d[0],d[1]
for j in range(2,n):
if (x+y)<=d[j]:
ans.append((1,2,j+1))
q=0
break
if q!=0:
ans.append(-1)
for i in ans:
if i!=-1:
print(i[0],i[1],i[2])
else:
print(i)
| 7 | PYTHON3 |
import sys,math
from collections import deque,defaultdict
import operator as op
from functools import reduce
sys.setrecursionlimit(10**6)
I=sys.stdin.readline
def ii():
return int(I().strip())
def li():
return list(map(int,I().strip().split()))
def mi():
return map(int,I().strip().split())
def ncr(n, r):
r = min(r, n-r)
numer = reduce(op.mul, range(n, n-r, -1), 1)
denom = reduce(op.mul, range(1, r+1), 1)
return numer // denom
def gcd(x, y):
while y:
x, y = y, x % y
return x
def main():
for _ in range(ii()):
n=ii()
arr=li()
if arr[0]+arr[1]<=arr[-1]:
print(1,2,n)
else:
print(-1)
if __name__ == '__main__':
main() | 7 | PYTHON3 |
t = int(input())
for i in range(t):
n = int(input())
arr = list(map(int, input().split()))
if (arr[0] + arr[1] > arr[-1]):
print(-1)
else:
print(1, 2, n) | 7 | PYTHON3 |
#include <bits/stdc++.h>
long long int a[50004];
int main() {
int t;
scanf("%d", &t);
while (t--) {
int n;
scanf("%d", &n);
for (int i = 1; i <= n; i++) scanf("%lld", &a[i]);
if (a[1] + a[2] <= a[n]) {
printf("%d %d %d\n", 1, 2, n);
} else
printf("-1\n");
}
}
| 7 | CPP |
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 |
#include <bits/stdc++.h>
using namespace std;
int main() {
int t;
cin >> t;
int cas = 0;
while (t--) {
int n;
cin >> n;
int a[n], a1 = 0, a2 = 0, a3 = 0;
for (int i = 0; i < n; i++) cin >> a[i];
if (a[0] + a[1] <= a[n - 1])
cout << 1 << " " << 2 << " " << n << endl;
else
cout << -1 << endl;
}
}
| 7 | CPP |
import sys
import math
from collections import defaultdict,Counter
# input=sys.stdin.readline
# def print(x):
# sys.stdout.write(str(x)+"\n")
# sys.stdout=open("CP1/output.txt",'w')
# sys.stdin=open("CP1/input.txt",'r')
# m=pow(10,9)+7
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 |
for i in range(int(input())):
n = int(input())
A = list(map(int,input().split()))
ans = []
if (abs(A[0]-A[n-1])>=A[1]):
ans.append(1)
ans.append(2)
ans.append(n)
elif A[0] >= A[n-1]+A[n-2]:
ans.append(1)
ans.append(n-1)
ans.append(n)
else:ans.append(-1)
print(' '.join(map(str, ans))) | 7 | PYTHON3 |
def process():
n=int(input())
li=list(map(int,input().split()))
li.sort()
hashi={}
c0=1
for i in li:
if i in hashi:
hashi[i].append(c0)
else:
hashi[i]=[c0]
c0+=1
a,b,c=li[0],li[1],li[-1]
if(a+b>c):
print("-1")
else:
ans=[hashi[a].pop(),hashi[b].pop(),hashi[c].pop()]
ans.sort()
print(ans[0],ans[1],ans[2])
tests=int(input())
for i in range(tests):
process() | 7 | PYTHON3 |
from collections import defaultdict
import copy
def ii():return int(input())
def si():return input()
def li():return list(map(int,input().split()))
def mi():return map(int,input().split())
t=ii()
for _ in range(t):
n=ii()
arr=li()
flag=False
a=arr[0]
b=arr[1]
for i in range(n-1,1,-1):
if (a+b<=arr[i]):
print(1,2,i+1)
flag=True
break
if(flag==False):
print(-1) | 7 | PYTHON3 |
def non_degenerate(t, N):
for k in range(2, N):
if t[0]+t[1] <= t[k]:
return str(1)+" "+ str(2)+" "+str(k+1)
return -1
I=input
for _ in range(int(I())):
I()
t= list(map(int,I().split()))
print(non_degenerate(t, len(t))) | 7 | PYTHON3 |
res = ''
for _ in range(int(input())):
n = int(input())
a = list(map(int, input().split()))
if a[n-1] >= a[0] + a[1]: res += f'1 2 {n}\n'
else: res += '-1\n'
print(res) | 7 | PYTHON3 |
#include <bits/stdc++.h>
using namespace std;
int main() {
int t;
scanf("%d", &t);
for (int i = 0; i < t; i++) {
int n;
scanf("%d", &n);
vector<int> a(n);
for (int j = 0; j < n; j++) scanf("%d", &a[j]);
if (a[0] + a[1] <= a[n - 1])
printf("%d %d %d\n", 1, 2, n);
else
printf("-1\n");
}
return 0;
}
| 7 | CPP |
# for #!/usr/bin/env python
import os
import sys
from io import BytesIO, IOBase
# 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)
input = lambda: sys.stdin.readline().rstrip("\r\n")
# endregion
class union_find:
def __init__(self, n):
self.n = n
self.rank = [0]*n
self.parent = [int(j) for j in range(n)]
def union(self,i,j):
i = self.find(i)
j = self.find(j)
if self.rank[i] == self.rank[j]:
self.parent[i] = j
self.rank[j] += 1
elif self.rank[i] > self.rank[j]:
self.parent[j] = i
else:
self.parent[i] = j
def find(self, i):
temp = i
if self.parent[temp] != temp:
self.parent[temp] = self.find(self.parent[temp])
return self.parent[temp]
from math import log2, ceil
from collections import deque, Counter as CC
def main():
# Enter your code here. Read input from STDIN. Print output to STDOUT
for t in range(int(input())):
n = int(input())
l = [int(j) for j in input().split()]
if(l[0]+l[1]<=l[-1]):
print(1,2,n)
else:
print(-1)
if __name__ == "__main__":
main() | 7 | PYTHON3 |
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, a, c, d;
cin >> n;
while (n--) {
int i, j, k, w, q;
cin >> a;
long g, h, e[a], m = 0;
for (i = 1; i <= a; i++) cin >> e[i];
for (i = 2; i <= a - 1; i++) {
if (e[i] + e[i - 1] <= e[a - i + 2]) {
m++;
g = i - 1;
h = i;
k = a - i + 2;
break;
}
}
if (m > 0) {
cout << g << " " << h << " " << k << endl;
} else {
cout << "-1" << endl;
}
}
}
| 7 | CPP |
# cook your dish here
from sys import stdin,stdout
from collections import Counter
from itertools import permutations
import bisect
import math
I=lambda: map(int,stdin.readline().split())
I1=lambda: stdin.readline()
for _ in range(int(I1())):
n=int(I1())
l=list(I())
x,y,z=l[0],l[1],l[n-1]
if(x+y>z): 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[n-1] >= a[0] + a[1]:
print("1 2 " + str(n))
else:
print(-1)
| 7 | PYTHON3 |
#include <bits/stdc++.h>
using namespace std;
int main() {
long long int t;
cin >> t;
while (t--) {
long long int n;
cin >> n;
long long int a[n];
for (int i = 0; i < n; i++) {
cin >> a[i];
}
if (a[0] + a[1] <= a[n - 1]) {
cout << 1 << " " << 2 << " " << n << endl;
} else {
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[-1]:
print(1,2,n)
else:
print(-1)
t -= 1 | 7 | PYTHON3 |
for i in range(int(input())):
n=int(input())
a=[int(x) for x in input().split()]
k=True
if (a[0]+a[1])<=a[-1]:
print(1,2,n)
k=False
if k:
print(-1) | 7 | PYTHON3 |
def find(a):
result = []
i = a[0]
j = a[1]
if(i+j<= a[-1]):
result = [1,2,len(a)]
return result
return -1
t = int(input())
for i in range(t):
n = int(input())
a = list(map(int,input().split()))
answer = find(a)
if(answer!=-1):
print(*answer)
else:
print(answer)
| 7 | PYTHON3 |
for _ in range(int(input())):
n=int(input())
l=list(map(int, input().split()))
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)
| 7 | PYTHON3 |
from collections import deque
from math import *
import heapq
from random import *
import sys
from copy import deepcopy
t=int(input())
for i in range(t):
n=int(input())
l=list(map(int,input().split()))
a=l[0]
b=l[1]
c=l[-1]
if a==0 and b==0 and c==0:
print(1,2,n)
else:
if a+b>c:
print(-1)
else:
print(1,2,n)
| 7 | PYTHON3 |
#!/usr/bin/env python
import os
import sys
from io import BytesIO, IOBase
def main():
for _ in range(int(input())):
n = int(input())
a = list(map(int, input().split()))
# flag = 0
# for i in range(n):
# for j in range(i+1, n):
# for k in range(j+1, n):
# if a[i] + a[j] <= a[k] or a[j] + a[k] <= a[i] or a[k] + a[i] <= a[j]:
# flag = 1
# break
# if flag:
# break
# if flag:
# break
# if flag:
# print(i+1, j+1, k+1)
# else:
# print(-1)
if a[0] + a[1] <= a[n-1]:
print(1, 2, n)
else:
print(-1)
# 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)
input = lambda: sys.stdin.readline().rstrip("\r\n")
# endregion
if __name__ == "__main__":
main()
| 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().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 |
[(lambda N,n:print('1 2 %d'%N if n[0]+n[1]<=n[N-1]else-1))(int(input()),list(map(int,input().split())))for t in range(int(input()))] | 7 | PYTHON3 |
#include <bits/stdc++.h>
using namespace std;
template <class T>
using V = vector<T>;
template <class T>
using VV = V<V<T>>;
int main() {
int t;
cin >> t;
while (t--) {
int n;
cin >> n;
V<int> a(n);
for (int i = 0; i < n; i++) {
cin >> a[i];
}
if (a[0] + a[1] <= a[n - 1]) {
cout << "1 2 " << n << endl;
} else {
cout << -1 << endl;
}
}
return 0;
}
| 7 | CPP |
#include <bits/stdc++.h>
using namespace std;
const double pi = acos(-1);
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
long long tc;
cin >> tc;
while (tc--) {
long long n, x, a, b, y;
cin >> y >> a >> b;
n = y - 2;
while (n--) cin >> x;
if (a + b > x)
cout << "-1\n";
else
cout << "1 2 " << y << endl;
}
}
| 7 | CPP |
t=int(input())
while(t>0):
t=t-1
n=int(input())
a=input().split()
x=int(a[0])
y=int(a[1])
z=int(a[n-1])
if(x+y<=z):
print(1,2,n)
else:
print(-1) | 7 | PYTHON3 |
t=int(input());
for i in range(t):
n=int(input());
s=list(map(int,input().split()));
c=0;
for i in range(n-2):
j=i+1;
for k in range(j+1,n):
if(s[i]+s[j]>s[-1]):
c=-1;
break;
elif(s[i]+s[j]<=s[k]):
c=1;
break;
if(c==1 or c==-1):
break;
if(c==1):
print(i+1,j+1,k+1);
elif(c==-1):
print(-1);
| 7 | PYTHON3 |
#include <bits/stdc++.h>
using namespace std;
const double pi = 3.14159265358979323846;
void fast() {
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
}
long long n, m;
int32_t main() {
fast();
long long T, t;
cin >> T;
for (t = 1; t <= T; t++) {
long long n;
cin >> n;
long long a[n];
for (long long i = 0; i < n; i++) cin >> a[i];
sort(a, a + n);
long long A = a[0], B = a[1], C = a[n - 1];
if (A + B <= C) {
cout << "1 2 " << n << "\n";
} else
cout << -1 << "\n";
}
}
| 7 | CPP |
for _ in range(int(input())):
n = int(input())
a = [int(x) for x in input().split()]
print('1 2', n) if a[n-1] >= a[0] + a[1] else print('-1') | 7 | PYTHON3 |
for _ in range(int(input())):
n = int(input())
a = [int(x) for x in input().split()]
flag = 0
if a[0]+a[1]<=a[-1]:
print(1,2,n)
else:
print(-1)
| 7 | PYTHON3 |
'''
Name : Jaymeet Mehta
codeforces id :mj_13
Problem :
'''
from sys import stdin,stdout
from bisect import bisect
test=int(stdin.readline())
for _ in range(test):
n=int(stdin.readline())
a = [int(x) for x in stdin.readline().split()]
ok=False
for i in range(n-1):
if a[i]+a[i+1]<=a[-1]:
print(i+1,i+2,n)
ok=True
break
if not ok:
print(-1) | 7 | PYTHON3 |
for i in range(int(input())):
n = int(input())
a = list(map(int, input().split()))
if a[0] + a[1] <= a[-1]:
print(1, 2, n)
else:
print(-1) | 7 | PYTHON3 |
import sys,math
input=sys.stdin.readline
t=int(input())
for r in range(t):
n = int(input())
l = list(map(int,input().split()))
a = l[0]
b = l[1]
c = l[n-1]
if a+b > c and b+c>a and a+c>b:
print(-1)
else:
print(1,2,n) | 7 | PYTHON3 |
import math
from collections import Counter
for test in range(int(input())):
n=int(input())
A=list(map(int,input('').split()))
ans=[1,2,n]
if A[0]+A[1]<=A[-1]:
print(*ans)
else:
print(-1)
| 7 | PYTHON3 |
def checkTriangle(arr):
if len(arr) < 3:
return -1
a, b, c = arr[0], arr[1], arr[-1]
if a + b <= c:
return 1, 2, len(arr)
else:
return -1
if __name__ == "__main__":
n_list = []
array_list = []
cases = int(input())
for i in range(cases):
n_list.append(input())
array = list(map(int, input().split()))
array_list.append(array)
for array in array_list:
x = checkTriangle(array)
if x == -1:
print(x)
else:
print(' '.join([str(i) for i in checkTriangle(array)]))
| 7 | PYTHON3 |
from sys import stdin
input = stdin.readline
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)
else:
print(1, 2, n) | 7 | PYTHON3 |
for _ in range(int(input())):
n=int(input())
a=[*map(int,input().split())]
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 t, n;
int main() {
cin >> t;
for (int i = 0; i < t; i++) {
cin >> n;
long long arr[n];
for (int i = 0; i < n; i++) {
cin >> arr[i];
}
if (arr[0] + arr[1] <= arr[n - 1]) {
cout << "1 2 " << n << '\n';
} else {
cout << -1 << '\n';
}
}
}
| 7 | CPP |
def nik(n,rud):
print(1,2,n)if (rud[0]+rud[1] <= rud[-1]) else print(-1)
for _ in range(int(input())):
n = int(input())
rud = list(map(int,input().split()))
nik(n,rud) | 7 | PYTHON3 |
#include <bits/stdc++.h>
using namespace std;
const int mxN = 5e4;
int n, chu[mxN];
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
int t;
cin >> t;
while (t--) {
cin >> n;
for (int i = 0; i < n; i++) cin >> chu[i];
if (chu[0] + chu[1] <= chu[n - 1])
cout << 1 << " " << 2 << " " << n << "\n";
else
cout << -1 << "\n";
}
}
| 7 | CPP |
#include <bits/stdc++.h>
using namespace std;
int main() {
long long t;
cin >> t;
while (t--) {
long long n;
long long i;
cin >> n;
long long a[n];
for (i = 0; i < n; i++) {
cin >> a[i];
}
if (a[0] + a[1] <= a[n - 1])
cout << 1 << " " << 2 << " " << n << "\n";
else
cout << -1 << "\n";
}
return 0;
}
| 7 | CPP |
for i in range(int(input())):
n = int(input())
arr = [int(i) for i in input().split()]
if(arr[0]+arr[1]<=arr[-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]:
x=[1,2,n]
print(*x)
else:
print(-1) | 7 | PYTHON3 |
T=int(input())
for i in range(T):
N=int(input())
lst=list(map(int,input().split()))
lst.sort()
if N<3:
print(-1)
else:
x=lst[0]
y=lst[1]
z=lst[-1]
if x+y>z:
print(-1)
else:
print(1,2,N,sep=" ") | 7 | PYTHON3 |
t = int(input())
for i in range(t):
n = int(input())
arr = list(map(int,input().split()))
if (arr[0] + arr[1]) > arr[-1]:
print('-1')
else:
print(1,2,n)
| 7 | PYTHON3 |
import time
from collections import deque
def inpt():
return int(input())
def inpl():
return list(map(int,input().split()))
def inpm():
return map(int,input().split())
def solve():
n = inpt()
l = inpl()
if(l[0]+l[1]<=l[-1]):
print(1,2,n)
return
else:
print(-1)
return
def main():
#start_time=time.time()
m=10**9+7
t = int(input())
while(t):
t-=1
solve()
#print('Time Elapsed = ',time.time()-start_time," seconds")
if __name__ == "__main__":
main()
| 7 | PYTHON3 |
for _ in range(int(input())):
n=int(input())
a=list(map(int,input().split()))
a.sort()
if a[0]+a[1]<=a[-1]:
print(f"1 2 {n}")
else:
print("-1") | 7 | PYTHON3 |
t=int(input(""))
for i in range(t):
la=int(input(""))
a=[int(x) for x in input("").split()]
if a[0]+a[1]>a[-1]:
print(-1)
else:
for i in range(2,la):
if a[0]+a[1]<=a[i]:
print(1,2,i+1)
break
| 7 | PYTHON3 |
def check(u, v, w):
x = u + v - w
y = u - v + w
z = -u + v + w
return x <= 0 or y <= 0 or z <= 0
def solve():
n = int(input())
a = list(map(int, input().split()))
if check(a[0], a[1], a[-1]):
print(1, 2, n)
return
if check(a[0], a[-1], a[-2]):
print(1, n - 1, n)
return
if check(a[0], a[1], a[2]):
print(1, 2, 3)
return
if check(a[-3], a[-2], a[-1]):
print(n - 2, n - 1, n)
return
print(-1)
t = int(input())
for _ in range(t):
solve() | 7 | PYTHON3 |
import sys #another one
inp=sys.stdin.buffer.readline
inin=lambda : int(inp())
inar=lambda : [int(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 |
import sys
def input():
return sys.stdin.readline().rstrip()
def input_split():
return [int(i) for i in input().split()]
testCases = int(input())
answers = []
for _ in range(testCases):
#take input
n = int(input())
arr = input_split()
x,y,z = arr[0], arr[1], arr[-1]
if x +y > z:
ans = -1
else:
ans = "1 2 {}".format(n)
answers.append(ans)
print(*answers, sep = '\n')
| 7 | PYTHON3 |
import sys
input = sys.stdin.readline
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 |
# ========= /\ /| |====/|
# | / \ | | / |
# | /____\ | | / |
# | / \ | | / |
# ========= / \ ===== |/====|
# code
def main():
t = int(input())
for _ in range(t):
n = int(input())
a = list(map(int, input().split()))
ok = 0
for i, v in enumerate(a[2:]):
if v >= a[0] + a[1]:
print(1,2,i + 3)
ok = 1
break
if not ok:
print(-1)
return
if __name__ == "__main__":
main() | 7 | PYTHON3 |
t=int(input())
for _ in range(t):
n=int(input())
ar=list(map(int,input().split()))
a=ar[0]
b=ar[1]
c=ar[-1]
if c>=a+b:
print(1,2,n)
else:
print(-1)
| 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)
else:
print(1, 2, n) | 7 | PYTHON3 |
#include <bits/stdc++.h>
using namespace std;
const long long inf = 1e9 + 7;
const long long INF = 1LL << 60;
const long long mod = 1e9 + 7;
const long double eps = 1e-8;
const long double pi = acos(-1.0);
template <class T>
inline bool chmax(T& a, T b) {
if (a < b) {
a = b;
return 1;
}
return 0;
}
template <class T>
inline bool chmin(T& a, T b) {
if (a > b) {
a = b;
return 1;
}
return 0;
}
void solve() {
long long n;
cin >> n;
vector<long long> a(n);
for (long long i = 0; i < n; i++) {
cin >> a[i];
}
if (a[0] + a[1] <= a[n - 1]) {
cout << 1 << " " << 2 << " " << n << endl;
} else {
cout << -1 << endl;
}
}
signed main() {
ios::sync_with_stdio(false);
cin.tie(0);
long long t;
cin >> t;
for (long long i = 0; i < t; i++) solve();
return 0;
}
| 7 | CPP |
MOD = 1000000007
from collections import defaultdict as dd,Counter,deque
def si(): return input()
def ii(): return int(input())
def li(): return list(map(int,input().split()))
def mi(): return map(int,input().split())
def out(v): print(v)
def spout(): print(v,end=" ")
def d2b(n): return bin(n).replace("0b","")
def twod(n,m,num):return [[num for x in range(m)] for y in range(n)]
def vow(): return ['a','e','i','o','u']
def let(): return [chr(i) for i in range(97,123)]
def gcd(x, y):
while y:
x, y = y, x % y
return x
def ispow2(x):
return (x and (not(x & (x - 1))))
def prime_factors(n):
i = 2
factors = []
while i * i <= n:
if n % i: i+=1
else:
n //= i
factors.append(i)
if n > 1: factors.append(n)
return (list(factors))
t=ii()
while t:
t-=1
n=ii()
a=li()
if a[-1]>=a[0]+a[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[-1]>=arr[0]+arr[1]:
print(1,2,n)
else:
print(-1)
| 7 | PYTHON3 |
test = int(input())
for t in range(test):
n = int(input())
lst = list(map(int, input().split()))
maxm = max(lst)
minm = lst[0]
final =list()
for i in range(n):
if lst[i] == maxm:
c = i+1
break
Ase = False
for i in range(1, len(lst)):
if minm + lst[i] <= maxm:
b = i + 1
Ase = True
break
if Ase == True:
print(1,b,c)
else:
print(-1)
| 7 | PYTHON3 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.