solution
stringlengths 11
983k
| difficulty
int64 0
21
| language
stringclasses 2
values |
---|---|---|
for _ in range(int(input())):
n=int(input())
l=[int(i) for i in input().split()]
a,b,c=l[0],l[1],l[-1]
if a+b<=c:
print(1,2,n)
else:
print(-1) | 7 | PYTHON3 |
import os #2
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 |
#include <bits/stdc++.h>
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
int tc;
cin >> tc;
while (tc--) {
int n;
cin >> n;
int a[n + 5];
for (int i = 1; i <= n; i++) cin >> a[i];
if (a[1] + a[2] <= a[n]) {
cout << 1 << " " << 2 << " " << n << endl;
} else {
cout << "-1" << endl;
}
}
return 0;
}
| 7 | CPP |
for t in range(int(input())):
n = int(input())
a = [int(s) for s in input().split()]
if a[0]+a[1] > a[-1]:
print(-1)
else:
print(1,2,n) | 7 | PYTHON3 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri Aug 14 19:55:00 2020
@author: divyarth
"""
import sys
import heapq
import math
#sys.setrecursionlimit(100000)
#input=sys.stdin.readline
#print=sys.stdout.write
from collections import deque
from collections import defaultdict
from collections import Counter
modH=int(10**9)+7
I=lambda : list(map(int,input().split(' ')))
def PRINT(lst,sep=' '): print(sep.join(map(str,lst)))
for _ in range(int(input())):
n=int(input())
lst=I()
if lst[-1]>=lst[0]+lst[1]:
ans=[1,2,n]
PRINT(ans)
else:
print(-1)
| 7 | PYTHON3 |
for _ in range(int(input())):
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 |
import sys
T = int(sys.stdin.readline())
for i in range(T) :
N = int(sys.stdin.readline())
i = 0
arr = list(map(int,sys.stdin.readline().split()))
for i in range (2,N) :
if (arr[0] + arr[1] <= arr[i]) :
print(1,2,i+1)
break
else :
print(-1) | 7 | PYTHON3 |
for _ in range(int(input())):
n = int(input())
arr = list(map(int,input().split()))
i = 0
j = 1
k = n-1
t = 0
while j!=k:
if arr[i] + arr[j] <= arr[k]:
print(i+1,j+1,k+1)
t = -1
break
k-=1
if t==0:
print(-1)
| 7 | PYTHON3 |
t = int(input())
for _ in range(t):
n = int(input())
ali = list(map(int, input().split()))
q = ali[1] + ali[0]
if(ali[-1] >= q):
print(1, 2, n)
else:
print(-1) | 7 | PYTHON3 |
for _ in range(int(input())):
input()
arr=[int(x) for x in input().split()]
if arr[0]+arr[1]<=arr[-1]:
print(1,2,len(arr))
else :print(-1)
| 7 | PYTHON3 |
# -*- coding: utf-8 -*-
import sys
# sys.setrecursionlimit(10**6)
# buff_readline = sys.stdin.buffer.readline
buff_readline = sys.stdin.readline
readline = sys.stdin.readline
INF = 2**62-1
def read_int():
return int(buff_readline())
def read_int_n():
return list(map(int, buff_readline().split()))
def read_float():
return float(buff_readline())
def read_float_n():
return list(map(float, buff_readline().split()))
def read_str():
return readline().strip()
def read_str_n():
return readline().strip().split()
def error_print(*args):
print(*args, file=sys.stderr)
def mt(f):
import time
def wrap(*args, **kwargs):
s = time.time()
ret = f(*args, **kwargs)
e = time.time()
error_print(e - s, 'sec')
return ret
return wrap
@mt
def slv(N, A):
ans = [-1]
if A[0] + A[1] <= A[-1]:
ans = (1, 2, N)
return ans
def main():
for _ in range(read_int()):
N = read_int()
A = read_int_n()
print(*slv(N, A))
if __name__ == '__main__':
main()
| 7 | PYTHON3 |
t=int(input())
while t:
n=int(input())
l=[int(x) for x in input().split()]
for i in range(n-1,1,-1):
if l[0]+l[1]<=l[i]:
print(1,2,i+1)
break
else:
print(-1)
t-=1 | 7 | PYTHON3 |
#include <bits/stdc++.h>
using namespace std;
vector<string> vec_splitter(string s) {
s += ',';
vector<string> res;
while (!s.empty()) {
res.push_back(s.substr(0, s.find(',')));
s = s.substr(s.find(',') + 1);
}
return res;
}
void debug_out(vector<string> __attribute__((unused)) args,
__attribute__((unused)) int idx,
__attribute__((unused)) int LINE_NUM) {
cerr << "\n";
}
template <typename Head, typename... Tail>
void debug_out(vector<string> args, int idx, int LINE_NUM, Head H, Tail... T) {
if (idx > 0)
cerr << ", ";
else
cerr << "Line(" << LINE_NUM << ") ";
stringstream ss;
ss << H;
cerr << args[idx] << " = " << ss.str();
debug_out(args, idx + 1, LINE_NUM, T...);
}
void solve() {
long long int t;
cin >> t;
while (t--) {
long long int n;
cin >> n;
vector<long long int> v(n);
for (auto &it : v) cin >> it;
long long int sum = v[0] + v[1];
long long int ans = -1;
for (long long int(i) = 0; (i) < (n); (i)++) {
if (sum <= v[i]) {
ans = (i + 1);
break;
}
}
if (ans != -1)
cout << 1 << " " << 2 << " " << ans << "\n";
else
cout << ans << "\n";
}
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
solve();
return 0;
}
| 7 | CPP |
for i in range(int(input())):
a=int(input())
b=list(input().split())
if int(b[0])+int(b[1])<=int(b[-1]):
print("1","2",a)
else:
print("-1") | 7 | PYTHON3 |
#include <bits/stdc++.h>
int a[50003];
int main() {
int T;
scanf("%d", &T);
while (T--) {
int n;
scanf("%d", &n);
for (int i = 1; i <= n; ++i) {
scanf("%d", &a[i]);
}
if (a[1] + a[2] <= a[n])
printf("%d %d %d\n", 1, 2, n);
else
puts("-1");
}
}
| 7 | CPP |
#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;
cin >> n;
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 << '\n';
} else {
cout << -1 << '\n';
}
}
}
| 7 | CPP |
t = int(input())
for _ in range(t):
n = int(input())
values = list(map(int, input().split()))
print("-1" if values[0]+values[1]>values[n-1] else f"1 2 {n}") | 7 | PYTHON3 |
import time,math as mt,bisect as bs,sys
from sys import stdin,stdout
from collections import deque
from fractions import Fraction
from collections import Counter
from collections import OrderedDict
pi=3.14159265358979323846264338327950
def II(): # to take integer input
return int(stdin.readline())
def IP(): # to take tuple as input
return map(int,stdin.readline().split())
def L(): # to take list as input
return list(map(int,stdin.readline().split()))
def P(x): # to print integer,list,string etc..
return stdout.write(str(x)+"\n")
def PI(x,y): # to print tuple separatedly
return stdout.write(str(x)+" "+str(y)+"\n")
def lcm(a,b): # to calculate lcm
return (a*b)//gcd(a,b)
def gcd(a,b): # to calculate gcd
if a==0:
return b
elif b==0:
return a
if a>b:
return gcd(a%b,b)
else:
return gcd(a,b%a)
def bfs(adj,v): # a schema of bfs
visited=[False]*(v+1)
q=deque()
while q:
pass
def sieve():
li=[True]*(2*(10**5)+5)
li[0],li[1]=False,False
for i in range(2,len(li),1):
if li[i]==True:
for j in range(i*i,len(li),i):
li[j]=False
prime=[]
for i in range((2*(10**5)+5)):
if li[i]==True:
prime.append(i)
return prime
def setBit(n):
count=0
while n!=0:
n=n&(n-1)
count+=1
return count
mx=10**7
spf=[mx]*(mx+1)
def SPF():
spf[1]=1
for i in range(2,mx+1):
if spf[i]==mx:
spf[i]=i
for j in range(i*i,mx+1,i):
if i<spf[j]:
spf[j]=i
return
def readTree(n,e): # to read tree
adj=[set() for i in range(n+1)]
for i in range(e):
u1,u2=IP()
adj[u1].add(u2)
return adj
#####################################################################################
mod=10**9+7
def solve():
n=II()
li=L()
a,b,c=li[0],li[1],li[-1]
if a<(b+c) and b<(a+c) and c<(a+b):
print(-1)
else:
print(1,2,n)
return
t=II()
for i in range(t):
solve()
#######
#
#
####### # # # #### # # #
# # # # # # # # # # #
# #### # # #### #### # #
###### # # #### # # # # #
| 7 | PYTHON3 |
a=input()
for i in range(int(a)):
b=int(input())
c=list(map(int,input().split()))
if(c[0]+c[1]<=c[b-1]):
print(1,2,b)
else:
print(-1) | 7 | PYTHON3 |
t= int(input())
for T in range(t):
p = 0
n = int(input())
l = list(map(int, input().split()))
s = l[0]+l[1]
for i in range(2, n):
if l[i]>=s:
p=i+1
break
if p ==0:
print(-1)
else:
print("1 2", p)
| 7 | PYTHON3 |
#include <bits/stdc++.h>
#pragma GCC optimize "trapv"
using namespace std;
void solveEachTest(long long int T35TC453N = 1) {
long long int n;
cin >> n;
vector<long long int> arr(n);
for (auto &V3C_I7 : (arr)) cin >> (V3C_I7);
if (arr[0] + arr[1] <= arr[n - 1]) {
cout << "1 2 " << n;
} else {
cout << "-1";
}
cout << "\n";
return;
}
signed main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.precision(10);
long long int T3X0 = 0, T353 = 1;
cin >> (T3X0);
T353 = T3X0;
while (T3X0--) solveEachTest(T353 - T3X0);
return 0;
}
| 7 | CPP |
t=int(input())
for i in range(t):
n=int(input())
a=list(map(int,input().split()))
k=a[0]
m1=0
for j in a:
if j>=a[0]+a[1]:
print(1,2,a.index(j)+1)
break
else:
print(-1)
| 7 | PYTHON3 |
t = int(input())
for k in range(t):
l = 0
n = int(input())
a = [int(x) for x in input().split()]
mina = a.index(min(a))
maxa = a.index(max(a))
#print(a[mina],a[maxa])
for i in range(n):
if i != mina and a[mina] +a[i] <= a[maxa]:
print(mina +1,i +1, maxa+1)
l = 1
break
if l != 1:
print(-1)
| 7 | PYTHON3 |
#include <bits/stdc++.h>
using namespace std;
int t, n, A[1000000];
int main() {
cin >> t;
while (t--) {
cin >> n;
for (int i = 1; i <= n; i++) cin >> A[i];
if (A[1] + A[2] <= A[n])
cout << 1 << " " << 2 << " " << n << endl;
else
cout << -1 << endl;
}
}
| 7 | CPP |
# @author --> ajaymodi
# Naive approach
import sys
# sys.stdin=open("input.in","r")
# sys.stdout=open("output.out","w")
input=lambda : sys.stdin.readline().strip()
char = [chr(i) for i in range(97,123)]
CHAR = [chr(i) for i in range(65,91)]
mp = lambda:list(map(int,input().split()))
INT = lambda:int(input())
rn = lambda:range(INT())
from math import ceil,sqrt,factorial,gcd
for _ in rn():
n = INT()
l = sorted(mp())
if l[0] + l[1] <= l[-1]:
print(1,2,n)
else:
print(-1) | 7 | PYTHON3 |
n = int(input())
for i in range(n):
a = int(input())
l = list(map(int,input().split()))
if l[0] + l[1] <= l[-1]:
print(1,2,len(l))
else:
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)
else:
print(1,2,n) | 7 | PYTHON3 |
t=int(input())
#only show 1 example
for _ in range(t):
n=int(input())
*a,= map(int,input().split())
ai=[(a[i],i+1) for i in range(n)]
ai.sort()
if ai[0][0]+ai[1][0]<=ai[-1][0]:
print(ai[0][1],ai[1][1],ai[-1][1])
else:
print(-1) | 7 | PYTHON3 |
def ans(a,n):
i = 1
j = 2
k = n
if a[i-1]+a[j-1]>a[k-1]:
print(-1)
else:
print(str(i)+' ' +str(j)+' '+str(k))
m = int(input())
for i in range(m):
n = int(input())
arr = input().split()
a = []
for i in arr:
a.append(int(i))
ans(a,n)
| 7 | PYTHON3 |
def findDegenerateTriangle(a):
if a[-1] >= a[0] + a[1]:
print("1 2 " + str(len(a)))
else:
print("-1")
def convertToInt(a):
for i in range(0, len(a)):
a[i] = int(a[i])
return a
t = int(input())
for i in range(t):
n = int(input())
a = input().split()
a = convertToInt(a)
findDegenerateTriangle(a)
| 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)
else:
print(1,2,n)
| 7 | PYTHON3 |
t=int(input())
for i in range(t):
n=int(input())
l=list(map(int,input().split()))
i=0
j=1
k=2
f=0
while(k<n):
if(l[i]+l[j]<=l[k]):
print(i+1,j+1,k+1)
f=1
break
else:
k+=1
if(f==0):
print(-1)
| 7 | PYTHON3 |
from sys import stdin
t = int(stdin.readline())
for _ in range(t):
n = int(stdin.readline())
nums = list(map(int,stdin.readline().split()))
found = False
for i in range(2,len(nums)):
if nums[0] + nums[1] <= nums[i]:
print(1,2,i+1)
found = True
break
if not found:
print(-1)
| 7 | PYTHON3 |
for _ in range(int(input())):
n=int(input())
l=[int(j) for j in input().split()]
c=l[0]+l[1]
f=0
for i in range(2,n):
if c<=l[i]:
print(1,2,i+1)
f=1
break
if f==0:
print(-1)
| 7 | PYTHON3 |
for _ in range(int(input())):
n= int(input())
# n,k,z=map(int,input().split())
a=list(map(int,input().split()))
s=set(a)
flag=False
# dic= {}
# for k in a:
# dic[k]=dic.get(k,0)+1
# for x in dic:
# if dic.get(x)>=3:
# print(-1)
# flag=True
# continue
# if flag==False:
# for i in range(3):
# # if a[i-1]==a[i]:
# # pass
# # else:
# print(i+1,end=" ")
# print()
for i in range(1,n-1):
if a[i-1]+a[i]>a[n-1]:
pass
else:
print(f"{i} {i+1} {n}")
flag=True
break
if flag==False:
print(-1)
| 7 | PYTHON3 |
for t in range(int(input())):
n = int(input())
aa = [int(s) for s in input().split(' ')]
mins = [0] * n
maxs = [0] * n
mins[0] = aa[0]
maxs[n - 1] = aa[n - 1]
for i in range(1, n):
mins[i] = min(mins[i - 1], aa[i])
for i in reversed(range(n - 1)):
maxs[i] = max(maxs[i + 1], aa[i])
found = False
for i in range(1, n - 1):
left = mins[i - 1]
right = maxs[i + 1]
if aa[i] + left <= right:
found = True
print(aa.index(left) + 1, i+1, aa[i+1:].index(right) + i+1 + 1)
break
if not found:
print(-1)
| 7 | PYTHON3 |
#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e9;
int main() {
ios_base::sync_with_stdio(0);
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 << '\n';
} else {
cout << -1 << '\n';
}
}
return 0;
}
| 7 | CPP |
from sys import stdin,stdout
import bisect
import math
from collections import deque
mod=10**9 +7
def st():
return list(stdin.readline().strip())
def inp():
return int(stdin.readline())
def li():
return list(map(int,stdin.readline().split()))
def mp():
return map(int,stdin.readline().split())
def pr(n):
stdout.write(str(n)+"\n")
def DFS(dictionary,vertex,visited):
visited[vertex]=True
stack=[vertex]
print(vertex)
while stack:
a=stack.pop()
for i in dictionary[a]:
if not visited[i]:
print(i)
visited[i]=True
stack.append(i)
def BFS(dictionary, vertex,visited):
visited[vertex]=True
q=deque()
q.append(vertex)
while q:
a=q.popleft()
for i in dictionary[a]:
if not visited[i]:
visited[i]=True
q.append(i)
print(i)
def soe(limit):
l=[1]*(limit+1)
l[0]=0
l[1]=0
prime=[]
for i in range(2,limit+1):
if l[i]:
for j in range(i*i,limit+1,i):
l[j]=0
for i in range(2,limit+1):
if l[i]:
prime.append(i)
return prime
def segsoe(low,high):
limit=int(high**0.5)+1
prime=soe(limit)
n=high-low+1
l=[0]*(n+1)
for i in range(len(prime)):
lowlimit=(low//prime[i])*prime[i]
if lowlimit<low:
lowlimit+=prime[i]
if lowlimit==prime[i]:
lowlimit+=prime[i]
for j in range(lowlimit,high+1,prime[i]):
l[j-low]=1
for i in range(low,high+1):
if not l[i-low]:
if i!=1:
print(i)
def gcd(a,b):
while b:
a=a%b
b,a=a,b
return a
def power(a,n):
r=1
while n:
if n&1:
r=(r*a)
a*=a
n=n>>1
return r
def solve():
n=inp()
l=li()
for i in range(2,n):
if l[0]+l[1]<=l[i]:
print(1,2,i+1)
return
print(-1)
for _ in range(inp()):
solve()
| 7 | PYTHON3 |
from sys import stdin,stdout
from collections import defaultdict
import math
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 |
query = int(input())
for i in range(query):
size = int(input())
arr = list(map(int,input().split()))
arr.sort()
if arr[0]+arr[1]<=arr[size-1]:
print(1,2,size)
else:
print(-1) | 7 | PYTHON3 |
#3
#7
#4 6 11 11 15 18 20
#4
#10 10 10 11
#3
#1 1 1000000000
t=int(input())
for _ in range(t):
n=int(input())
a=list(map(int,input().split()))
i=0
k=n-1
for m in range(1,n-1):
if a[i]+a[m]<=a[k]:
print(i+1,m+1,k+1)
break
else:
print(-1) | 7 | PYTHON3 |
res = ''
for _ in range(int(input())):
n = int(input())
a = [int(x) for x in 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() {
long long t, n;
cin >> t;
while (t--) {
cin >> n;
vector<long long> arr(n);
for (int i = 0; i < n; i++) cin >> arr[i];
int i = 0, j = i + 1, k = j + 1;
bool flag = false;
while (k < n) {
if (arr[i] + arr[j] <= arr[k]) {
cout << i + 1 << " " << j + 1 << " " << k + 1 << "\n";
flag = true;
break;
}
k++;
}
if (flag == false) {
cout << "-1"
<< "\n";
}
}
return 0;
}
| 7 | CPP |
#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5;
int a[N];
int solve() {
int n;
cin >> n;
for (int i = 0; i < n; i++) cin >> a[i];
int i = 0, j = 1, k = 2;
long long sum = a[i] + a[j];
for (int k = 2; k < n; k++) {
if (a[k] >= sum) {
cout << "1 2 " << k + 1 << endl;
return k;
}
}
cout << -1 << endl;
}
int main() {
int t = 1;
cin >> t;
while (t--) {
solve();
}
return 0;
}
| 7 | CPP |
from sys import stdin,stdout
from collections import Counter
from math import ceil
from bisect import bisect_left
from bisect import bisect_right
import math
ai = lambda: list(map(int, stdin.readline().split()))
ei = lambda: map(int, stdin.readline().split())
ip = lambda: int(stdin.readline().strip())
for i in range(ip()):
n = ip()
li = ai()
if (li[0]+li[1]) <= li[-1]:
print(1,2,n)
else:
print(-1) | 7 | PYTHON3 |
for _ in range(int(input())):
n=int(input())
*a,=map(int,input().split())
if a[0]+a[1]<=a[-1]:
print('{} {} {}'.format(1,2,n))
else:
print(-1) | 7 | PYTHON3 |
def Solve():
Result=[]
c=0
if(Arr[c]+Arr[c+1]>Arr[-1]):
Result.append(-1)
return Result
else:
Result.append(c+1)
Result.append(c+2)
Result.append(ArrSize)
return Result
TestCases=int(input(""))
Results=[]
for c in range(TestCases):
ArrSize=int(input(""))
Arr=list(map(int,input().split()))
Results.append(Solve())
for c in Results:
for i in range(len(c)):
print(c[i],end=" ")
print("")
| 7 | PYTHON3 |
# https://codeforces.com/contest/1409/problem/B
for ctr 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 |
#include <bits/stdc++.h>
using namespace std;
int main() {
int t;
cin >> t;
while (t--) {
int n;
cin >> n;
long int a[n];
for (int i = 0; i < n; i++) cin >> a[i];
bool ok = true;
for (int i = 2; i < n; i++)
if (a[0] + a[1] <= a[i]) {
cout << 1 << ' ' << 2 << ' ' << i + 1 << endl;
ok = false;
break;
}
if (ok) cout << -1 << endl;
}
}
| 7 | CPP |
answers = []
for _ in range(int(input())):
n = input()
a = list(map(int, input().strip().split(' ')))
if(a[0] + a[1] <= a[-1]):
answers.append('1 2 {}'.format(len(a)))
else:
answers.append('-1')
for answer in answers:
print(answer) | 7 | PYTHON3 |
for _ in range(int(input())):
n=int(input())
a=list(map(int,input().split()))
sum=a[0]+a[1]
t=-2
for i in range(2,n):
if a[i]>=sum:
t=i
break
if t>0:
print(1,2,t+1)
else:
print(-1)
| 7 | PYTHON3 |
# your code goes here
t=int(input())
for i in range(t):
n=int(input())
ar=list(map(int,input().split()))
flg=0
x=ar[0]
y=ar[1]
z=ar[n-1]
if x+y<=z:
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[n-1] >= a[0] + a[1]:
print("1 2 " + str(n));
else:
print("-1")
| 7 | PYTHON3 |
for _ in range(int(input())):
n = int(input())
arr = list(map(int,input().split()))
ok=0
check = arr[0]+arr[1]
if check <= arr[n-1]:
print(1,2,n)
else:
print(-1)
| 7 | PYTHON3 |
a = int(input())
for x in range(a):
b = int(input())
c = list(map(int,input().split()))
c.sort()
if c[0]+c[1] > c[b-1]:
print(-1)
else:
print(1,2,b) | 7 | PYTHON3 |
def printSolution(array):
if len(array) >= 3:
if array[0] + array[1] <= array[-1]:
print(1, 2, len(array))
return
print(-1)
def submit():
for case in range(int(input())):
input()
array = [int(e) for e in input().split()]
printSolution(array)
submit()
| 7 | PYTHON3 |
t=int(input())
for i in range(t):
N=int(input())
arr = [int(x) for x in input().split()]
if arr[0]+arr[1]<=arr[-1]:
print(1,2,N)
else:
print(-1)
| 7 | PYTHON3 |
for _ in range(int(input())):
n=int(input())
arr=list(map(int,input().split()))
if(arr[0]+arr[1]>arr[n-1]):
print(-1)
else:
print(1,2,n)
| 7 | PYTHON3 |
import sys
import bisect
t=int(input())
for _ in range(t):
#n,m=map(int,input().split())
#l=list(map(int,input().split()))
#l2=list(map(int,input().split()))
n=int(input())
l=list(map(int,input().split()))
i1,j1,k1=0,0,0
if l[0]+l[1]<=l[n-1]:
i1,j1,k1=1,2,n
if i1*j1*k1==0:
print(-1)
else:
print(i1,j1,k1) | 7 | PYTHON3 |
# only gravity will pull me down
from collections import *
from math import *
for _ in range(int(input())) :
n = int(input())
a = list(map(int, input().split()))
f = 0
a.sort()
if a[n-1] >= (a[0] + a[1]) :
print(1, 2, n)
else :
print(-1)
| 7 | PYTHON3 |
import sys #another one
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 |
T = int(input())
for _ in range(T):
n = int(input())
data = list(map(int, input().split()))
if sum(data[0:2]) > data[-1]:
print(-1)
else:
impos = False
for i in range(len(data)-1):
a, b = data[i:i+2]
isPos = False
for j in range(i+2, n):
c = data[j]
if (a+b) <= c: # impos
print(i+1, i+2, j+1)
impos = True
isPos = True
break
if isPos:
break
if not impos:
print(-1)
| 7 | PYTHON3 |
for i in range(int(input())):
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 |
#include <bits/stdc++.h>
int n, a[50005];
void solve() {
scanf("%d", &n);
for (int i = 1; i <= n; ++i) {
scanf("%d", a + i);
}
if (a[1] + a[2] <= a[n]) {
printf("1 2 %d\n", n);
} else {
printf("-1\n");
}
}
int main() {
int T;
scanf("%d", &T);
while (T--) {
solve();
}
}
| 7 | CPP |
#include <bits/stdc++.h>
using namespace std;
int main() {
int t;
cin >> t;
while (t--) {
int n;
cin >> n;
int a[n];
for (int i = 1; i <= n; i++) cin >> a[i];
if (a[2] + a[1] > a[n])
cout << -1 << endl;
else
cout << 1 << " " << 2 << " " << n << endl;
}
}
| 7 | CPP |
#include <bits/stdc++.h>
using namespace std;
bool isPrime(int n) {
if (n <= 1) return false;
for (int i = 2; i < n; i++)
if (n % i == 0) return false;
return true;
}
int main() {
long long int t;
cin >> t;
while (t--) {
long long int n;
cin >> n;
vector<long long int> v;
for (long long int i = 0; i < n; i++) {
long long int x;
cin >> x;
v.push_back(x);
}
if (v[0] + v[1] <= v[n - 1]) {
cout << 1 << " " << 2 << " " << n << "\n";
} else {
cout << -1 << "\n";
}
}
return 0;
}
| 7 | CPP |
t = int(input())
while t>0:
t-=1
n = int(input())
arr = list(map(int,input().strip().split(" ")))
a = arr[-1]
b = arr[0]
c = arr[1]
if c+b > a:
print(-1)
else:
print(1, 2, n) | 7 | PYTHON3 |
# http://codeforces.com/contest/1398/problem/A
# A. Bad Triangle
t = int(input())
for test in range(0, t):
n = int(input())
a = list(map(int, input().rstrip().split()))
ai = a[0]
aj = a[1]
ak = a[n-1]
if (ai+aj)>ak:
print("-1\n")
else:
print("%d %d %d\n" % (1, 2, n)) | 7 | PYTHON3 |
for y in range(int(input())):
n=int(input())
lst=list(map(int,input().split()))
a=0
b=1
c=n
if lst[a]+lst[b]>lst[n-1]:
print('-1')
else:
print('1','2',str(n)) | 7 | PYTHON3 |
import sys
#input=sys.stdin.buffer.readline
t=int(input())
while t:
t-=1
n=int(input())
a=list(map(int,input().split()))
k=a[0]+a[1]
c=0
for i in range(2,n):
if a[i]>=k:
c=1
break
if c==1:
print(1,2,i+1)
else:
print(-1)
| 7 | PYTHON3 |
t=int(input())
a=[]
b=[]
for i in range(t):
p=int(input())
h=list(map(int,input().split()))
a.append(p)
b.append(h)
def tully(a,b):
flag=1
p=-1
for i in range(2,a):
if b[0]+b[1]<=b[i]:
flag=0
p=i
break
return p
for i in range(t):
y=tully(a[i],b[i])
if y==-1:
print("-1")
else:
print(f"1 2 {y+1}")
| 7 | PYTHON3 |
from decimal import *
getcontext().prec=16
from math import sqrt
t=int(input())
answer=[]
for test in range(t):
n=int(input())
liste=list(map(int,input().split(" ")))
a,b=liste[0],liste[1]
for k in range(2,n):
if liste[k]>=a+b:
answer.append("1 2 "+str(k+1))
break
else:
answer.append("-1")
print(("\n").join(answer)) | 7 | PYTHON3 |
for _ in range(int(input())):
n = int(input())
arr = list(map(int, input().split()))
if arr[0] + arr[1] <= arr[n-1]:
print(1, 2, n)
else:
print(-1) | 7 | PYTHON3 |
def check(l):
for i,a1 in enumerate(l[:-2]):
a2=l[i+1]
s=a1+a2
if s<=l[-1]:
return [i,i+1,len(l)-1]
return [-2]
t=int(input())
for i in range(t):
n=int(input())
l=input().split(' ')
l=list(map(int,l))
res=check(l)
for m in res[:-1]:
print(m+1,end=' ')
print(res[-1]+1)
| 7 | PYTHON3 |
t = int(input())
for _ in range(t):
n = int(input())
arr = list(map(int, input().split()))
if (arr[0]+arr[1]) <=arr[-1]:
print(1, 2, n)
else:
print(-1)
| 7 | PYTHON3 |
T = int(input())
for _ in range(T):
n = int(input())
ls = list(map(int, input().split()))
ls.sort()
a = ls[0]
b = ls[1]
c = ls[-1]
if a + b > c:
print(-1)
else:
print(1, 2, n)
| 7 | PYTHON3 |
for test in range(0,int(input())):
n=int(input())
arr=[int(x) for x in input().split()]
one=arr[0]
two=arr[1]
third=arr[n-1]
if one+two>third:
print(-1)
else:
print(1,2,n) | 7 | PYTHON3 |
t=int(input())
for i in range (0,t):
n=int(input())
arr = list(map(int, input().split()))
for j in range (0,n):
a=int(arr[0])
b=int(arr[1])
c=int(arr[n-1])
if (a + b > c):
print(-1)
else:
print(1, 2, n)
# print(a, b, c) | 7 | PYTHON3 |
t=int(input())
while(t>0):
a=int(input())
l=list(map(int,input().split()))
l.sort()
x=l[0]
y=l[1]
z=max(l)
if(x+y<=z):
print(1,2,a)
else:
print('-1')
t-=1
| 7 | PYTHON3 |
w=int(input())
a=[]
for i in range(w):
t=input()
p=input().split()
a.append(p)
for i in range(w):
o=0
r=a[i]
for j in range(2,len(r)):
if int(r[0])+int(r[1])<=int(r[j]):
o = j+1
if o>=3:
print(*[1,2,o])
else:
print(-1)
| 7 | PYTHON3 |
n=int(input())
for _ in range(n):
leng=int(input())
array=input().strip().split(" ")
x=int(array[0])
y=int(array[1])
z=int(array[-1])
if(x+y<=z):
print("%d %d %d" % (1,2,leng))
else:
print("-1") | 7 | PYTHON3 |
T = int (input ())
for I in range (0, T):
N = int (input ())
X = sorted (list (map (int, input ().split (' '))))
if X [0] + X [1] <= X [- 1]:
print (1, 2, len (X))
else:
print (- 1) | 7 | PYTHON3 |
for _ in range(int(input())):
n = int(input())
arr = list(map(int,input().split()))
if(arr[0]+arr[1] > arr[-1]):
print(-1)
else:
print(str(1) + ' ' + str(2) + ' ' + str(n))
| 7 | PYTHON3 |
for _ in range(int(input())):
n = int(input())
lst = list(map(int,input().split()))
if lst[0]+lst[1] > lst[-1]:
print(-1)
else:
print(1,2,n)
| 7 | PYTHON3 |
#include <bits/stdc++.h>
using namespace std;
int main() {
int _;
cin >> _;
while (_--) {
int n;
cin >> n;
long long a[n];
for (int i = 0; i < n; i++) {
cin >> a[i];
}
if (a[0] + a[1] <= a[n - 1])
cout << "1"
<< " "
<< "2"
<< " " << n << endl;
else
cout << "-1" << endl;
}
return 0;
}
| 7 | CPP |
t = int(input())
for _ in range(t):
n = int(input())
a = [int(x) for x in input().split()]
flag = 0
if(a[0]+a[1]<=a[-1]):
print(1,2,n)
flag = 1
if(flag==0):
print(-1) | 7 | PYTHON3 |
def get_triplet(arr):
return [1, 2, len(arr)] if arr[0] + arr[1] <= arr[-1] else None
for _ in range(int(input())):
n = int(input())
arr = list(map(int, input().split()))
result = get_triplet(arr)
if not result:
print(-1)
else:
print(' '.join(map(str, result))) | 7 | PYTHON3 |
for _ in range(int(input())) :
n =int(input())
a = list(map(int,input().split()))
x = True
for i in range(1,n) :
if a[i] + a[0] <= a[-1] :
print(1,i+1,n,sep=" ")
x = False
break
if x : print(-1) | 7 | PYTHON3 |
#rOkY
#FuCk
################################## kOpAl #####################################
t=int(input())
while(t>0):
a=int(input())
l=list(map(int,input().split()))
l.sort()
x=l[0]
y=l[1]
z=max(l)
if(x+y<=z):
print(1,2,a)
else:
print('-1')
t-=1
| 7 | PYTHON3 |
def solve(n, a):
ind1, ind2, ind3 = 0, 0, 0
for i in range(n-1):
k = i + 1
found = False
for j in range(ind2+1, n):
if a[i] + a[j] <= a[k] or a[j] + a[k] <= a[i] or a[k] + a[i] <= a[j]:
found = True
ind1, ind2, ind3 = i, k, j
break
if found:
print(ind1+1, ind2+1, ind3+1)
break
else:
print(-1)
break
t = int(input())
while t:
n = int(input())
a = [int(i) for i in input().split()]
solve(n, a)
t -= 1
| 7 | PYTHON3 |
t = int(input())
for _ in range(t):
n=int(input())
lis=list(map(int,input().split()))
ai=lis[0]
b=lis[1]
c=ai+b
fg=0
d=0
for i in range(2,n):
if(c<=lis[i]):
fg=1
d=i+1
break
if fg==0:
print(-1)
else:
print(1,2,d)
| 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 w 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 |
import sys
input = sys.stdin.readline
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 |
def func(arr,a):
if arr[0] + arr[1] <= arr[-1]:
print(1,2,a)
else:
print(-1)
t = int(input())
for _ in range(t):
a = int(input())
arr = list(map(int, input().split()))
func(arr,a) | 7 | PYTHON3 |
import sys
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); sys.stdout.write('\n')
def wi(n): sys.stdout.write(str(n)); sys.stdout.write('\n')
def wia(a, sep=' '): sys.stdout.write(sep.join([str(x) for x in a])); sys.stdout.write('\n')
def solve(n, a):
if a[0] + a[1] <= a[n-1]:
return [1, 2, n]
return [-1]
def main():
for _ in range(ri()):
n = ri()
a = ria()
wia(solve(n, a))
if __name__ == '__main__':
main()
| 7 | PYTHON3 |
def solve(N, arr):
arr.sort()
if arr[0] + arr[1] > arr[N - 1] and arr[0] + arr[N - 1] > arr[1] and arr[N - 1] + arr[0] > arr[0]:
print(-1)
else:
print(1, 2, N)
t = int(input())
while t != 0:
n = int(input())
a = list(map(int, input().split(' ')))
solve(n, a)
t -= 1
| 7 | PYTHON3 |
def main():
t = int(input())
for i in range(t):
solve()
def solve():
n = int(input())
array = tuple(map(lambda x: int(x), input().split()))
# the sum of smaller two sides should be greater than the largest side
lowestSum = array[0] + array[1]
if array[n-1] < lowestSum: # all the next elements are lower too
print(-1)
else: # not lower than sum -> impossible
print(1, 2, n)
main()
| 7 | PYTHON3 |
t = int(input())
for _ in range(t):
l = int(input())
arr = [int(p) for p in input().split()]
possible = -1
count = 0
a1 = arr[0]
a2 = arr[1]
for i in range(2, len(arr)):
if arr[i] >= a1 + a2:
print(1, 2, i+1)
count += 1
break
if not count:
print(possible) | 7 | PYTHON3 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.