solution
stringlengths 11
983k
| difficulty
int64 0
21
| language
stringclasses 2
values |
---|---|---|
Test = int(input())
for i in range(Test):
length = int(input())
array = list(map(int,input().split()))
if array[-1] >= array[0] + array[1] : print(1,2,length)
else : print(-1) | 7 | PYTHON3 |
# Pratyaydeep
import sys
inp=sys.stdin.buffer.read().split(b"\n");_ii=-1
_DEBUG=1
def debug(*args):
if _DEBUG:
import inspect
frame = inspect.currentframe()
frame = inspect.getouterframes(frame)[1]
string = inspect.getframeinfo(frame[0]).code_context[0].strip()
arns = string[string.find('(') + 1:-1].split(',')
print(' #debug:',end=' ')
for i,j in zip(arns,args): print(i,' = ',j,end=', ')
print()
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 |
for s in range(int(input())):
n=int(input())
a=list(map(int,input().split()))
add=a[0]+a[1]
flag=0
for i in range(2,n):
if(a[i]>=add):
flag=-1
break
if(flag==0):
print(-1)
else:
print(1,2,i+1) | 7 | PYTHON3 |
for test_i in range(int(input())):
n = int(input())
arr = list(map(int, input().split()))
max_el, min_el1 = max(arr), min(arr)
max_eli, min_el1i = arr.index(max_el), arr.index(min_el1)
arr[min_el1i] = max_el + 1
min_el2 = min(arr)
min_el2i = arr.index(min_el2)
ans = [max_eli + 1, min_el1i + 1, min_el2i + 1]
ans.sort()
print(' '.join(list(map(str, ans))) if min_el1 + min_el2 <= max_el else -1) | 7 | PYTHON3 |
for _ in range(int(input())):
n = int(input())
s = list(map(int,input().split()))
if s[0]+s[1]<=s[-1]:
print(1,2,len(s))
else:
print(-1) | 7 | PYTHON3 |
def main():
for _ in range(int(input())):
n=int(input())
A=[int(e) for e in input().split()]
i=0
j=1
k=n-1
# while k>j:
if A[i]+A[j]<=A[k]:
print(i+1,j+1,k+1)
else:
print(-1)
main()
| 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(f'1 2 {n}')
else:
print(-1) | 7 | PYTHON3 |
t = int(input())
for i in range(t):
n = int(input())
a = list(map(int,input().split()))
if(a[-1]+a[0]<=a[1] or a[-1]+a[1]<=a[0] or a[0]+a[1]<=a[-1]):
print(1,2,n)
else:
print("-1")
| 7 | PYTHON3 |
n = int(input())
for i in range(n):
num_arr = int(input())
arr = input().split(" ")
if (len(arr) < 3):
print("-1")
continue
if (int(arr[0]) + int(arr[1]) <= int(arr[-1])):
print("1 2 " + str(len(arr)))
else:
print("-1") | 7 | PYTHON3 |
for i in range(int(input())):
a=int(input())
b=list(map(int,input().split()))
c=b[0]+b[1]
d=True
for j in range(2,a):
if b[j]>=c:
d=False
break
if d==False:
print(1,2,j+1)
else:
print(-1) | 7 | PYTHON3 |
t = int(input())
for i in range(0,t):
n = int(input())
arr = input().split(" ")
if int(arr[0]) + int(arr[1]) <= int(arr[len(arr)-1]):
print("1 2 "+str(len(arr)))
else:
print("-1") | 7 | PYTHON3 |
for i in range(int(input())):
n=int(input())
a=list(map(int,input().split()))
i=a[0]
j=a[1]
flag=0
for k in range(len(a)-1,-1,-1):
if i+j<=a[k]:
print(1,end=" ")
print(2,end=" ")
print(k+1)
flag=1
break
if flag==0:
print(-1)
| 7 | PYTHON3 |
for _ in range(int(input())):
n=int(input())
f=0
a=list(map(int,input().split()))
for i in range(n-2):
if a[i]+a[i+1]<=a[-1]:
print(i+1,i+2,n)
f=1
break
if f==0:
print("-1") | 7 | PYTHON3 |
# -*- coding: utf-8 -*-
"""
Created on Fri Aug 14 09:48:33 2020
@author: Tuong
"""
t = int(input())
for m in range(t):
n = int(input())
a_n = [int(i) for i in input().split()]
if a_n[0] + a_n[1] <= a_n[-1]:
print(1, 2, n)
else:
print(-1) | 7 | PYTHON3 |
#include <bits/stdc++.h>
using namespace std;
void solve() {
long long int n;
cin >> n;
vector<long long int> a(n);
for (auto &x : a) cin >> x;
long long int p = -1, q = -1, r = -1;
long long int big = a[n - 1];
bool ok = false;
for (int i = n - 2; i >= 0; i--) {
if (a[i] + a[i - 1] <= big && i - 1 >= 0) {
p = i;
q = i + 1;
r = n;
ok = true;
}
}
if (ok == true)
cout << p << " " << q << " " << r << endl;
else
cout << -1 << endl;
}
int main() {
long long int t;
cin >> t;
while (t--) {
solve();
}
}
| 7 | CPP |
import sys, os, io
def rs(): return sys.stdin.readline().rstrip()
def ri(): return int(sys.stdin.readline())
def ria(): return list(map(int, sys.stdin.readline().split()))
def ws(s): sys.stdout.write(s + '\n')
def wi(n): sys.stdout.write(str(n) + '\n')
def wia(a): sys.stdout.write(' '.join([str(x) for x in a]) + '\n')
import math,datetime,functools,itertools,operator,bisect,fractions
from collections import deque,defaultdict,OrderedDict
from fractions import Fraction
from decimal import Decimal
def yetohanswerhai(k,a,b):
c=True
for i in a:
t=0
for j in b:
if (i&j)|k==k:
t+=1
break
if t==0:
c=False
break
return c
def main():
starttime=datetime.datetime.now()
if(os.path.exists('input.txt')):
sys.stdin = open("input.txt","r")
sys.stdout = open("output.txt","w")
for _ in range(ri()):
n=ri()
arr=ria()
a=arr[0]
b=arr[1]
c=arr[n-1]
if a+b<=c:
print(1,2,n)
else:
print(-1)
#<--Solving Area Ends
endtime=datetime.datetime.now()
time=(endtime-starttime).total_seconds()*1000
if(os.path.exists('input.txt')):
print("Time:",time,"ms")
class FastReader(io.IOBase):
newlines = 0
def __init__(self, fd, chunk_size=1024 * 8):
self._fd = fd
self._chunk_size = chunk_size
self.buffer = io.BytesIO()
def read(self):
while True:
b = os.read(self._fd, max(os.fstat(self._fd).st_size, self._chunk_size))
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, size=-1):
while self.newlines == 0:
b = os.read(self._fd, max(os.fstat(self._fd).st_size, self._chunk_size if size == -1 else size))
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()
class FastWriter(io.IOBase):
def __init__(self, fd):
self._fd = fd
self.buffer = io.BytesIO()
self.write = self.buffer.write
def flush(self):
os.write(self._fd, self.buffer.getvalue())
self.buffer.truncate(0), self.buffer.seek(0)
class FastStdin(io.IOBase):
def __init__(self, fd=0):
self.buffer = FastReader(fd)
self.read = lambda: self.buffer.read().decode("ascii")
self.readline = lambda: self.buffer.readline().decode("ascii")
class FastStdout(io.IOBase):
def __init__(self, fd=1):
self.buffer = FastWriter(fd)
self.write = lambda s: self.buffer.write(s.encode("ascii"))
self.flush = self.buffer.flush
if __name__ == '__main__':
sys.stdin = FastStdin()
sys.stdout = FastStdout()
main()
| 7 | PYTHON3 |
import sys
inp=sys.stdin.buffer.readline
inin=lambda : int(inp())
inar=lambda : list(map(int,inp().split()))
inst=lambda : inp().decode().strip()
_T_=inin()
for _t_ in range(_T_):
n=inin()
a=inar()
if a[0]+a[1]>a[n-1]:
print(-1)
else:
print(1,2,n) | 7 | PYTHON3 |
for i in range(int(input())):
n=int(input())
a=sorted(map(int,input().split()))
print("1 2 %d" % n if(a[0]+a[1]<=a[n-1]) else -1) | 7 | PYTHON3 |
t = int(input())
for tt in range(t):
n = int(input())
a = [int(x) for x in input().split()]
ok = True
res = (0,0,0)
i = 0
while i+1 < n-1-i:
if a[i] + a[i+1] <= a[n-1-i]:
ok = False
res = (i+1, i+2, n-1-i+1)
if i < n-2-i:
if a[n-1-i] >= a[i] + a[n-2-i]:
ok = False
res = (i+1, n-2-i+1, n-1-i+1)
i += 1
if ok:
print(-1)
else:
print(res[0], res[1], res[2]) | 7 | PYTHON3 |
#------------------------template--------------------------#
import os
import sys
from math import *
from collections import *
from fractions import *
from bisect import *
from heapq import*
from io import BytesIO, IOBase
def vsInput():
sys.stdin = open('input.txt', 'r')
sys.stdout = open('output.txt', 'w')
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")
ALPHA='abcdefghijklmnopqrstuvwxyz'
M=10**9+7
EPS=1e-6
def value():return tuple(map(int,input().split()))
def array():return [int(i) for i in input().split()]
def Int():return int(input())
def Str():return input()
def arrayS():return [i for i in input().split()]
#-------------------------code---------------------------#
# vsInput()
for _ in range(Int()):
n=Int()
a=array()
x=a[0]
y=a[1]
z=a[-1]
# print(x,y,z)
if(x+y<=z): print(1,2,n)
else: print(-1)
| 7 | PYTHON3 |
for _ in range(int(input())):
n = int(input())
list1 = [int(i) for i in input().split()]
try:
if list1[0]+list1[1]<=list1[-1]:
print(1,2,n)
else:
print(-1)
except:
print(-1) | 7 | PYTHON3 |
# cook your dish here
# code
# ___________________________________
# | |
# | |
# | _, _ _ ,_ |
# | .-'` / \'-'/ \ `'-. |
# | / | | | | \ |
# | ; \_ _/ \_ _/ ; |
# | | `` `` | |
# | | | |
# | ; .-. .-. .-. .-. ; |
# | \ ( '.' \ / '.' ) / |
# | '-.; V ;.-' |
# | ` ` |
# | |
# |___________________________________|
# | |
# | Author : Ramzz |
# | Created On : 21-07-2020 |
# |___________________________________|
#
# _ __ __ _ _ __ ___ ________
# | '__/ _` | '_ ` _ \|_ /_ /
# | | | (_| | | | | | |/ / / /
# |_| \__,_|_| |_| |_/___/___|
#
import math
import collections
from sys import stdin,stdout,setrecursionlimit
from bisect import bisect_left as bsl
from bisect import bisect_right as bsr
import heapq as hq
setrecursionlimit(2**20)
t = 1
t = int(stdin.readline())
for _ in range(t):
n = int(stdin.readline())
#s = stdin.readline().strip('\n')
a = list(map(int, stdin.readline().rstrip().split()))
s1,s2,s3=a[0],a[1],a[-1]
if(a[-1]<a[0]+a[1]):
print(-1)
else:
print("1 2 ",end='')
print(n)
| 7 | PYTHON3 |
for I in range(int(input())):
n = int(input())
a = list(map(int,input().split()))
temp = a[0]+a[1]
res = -1
for i in range(2,n):
if a[i]>=temp:
res = i+1
break
if res==-1:
print(res)
else:
print(1,2,res)
| 7 | PYTHON3 |
#include <bits/stdc++.h>
using namespace std;
void test() {
long long n;
cin >> n;
vector<long long> v;
for (long long i = 0; i < n; i++) {
long long num;
cin >> num;
v.push_back(num);
}
if (v[0] + v[1] <= v[n - 1]) {
cout << 1 << " " << 2 << " " << n << endl;
} else {
cout << -1 << endl;
}
}
int main() {
long long t;
cin >> t;
while (t--) {
test();
}
}
| 7 | CPP |
for _ in range(int(input())):
r=int(input())-1
k=input().split()
if int(k[0])+int(k[1])>int(k[r]):
print(-1)
else:
print("1","2",str(r+1))
| 7 | PYTHON3 |
T = int(input())
for _ in range(T):
N = int(input())
A = list(map(int, input().split()))
a_i = A[0]
a_j = A[1]
ans = 0
for k in range(2, N):
if A[k] >= a_i + a_j:
ans = k
break
if ans == 0:
print(-1)
else:
print(1, 2, k+1) | 7 | PYTHON3 |
for _ in range(int(input())):
n = int(input())
lst = list(map(int, input().split()))
if lst[0]+lst[1] <= lst[n-1]:
print(1, 2, n)
else:
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;
}
}
}
| 7 | CPP |
for _ in range(int(input())):
n=int(input())
l=list(map(int,input().split()))
t=l[0]+l[1]
flag=0
for i in range(2,n):
if l[i]>=t:
flag=1
c=i
break
if flag:
print(1,2,c+1)
else:
print(-1)
# flag=0
# for i in range(n-2):
# a=l[i]
# b=l[i+1]
# c=l[i+2]
# if a+b<=c:
# flag=1
# break
# if flag:
# print(a+1,b+1,c+1)
# else:
# print(-1)
| 7 | PYTHON3 |
"""
Author: Q.E.D
Time: 2020-08-14 09:36:04
"""
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 |
# cook your dish here
for _ in range(int(input())):
n=int(input())
v=list(map(int,input().split()))
flag=0
if len(v)<3:
print(-1)
else:
a=v[0]
b=v[1]
summ=a+b
flag=0
for i in range(2,len(v)):
if v[i]>=summ:
print(1,2,i+1,end=' ')
print()
flag=1
break
if flag==0:
print(-1)
| 7 | PYTHON3 |
import sys
import math,bisect
from collections import defaultdict
from itertools import groupby,accumulate
from heapq import heapify,heappop,heappush
from collections import deque,Counter,OrderedDict
#input = iter(sys.stdin.buffer.read().decode().splitlines()).__next__
def neo(): return map(int,input().split())
def Neo(): return list(map(int,input().split()))
for _ in range(int(input())):
N = int(input())
A = Neo()
if A[0]+A[1] > A[-1]:
print(-1)
else:
print(1,2,N)
| 7 | PYTHON3 |
import sys #another two
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 _ in range(t):
n = int(input())
a, b, *_, c = map(int, input().split())
if a + b <= c:
print(1, 2, n)
else:
print(-1)
| 7 | PYTHON3 |
from math import *
from copy import *
from string import * # alpha = ascii_lowercase
from random import *
from sys import stdin,stdout
from sys import maxsize
from operator import * # d = sorted(d.items(), key=itemgetter(1))
from itertools import *
from collections import Counter # d = dict(Counter(l))
import math
import math
import time
from queue import Queue
# PradeepGhosh_2017076
def seive(n):
l=[True]
l=l*(n+1)
for i in range(2,int(sqrt(n))+1):
if(l[i]==True):
val=i*i
while(val<len(l)):
l[val]=False
val+=i
prime=[]
for i in range(2,len(l)):
if(l[i]==True):
prime.append(i)
return prime
def dp(l,i,n,val,ans):
if(i>=n or val<0):
return 1000000
elif(val==0):
return 0
else:
if(ans[i]==1000000):
ans[i]=min(min(1+dp(l,i+1,n,val-l[i],ans),1+dp(l,i,n,val-l[i],ans)),dp(l,i+1,n,val,ans))
return ans[i]
from queue import Queue
def factors(n):
l=[]
for i in range(1,int(sqrt(n))+1):
if(n%i==0):
if(n//i==i):
l.append(i)
else:
l.append(i)
l.append(n//i)
return l
def check1(s,v,x):
while(True):
if(v not in s):
return v
else:
v-=1
def check2(s,v,x):
while(True):
if(v not in s):
return v
else:
v+=1
def up(n):
j=n-1
while(j>0):
if(n%j==0):
break
j-=1
return j
def fac(n):
c=1
i=1
while(i<=n):
c*=i
i+=1
return c
def check_happy(n):
ss=set()
print(n)
while(n!=1):
val=n
s=0
print(val)
while(val!=0):
s+=(val%10)**2
val=val//10
print(val)
print("hi")
if(val in ss):
return False
else:
n=val
ss.add(n)
return True
def update(a,b):
c=1
val=a
while(a<b):
print(c,a)
c+=c
a+=a
print(1)
while(a>b):
print()
a-=val
c-=1
return c
import random as rand
def gcd(a,b):
if a == 0:
return b
return gcd(b % a, a)
# nakdna
from itertools import permutations
def insertion_sort(arr):
for i in range(len(arr)):
j=i
while(j>0):
if(arr[j]<arr[j-1]):
temp=arr[j]
arr[j]=arr[j-1]
arr[j-1]=temp
j-=1
return arr
def quick_sort(arr,low,high):
i=low
j=high
while(i<j):
if(arr[i]>arr[low] and arr[j]<arr[low]):
temp=arr[i]
arr[i]=arr[j]
arr[j]=arr[i]
i+=1
j-=1
elif(arr[i]<=arr[low]):
i+=1
elif(arr[j]>=arr[low]):
j-=1
print(i,j)
toto=arr[j]
arr[j]=arr[low]
arr[low]=toto
return j
def dodo(arr,low,high):
if(low<high):
val=quick_sort(arr,low,high)
dodo(arr,low,val-1)
dodo(arr,val+1,high)
def dp(arr,c,n,k,z,ans):
if(k==0):
return ans
else:
if(c==0):
return dp(arr,c+1,n,k-1,z,ans+arr[c+1])
elif(c==n-1):
if(z==0):
return 0
else:
return dp(arr,c-1,n,k-1,z-1,ans+arr[c-1])
else:
if(z==0):
return dp(arr,c+1,n,k-1,z,ans+arr[c+1])
else:
return max(dp(arr,c+1,n,k-1,z,ans+arr[c+1]),dp(arr,c-1,n,k-1,z-1,ans+arr[c-1]))
def check(arr,val):
a=-1
for i in range(len(arr)):
if(arr[i][len(arr[i])-1]==val):
a=i
break
return a
def reverse(s,i,ans):
if(i>=len(s)):
return ans
else:
return reverse(s,i+1,s[i]+ans)
def update(arr,i,j,n,m):
if(i>=0 and i<n and j>=0 and j<m):
if(arr[i][j]==1):
arr[i][j]==2
return [i,j]
return [-1,-1]
if __name__ == '__main__':
t=int(stdin.readline())
for i in range(t):
n=int(stdin.readline())
arr=list(map(int,stdin.readline().split(" ")))
if(arr[0]+arr[1]<=arr[n-1]):
print(1,2,n)
else:
print(-1)
| 7 | PYTHON3 |
'''
Auther: ghoshashis545 Ashis Ghosh
College: jalpaiguri Govt Enggineering College
'''
from os import path
import sys
from functools import cmp_to_key as ctk
from collections import deque,defaultdict as dd
from bisect import bisect,bisect_left,bisect_right,insort,insort_left,insort_right
from itertools import permutations
from datetime import datetime
from math import ceil,sqrt,log,gcd
def ii():return int(input())
def si():return input()
def mi():return map(int,input().split())
def li():return list(mi())
abc='abcdefghijklmnopqrstuvwxyz'
mod=1000000007
#mod=998244353
inf = float("inf")
vow=['a','e','i','o','u']
dx,dy=[-1,1,0,0],[0,0,1,-1]
def bo(i):
return ord(i)-ord('a')
def solve():
for _ in range(ii()):
n = ii()
a = li()
x= []
for i in range(n):
x.append([a[i],i+1])
x.sort()
if x[0][0]+x[1][0] > x[-1][0]:
print('-1')
else:
b =[x[0][1],x[1][1],x[-1][1]]
b.sort()
print(*b)
if __name__ =="__main__":
if path.exists('input.txt'):
sys.stdin=open('input.txt', 'r')
sys.stdout=open('output.txt','w')
else:
input=sys.stdin.readline
solve()
| 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(str("1")+" "+str("2")+" "+str(n)) | 7 | PYTHON3 |
tests = int(input())
for t in range(tests):
n = int(input())
ls = list(map(int, input().split()))
if ls[0] + ls[1] <= ls[-1]:
print(f"1 2 {n}")
else:
print(-1) | 7 | PYTHON3 |
t=int(input())
for _ in range(t):
n=int(input())
l=list(map(int,input().split()))
x,y,z=l[0],l[-1],l[1]
if y>=x+z:
print(1,2,n)
else:
print(-1) | 7 | PYTHON3 |
for _ in [0]*int(input()):
n = int(input())
arr=[int(a) for a in input().split()]
if (arr[0]+arr[1] <= arr[-1]):
print(1,2,n)
else:
print(-1)
| 7 | PYTHON3 |
import os #3
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())
for test in range(t):
n = int(input())
nums = [int(x) for x in input().split()]
first = nums[0]+nums[1]
if first <= nums[-1]:
print(1,2,n)
else:
print(-1) | 7 | PYTHON3 |
import copy
for ii in range(int(input())):
n=int(input())
a=list(map(int , input().split()))
b=copy.deepcopy(a)
b.sort()
x=b[0]
y=b[1]
z=b[n-1]
if x+y<=z:
print(1,2,n)
else:
print(-1)
| 7 | PYTHON3 |
for _ in range(int(input())):
t = 1
n = int(input())
a = list(map(int, input().split()))
for k in range(2, n):
if (a[k] >= a[0] + a[1]) and t:
t = 0
print(1, 2, k + 1)
break
if t:
print(-1) | 7 | PYTHON3 |
import sys
input = sys.stdin.readline
t = int(input())
for _ in range(t):
n = int(input())
nList = list(map(int, input().split()))
if nList[0]+nList[1] > nList[-1]:
print(-1)
else:
print(1, 2, n)
| 7 | PYTHON3 |
for _ in range(int(input())):
N = int(input())
A = list(map(int, input().split()))
A = [[A[i], i + 1] for i in range(N)]
A.sort()
if A[0][0] + A[1][0] <= A[-1][0]:
ans = [A[0][1], A[1][1], A[-1][1]]
else:
ans = [-1]
ans.sort()
print(*ans) | 7 | PYTHON3 |
for i in range(int(input())):
n = int(input())
a = list(map(int,input().split()))
print("1 2 "+str(n) if len(a) >= 3 and a[0]+a[1] <= a[n-1] else -1) | 7 | PYTHON3 |
for _ in range(int(input())):
n=int(input())
a=list(map(int,input().split()))
c=0
if a[0]+a[1]<=a[-1]:
print(1,2,n)
c=1
if c==0:
print(-1) | 7 | PYTHON3 |
t=int(input())
for i in range(0,t):
n=int(input())
f=0
a=list(map(int,input().split()))
summ=a[0]+a[1]
for j in range(2,len(a)):
if summ<=a[j]:
f=j
break
if f==0:
print(-1)
elif f!=0:
print(1,end=' ')
print(2,end=' ')
print(f+1) | 7 | PYTHON3 |
#include <bits/stdc++.h>
using namespace std;
void showlist(list<long long int> g) {
list<long long int>::iterator it;
for (it = g.begin(); it != g.end(); ++it) cout << *it << " ";
}
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
long long int t;
cin >> t;
while (t--) {
long long int n{}, m{}, k{};
cin >> n;
vector<long long int> v(n);
for (long long int i = 0; i < (n); i++) cin >> v.at(i);
long long int r{};
for (long long int i = 0; i < (n - 1); i++) {
if ((v[i] + v[i + 1]) <= v[v.size() - 1]) {
cout << i + 1 << " " << i + 2 << " " << n << ("\n");
r = 1;
break;
}
}
if (r == 0) cout << -1 << ("\n");
}
}
| 7 | CPP |
from sys import stdin, stdout
def main():
t = int(input())
for _ in range(t):
n = int(input())
arr = list(map(int, stdin.readline().split()))
if arr[n - 1] >= arr[0] + arr[1]:
print(1, 2, n)
else:
print(-1)
main() | 7 | PYTHON3 |
from sys import stdin,stdout
from math import sqrt,gcd,ceil,floor,log2,log10,factorial,cos,acos,tan,atan,atan2,sin,asin,radians,degrees,hypot
from bisect import insort, insort_left, insort_right, bisect_left, bisect_right, bisect
from array import array
from functools import reduce
from itertools import combinations, combinations_with_replacement, permutations
from fractions import Fraction
from random import choice,getrandbits,randint,random,randrange,shuffle
from re import compile,findall,escape
from statistics import mean,median,mode
from heapq import heapify,heappop,heappush,heappushpop,heapreplace,merge,nlargest,nsmallest
for test in range(int(stdin.readline())):
n=int(input())
l=list(map(int,input().split()))
ind1=0
ind2=1
ind3=n-1
if l[ind1]+l[ind2]<=l[ind3]:
print(ind1+1,ind2+1,ind3+1)
else:
print(-1) | 7 | PYTHON3 |
def A(arr):
if arr[0] + arr[1] <= arr[len(arr)-1]:
print(1, 2, len(arr))
else:
print(-1)
count = int(input())
for i in range(count):
lne = int(input())
arr = list(map(int, input().split()))
A(arr) | 7 | PYTHON3 |
import math
T = int(input())
lets = 'abcdefghijklmnopqrstuvwxyz'
key = {lets[i]:i for i in range(26)}
for i in range(T):
n = int(input())
#n,m = map(int, input().split())
#a = input()
a = list(map(int,input().split()))
d = False
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())
arr = list(map(int, input().split()))
result = False
for i in range(n-1):
if arr[i]+arr[i+1]<=arr[n-1]:
print(i+1,i+2,n)
result = True
break
if result == False:
print(-1) | 7 | PYTHON3 |
for _ in range(int(input())):
n=int(input())
l=list(map(int,input().strip().split()[:n]))
if l[0]+l[1]>l[n-1]:
print(-1)
else:print(1,2,n) | 7 | PYTHON3 |
#include <bits/stdc++.h>
using namespace std;
int main() {
long long t, n, i, j, k, x, flag;
long long* a;
cin >> t;
while (t--) {
cin >> n;
a = new long long[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";
}
}
}
| 7 | CPP |
for t in range(int(input())):
b=int(input())
a=[int(x) for x in input().split()]
flag=0
if(a[0]+a[1]<=a[-1]):
print(1,2,b)
else:
print('-1') | 7 | PYTHON3 |
for _ in range(int(input())):
n=int(input())
l=list(map(int,input().split()))
def bin_search(data, target): # order of log(n) # works only on sorted list
low = 0
high = len(data) - 1
while low <= high:
mid = (low + high) // 2
if data[mid] >= target:
return mid
elif data[mid] < target:
low = mid + 1
else:
high = mid - 1
return -1
for i in range(n-2):
a=bin_search(l,l[i]+l[i+1])
if a!=-1:
print(i+1,i+2,a+1)
break
else:
print(-1)
| 7 | PYTHON3 |
t=int(input())
for tc in range(t):
n=int(input())
a=list(map(int,input().split()))
if a[0]+a[1]>a[n-1]:
print(-1)
else:
print(1," ",2," ",n)
| 7 | PYTHON3 |
t = int(input())
for _ in range(t):
n = int(input())
a = list(map(int, input().split()))
ok = False
for i in range(1, n-1):
if a[i-1]+a[i] <= a[-1]:
print(i, i+1, n)
ok = True
break
if not ok:
print(-1) | 7 | PYTHON3 |
t=int(input())
for q in range(t):
n=int(input())
ch=input()
L=[int(i)for i in ch.split()]
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 = list(map(int, input().split()))
if a[-1] >= a[0] + a[1]:
print(f'1 2 {len(a)}')
else:
print('-1')
| 7 | PYTHON3 |
t=int(input())
for x in range(t):
n=int(input())
a=list(map(int,input().split()))
count=0
if a[0]+a[1]<=a[-1]:
print('1','2',n)
else:
print('-1')
| 7 | PYTHON3 |
import sys
input = sys.stdin.readline
T = int(input())
for t in range(T):
N = int(input())
A = [int(_) for _ 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())
l=list(map(int,input().split()))
a=l[0]
b=l[1]
c=l[-1]
if(a+b<=c):
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[-1]:
print(1,2,n)
else:
print(-1)
"""
3
7
4 6 11 11 15 18 20
4
10 10 10 11
3
1 1 1000000000
---------------
2 3 6
-1
1 2 3
"""
| 7 | PYTHON3 |
def degenerate(a,n):
a = sorted(a)
if a[0]+a[1] <= a[-1]:
print(1,2,n)
else:
print(-1)
t = int(input())
for _ in range(t):
n = int(input())
a = list(map(int, input().split()))
degenerate(a,n) | 7 | PYTHON3 |
import sys
stdin = sys.stdin
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip() # ignore trailing spaces
t = ni()
for _ in range(t):
n = ni()
ar = [int(x) for x in input().split()]
if (ar[0] + ar[1] <= ar[-1]):
print("1 2 "+str(n))
else:
print("-1")
| 7 | PYTHON3 |
import os
inp=os.read(0,os.fstat(0).st_size).split(b"\n");_ii=-1
_DEBUG=0
def debug(*args):
if _DEBUG:
import inspect
frame = inspect.currentframe()
frame = inspect.getouterframes(frame)[1]
string = inspect.getframeinfo(frame[0]).code_context[0].strip()
arns = string[string.find('(') + 1:-1].split(',')
print(' #debug:',end=' ')
for i,j in zip(arns,args): print(i,' = ',j,end=', ')
print()
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()
debug(n,a)
if a[0]+a[1]>a[n-1]:
print(-1)
else:
print(1,2,n) | 7 | PYTHON3 |
for i in range(int(input())):
n=int(input())
l=list(map(int,input().split()))
p=max(l)
i1=l.index(p)
m1=min(l)
i2=l.index(m1)
l[i2]=p
m2=min(l)
i3=l.index(m2)
if(m1+m2 <= p):
i1+=1
i2+=1
i3+=1
l1=[]
l1.append(i1)
l1.append(i2)
l1.append(i3)
l1.sort()
print(*l1,sep=' ')
else:
print(-1) | 7 | PYTHON3 |
#include <bits/stdc++.h>
using namespace std;
int main() {
int t;
cin >> t;
while (t) {
int n;
cin >> n;
vector<int> vec;
int flag = 1;
for (int j = 0; j < n; j++) {
int x;
cin >> x;
vec.push_back(x);
}
for (int i = 2; i < n; i++) {
if (vec[0] + vec[1] <= vec[i]) {
flag = 0;
cout << 1 << " " << 2 << " " << i + 1 << "\n";
break;
}
}
if (flag) cout << -1 << "\n";
t--;
}
return 0;
}
| 7 | CPP |
def solve(arr,n):
if(arr[-1]>=arr[0]+arr[1]):
print(1,2,n)
return
print(-1)
t = int(input())
for _ in range(t):
n = int(input())
arr = list(map(int,input().split()))
solve(arr,n) | 7 | PYTHON3 |
for _ in range(int(input())):
n=int(input())
arr=list(map(int,input().split()))
if arr[0]+arr[1]>arr[n-1]:
print(-1)
else:
print(1,2,n) | 7 | PYTHON3 |
#include <bits/stdc++.h>
using namespace std;
int main() {
int T;
cin >> T;
while (T--) {
int n;
cin >> n;
vector<pair<int, int> > A(n);
for (int i = 0; i < n; i++) {
cin >> A[i].first;
A[i].second = i + 1;
}
sort(A.begin(), A.end());
if (A[0].first + A[1].first <= A[n - 1].first) {
cout << A[0].second << ' ' << A[1].second << ' ' << A[n - 1].second
<< '\n';
} else {
cout << "-1\n";
}
}
}
| 7 | CPP |
for z in range(int(input())):
n=int(input())
flag = 1
a=[int(i) for i in input().split()]
for i in range(n-2):
if(a[i]+a[i+1]<=a[n-1]):
flag=0
print(i+1,i+2,n)
break
if flag==1:
print("-1") | 7 | PYTHON3 |
for _ in range(int(input())):
n = int(input())
a = [int(i) for i in input().split()]
minimum = min(a)
ind = a.index(minimum)
nexus = a[ind]
a[ind] = -1
maximum = max(a)
a[ind] = float('inf')
minimum2 = min(a)
ind2 = a.index(minimum2)
ind3 = a.index(maximum)
a[ind] = nexus
if a[ind] + a[ind2] <= a[ind3]:
print(ind + 1, ind2 + 1, ind3 + 1)
else:
# print(ind, ind2, ind3)
print(-1)
| 7 | PYTHON3 |
#include <bits/stdc++.h>
using namespace std;
int main() {
int t, n, i;
cin >> t;
while (t--) {
cin >> n;
long long int a[n];
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 sys import stdin
t=int(input())
for T in range(t) :
n=int(input())
arr=[int(x) for x in stdin.readline().split()]
flag=0
for i in range(n-2) :
for k in range(2,n) :
if arr[i]+arr[i+1]<=arr[k] :
print(i+1,i+2,k+1)
flag=1
break
if flag==1 :
break
elif flag==0 :
print(-1)
break | 7 | PYTHON3 |
#1398A
for i in range(int(input())):
n=int(input())
a=list(map(int,input().split()))
print(1,2,n) if a[0]+a[1] <= a[-1] else print(-1)
| 7 | PYTHON3 |
t=int(input())
for i in range(t):
n=int(input())
l=list(map(int,input().split()))
c=0
if(l[0]+l[1]<=max(l)):
a=l.index(max(l))
print(1,2,a+1)
else:
print(-1) | 7 | PYTHON3 |
t = int(input())
for q in range(t):
n = int(input())
l = list(map(int,input().split()))
if l[0] + l[1] <= l[-1]:
print('1 2',n)
else:
print('-1')
| 7 | PYTHON3 |
for i in range(int(input())):
a=int(input())
b=list(map(int,input().strip().split()))[:a]
if len(b)<3:
print(-1)
else:
sum=b[0]+b[1]
if sum<=b[-1]:
print(str(1)+" "+str(2)+" "+str(len(b)))
else:
print(-1) | 7 | PYTHON3 |
#include <bits/stdc++.h>
using namespace std;
using ll = long long int;
using dl = double;
const int N = 2e5 + 10;
ll aarray[200000 + 10];
ll magic[101][101];
vector<ll> primes;
bool prime[1000001];
int main() {
ios_base::sync_with_stdio(false);
string str;
ll i, j, n, m, k, t;
cin >> t;
while (t--) {
cin >> n;
for (i = 1; i <= n; i++) {
cin >> aarray[i];
}
if (aarray[1] + aarray[2] <= aarray[n]) {
cout << 1 << " " << 2 << " " << n << endl;
} else
cout << -1 << endl;
}
return 0;
}
| 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)
else:
print(" ".join(['1','2',str(n)])) | 7 | PYTHON3 |
t = int(input())
for x in range(t) :
n = int(input())
arr = list(map(int, input().split(" ")))
i = 1
j = 2
l = arr[0] + arr[1]
y = 2
while y < n :
k = arr[y]
if k >= l :
k = y + 1
break
y += 1
if y == n :
print(-1)
else :
print(i, j, k)
| 7 | PYTHON3 |
def solve():
n = int(input())
a = input().split(" ")
a = [int(i) for i in a]
if a[0] + a[1] <= a[-1]:
print(1, 2, n)
else:
print(-1)
t = int(input())
for i in range(t):
solve()
| 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")
else:
print(1,2,n)
t-=1
| 7 | PYTHON3 |
#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
void solve() {
int n;
cin >> n;
vector<int> arr(n);
for (int i = 0; i < n; i++) cin >> arr[i];
if (n >= 3 && arr[0] + arr[1] <= arr[n - 1])
cout << "1 2 " << n << endl;
else
cout << "-1" << endl;
}
int main() {
int T = 1;
cin >> T;
while (T--) {
solve();
}
return 0;
}
| 7 | CPP |
from sys import stdin
g = lambda : stdin.readline().strip()
gl = lambda : g().split()
gil = lambda : [int(var) for var in gl()]
gcl = lambda : list(g())
gbs = lambda : [int(var) for var in g()]
mod = int(1e9)+7
inf = float("inf")
t, = gil()
from bisect import *
for _ in range(t):
n, = gil()
a = gil()
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() {
ios_base::sync_with_stdio(false);
std::cin.tie(NULL);
std::cout.tie(NULL);
;
int t;
cin >> t;
while (t--) {
int a[5 * 10000 + 5] = {};
int n;
cin >> n;
for (int i = (0); i < (n); i += (1)) cin >> a[i];
if (a[0] + a[1] > a[n - 1])
cout << "-1" << '\n';
else
cout << "1 2 " << n << '\n';
}
return 0;
}
| 7 | CPP |
#include <bits/stdc++.h>
using namespace std;
int main() {
int T, n, vet[51234];
scanf("%d", &T);
while (T--) {
scanf("%d", &n);
for (int i = 0; i < n; i++) {
scanf("%d", &vet[i]);
}
if ((vet[0] + vet[1]) > vet[n - 1]) {
puts("-1");
} else {
printf("%d %d %d\n", 1, 2, n);
}
}
return 0;
}
| 7 | CPP |
#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) {
if (b == 0) return a;
return gcd(b, a % b);
}
long long xyp(long long x, long long y) {
long long res = 1;
while (y > 0) {
if (y % 2 == 1) res = (res * x) % 1000000007;
x = (x * x) % 1000000007;
y /= 2;
}
return res % 1000000007;
}
long long inv(long long x) { return xyp(x, 1000000007 - 2); }
long long inv_euclid(long long a, long long m = 1000000007) {
long long m0 = m;
long long y = 0, x = 1;
if (m == 1) return 0;
while (a > 1) {
long long q = a / m;
long long t = m;
m = a % m, a = t;
t = y;
y = x - q * y;
x = t;
}
if (x < 0) x += m0;
return x;
}
bool isp(long long a) {
if (a == 2) return true;
if (a == 1) return false;
for (long long x = 2; x <= sqrt(a) + 1; x++)
if (a % x == 0) return false;
return true;
}
long long add(long long a, long long b) {
return (a % 1000000007 + b % 1000000007 +
((8000000000000000064LL) / 1000000007) * 1000000007) %
1000000007;
}
long long sub(long long a, long long b) {
return (a % 1000000007 - b % 1000000007 +
((8000000000000000064LL) / 1000000007) * 1000000007) %
1000000007;
}
long long mul(long long a, long long b) {
return ((a % 1000000007) * (b % 1000000007) +
((8000000000000000064LL) / 1000000007) * 1000000007) %
1000000007;
}
signed main() {
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
long long _o_;
cin >> _o_;
while (_o_--) {
long long n;
cin >> n;
long long a[n];
for (auto &z : a) cin >> z;
if (a[0] + a[1] <= a[n - 1]) {
cout << 1 << ' ' << 2 << ' ' << n << '\n';
} else
cout << -1 << '\n';
}
}
| 7 | CPP |
def finder(lst, sum):
for i in range(2, len(lst)):
if lst[i] >= sum:
return i
return -1
t = int(input())
result = list()
for test_case in range(t):
n = int(input())
lst = input()
lst = lst.split()
lst = list(map(int, lst))
one_res = finder(lst, lst[0] + lst[1])
if one_res == -1:
result.append("-1")
else:
result.append("1 2 " + str(one_res + 1))
for i in result:
print(i)
| 7 | PYTHON3 |
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 |
t = int(input())
for i in range(t):
n = int(input())
data = list(map(int , input().split()))
if data[0] + data[1] <= data[-1]:
print(1,2,n)
else:
print(-1) | 7 | PYTHON3 |
t=int(input())
for i in range(t):
n=int(input())
s=input()
l=s.split()
lst=[]
for i in range(len(l)):
lst.append(int(l[i]))
if(lst[0]+lst[1]<=lst[n-1]):
print("1 2",n)
else:
print("-1")
| 7 | PYTHON3 |
t = int(input())
while t>0:
t-=1
n = int(input())
a = list(map(int, input().split()))
if a[0]+a[1]<=(a[n-1]):
print(1,2, n )
else:
print(-1) | 7 | PYTHON3 |
def main():
t = int(input())
for _ in range(t):
n = int(input())
s = list(map(int, input().split()))
if s[0] + s[1] <= s[-1]:
print(1, 2, n)
else:
print(-1)
if __name__ == '__main__':
main()
| 7 | PYTHON3 |
t=int(input())
l=[]
for i in range(t):
n=int(input())
s=list(map(int,input().split()))
l.append(s)
for j in l:
if j[0]+j[1]>j[-1]:
print (-1)
else:
print(1,2,len(j)) | 7 | PYTHON3 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.