solution
stringlengths 11
983k
| difficulty
int64 0
21
| language
stringclasses 2
values |
---|---|---|
# A. Плохой треугольник
t = int(input())
arrays = []
for i in range(t):
n = int(input())
a = list(map(int, input().split()))
arrays.append(a)
def func(arr: list):
if arr[0] + arr[1] > arr[len(arr) - 1]:
print(-1)
return
else:
print(f'1 2 {len(arr)}')
return
# for i in range(len(arr)):
# for j in range(i + 1, len(arr)):
# sum = arr[i] + arr[j]
# for k in range(len(arr) - 1, j, -1):
# if sum <= arr[k]:
# print(f'{i + 1} {j + 1} {k + 1}')
# return
# print(-1)
for arr in arrays:
func(arr) | 7 | PYTHON3 |
for t 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 |
# cook your dish here
t=int(input())
for _ in range(t):
n=int(input())
a=list(map(int,input().split()))
k=a[0]
m=a[1]
if a[n-1]>=k+m:
print(1,2,n)
else:
print(-1)
| 7 | PYTHON3 |
t=int(input())
for o in range(0,t):
n = int(input())
arr = list(map(int,input().split(" ")))
sum = arr[0] + arr[1]
flag = 0
for i in range(2,n):
if(arr[i] >= sum):
print("{} {} {}".format(1, 2, i + 1))
flag = 1
break
if(flag == 0):
print("-1") | 7 | PYTHON3 |
t = int(input())
while t > 0:
n = int(input())
lst = list(map(int, input().split()))
if lst[0] + lst[1] <= lst[-1]:
print(1,2,n)
else:
print(-1)
t-=1
| 7 | PYTHON3 |
import sys, math
input = lambda: sys.stdin.readline().rstrip()
def pr(a, b, c):
if a + b > c and a + c > b and c + b > a:
return True
return False
for i in range(int(input())):
n = int(input())
a = list(map(int, input().split()))
f, t = a[0], a[1]
ans = True
for i in range(2, n):
if not pr(f, t, a[i]):
ans = False
print(1, 2, i + 1)
break
if ans:
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)
else:
print(1,2,n) | 7 | PYTHON3 |
if __name__=="__main__":
t=int(input())
while(t):
t-=1
n=int(input())
li=list(map(int,input().split()))
i=0
j=1
k=len(li)-1
flag=0
while(i<len(li)-2):
while(j<len(li)-1):
while(j<k):
if li[i]+li[j]>li[k] and li[j]+li[k]>li[i] and li[k]+li[i]>li[j]:
pass
else:
flag=1
print(i+1,j+1,k+1)
break
k-=1
j+=1
if flag==1:
break
i+=1
if flag==1:
break
if flag==0:
print(-1)
| 7 | PYTHON3 |
ans = []
for t in range(int(input())):
n = int(input())
A = list(map(int, input().split()))
if A[0] + A[1] <= A[-1]: ans += [[1, 2, n]]
else: ans += [[-1]]
[print(*x) for x in ans] | 7 | PYTHON3 |
for i in range(int(input())):
n = int(input())
ar = list(map(int,input().split()))
if ar[0]+ar[1]>ar[-1]:
print("-1")
else:
print("1","2",n) | 7 | PYTHON3 |
T = int(input())
for _ in range(T):
length = int(input())
a = list(map(int, input().split()))
x = a[0]
y = a[1]
z = a[-1]
if (x+y <= z):
print(1, 2, len(a))
else:
print(-1) | 7 | PYTHON3 |
for p in range(int(input())):
n=int(input())
x=[int(x) for x in input().split()]
i,j,k=0,1,n-1
a,b,c=x[i],x[j],x[k]
if (a+b)>c:
print(-1)
else:
print(i+1,j+1,k+1) | 7 | PYTHON3 |
z = (int(input()))
for i in range(z):
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 |
t=int(input())
for i in range(t):
n=int(input())
b=list(map(int,input().split()))
if (b[0]+b[1])<=b[-1]:
print(1, 2, n)
else:
print(-1)
| 7 | PYTHON3 |
t=int(input())
for i in range(t):
n=int(input())
l=[int(i) for i in input().split()]
print(1,2,n) if l[0]+l[1]<=l[-1] else print(-1) | 7 | PYTHON3 |
t=int(input())
for i in range(0,t):
n = int(input())
l = list(map(int,input().split()))
a=l[0]
c=l[n-1]
b=False
for i in range(1,n-1):
if(a+l[i] <=c):
b=i+1
break
if(b):
print("1", b, n)
else:
print(-1) | 7 | PYTHON3 |
for _ in range(int(input())):
N=int(input())
A=list(map(int,input().split()))
t=A[0]+A[1]
temp=0
for i in range(2,N):
if(A[i]>=t):
temp=1
print(1,2,i+1)
break
if(temp==0):
print(-1) | 7 | PYTHON3 |
def isTriangle(a, b, c):
if a+b <= c or a+c <= b or b+c <= a:
return False
return True
t = int(input())
while t != 0:
t -= 1
n = int(input())
arr = [int(x) for x in input().split()]
if not isTriangle(arr[0], arr[1], arr[-1]):
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','2',n)
else:
print('-1')
| 7 | PYTHON3 |
from collections import Counter
import sys
sys.setrecursionlimit(10 ** 6)
mod = 1000000007
inf = int(1e18)
dx = [0, 1, 0, -1]
dy = [1, 0, -1, 0]
def inverse(a):
return pow(a, -1, mod)
def solve():
n = int(input())
a = list(map(int, input().split()))
if a[0] + a[1] <= a[-1]:
print(1, 2, n)
else:
print(-1)
def main():
t = int(input())
for _ in range(t):
solve()
main()
| 7 | PYTHON3 |
import os
import heapq
import sys
import math
import operator
from collections import defaultdict
from io import BytesIO, IOBase
"""def gcd(a,b):
if b==0:
return a
else:
return gcd(b,a%b)"""
# def pw(a,b):
# result=1
# while(b>0):
# if(b%2==1): result*=a
# a*=a
# b//=2
# return result
def inpt():
return [int(k) for k in input().split()]
def main():
for _ in range(int(input())):
n=int(input())
ar=inpt()
k=n-1
if(ar[0]+ar[1]<=ar[k]):
print(1,2,n)
else:
print(-1)
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")
if __name__ == "__main__":
main()
| 7 | PYTHON3 |
t = int(input())
i = 0
while i < t:
n = int(input())
a = list(map(int, input().split()))
if a[0] + a[1] <= a[len(a) - 1]:
print(1, 2, len(a))
else:
print(-1)
i += 1 | 7 | PYTHON3 |
test = int(input().strip())
for _ in range(test):
n = int(input().strip())
arr = list(map(int, input().strip().split(" ")))
i1, i2, i3 = 0, 1, n-1
if arr[i1] + arr[i2] <= arr[i3]:
print(i1 + 1, i2 + 1, i3 + 1)
else:
print(-1)
| 7 | PYTHON3 |
#include <bits/stdc++.h>
using namespace std;
vector<int> ar[1000001];
int vis[1000001];
int freq1[26];
int freq2[26];
bool checkPrime(int n) {
if (n <= 1) return false;
if (n <= 3) return true;
if (n % 2 == 0 || n % 3 == 0) return false;
for (int i = 5; i * i <= n; i = i + 6)
if (n % i == 0 || n % (i + 2) == 0) return false;
return true;
}
long long power(long long a, long long b) {
if (b == 0) return 1;
if (b == 1) return a;
if (b % 2 == 1) return (power(a, b - 1) * a) % 1000000007;
long long q = power(a, b / 2);
return (q * q) % 1000000007;
}
bool CPT(long long n) { return !(n & (n - 1)); }
long long gcd(long long int a, long long int b) {
if (b == 0) return a;
return gcd(b, a % b);
}
long long lcm(int a, int b) { return (a / gcd(a, b)) * b; }
bool isSubsetSum(int set[], int n, int sum) {
bool subset[n + 1][sum + 1];
for (int i = 0; i <= n; i++) subset[i][0] = true;
for (int i = 1; i <= sum; i++) subset[0][i] = false;
for (int i = 1; i <= n; i++) {
for (int j = 1; j <= sum; j++) {
if (j < set[i - 1]) subset[i][j] = subset[i - 1][j];
if (j >= set[i - 1])
subset[i][j] = subset[i - 1][j] || subset[i - 1][j - set[i - 1]];
}
}
return subset[n][sum];
}
bool compare(string a, string b) {
string ab = a + b;
string ba = b + a;
return ab > ba;
}
bool isSubSequence(string str1, string str2, int m, int n) {
if (m == 0) return true;
if (n == 0) return false;
if (str1[m - 1] == str2[n - 1])
return isSubSequence(str1, str2, m - 1, n - 1);
return isSubSequence(str1, str2, m, n - 1);
}
bool areEqual(int arr1[], int arr2[], int n, int m) {
if (n != m) return false;
int b1 = arr1[0];
int b2 = arr2[0];
for (int i = 1; i < n; i++) {
b1 ^= arr1[i];
}
for (int i = 1; i < m; i++) {
b2 ^= arr2[i];
}
int all_xor = b1 ^ b2;
if (all_xor == 0) return true;
return false;
}
bool isPrime(int n) {
if (n <= 1) return false;
if (n <= 3) return true;
if (n % 2 == 0 || n % 3 == 0) return false;
for (int i = 5; i * i <= n; i = i + 6)
if (n % i == 0 || n % (i + 2) == 0) return false;
return true;
}
int nextPrime(int N) {
if (N <= 1) return 2;
int prime = N;
bool found = false;
while (!found) {
prime++;
if (isPrime(prime)) found = true;
}
return prime;
}
void solve() {
long long n;
cin >> n;
vector<int> v(n);
for (int i = 0; i < n; i++) cin >> v[i];
if (v[0] + v[1] <= v[n - 1]) {
cout << 1 << " " << 2 << " " << n << "\n";
return;
}
cout << -1 << "\n";
}
int main() {
int tt;
cin >> tt;
while (tt--) solve();
return 0;
}
| 7 | CPP |
t = int(input())
for _ in range(t):
l = int(input())
a = list(map(int, input().strip().split()))
if l < 3:
print(-1)
continue
if a[0]+a[1] <= a[l-1]:
print("{0} {1} {2}".format(1, 2, l))
else:
print(-1)
| 7 | PYTHON3 |
from sys import stdin
def readline():
return stdin.readline()
tests = int(readline())
def solve(n, a):
i = 0
j = 1
k = n - 1
if a[k] >= a[i] + a[j] or a[i] >= a[k] + a[j] or a[j] >= a[i] + a[k]:
return str(i + 1) + ' ' + str(j + 1) + ' ' + str(k + 1)
return -1
for t in range(0, tests):
n = int(readline().rstrip("\n"))
#n, d, m = list(map(int, readline().rstrip("\n").split(' ')))
a = list(map(int, readline().rstrip("\n").split(' ')))
print(solve(n, a))
| 7 | PYTHON3 |
#include <bits/stdc++.h>
using namespace std;
int main() {
int t, n, a[100000];
cin >> t;
for (int i = 0; i < t; i++) {
cin >> n;
for (int j = 0; j < n; j++) {
cin >> a[j];
}
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())
ar=[int(i) for i in input().strip().split(" ")]
a=ar[0]
b=ar[1]
c=ar[-1]
if a+b>c:
print(-1)
else:
print(1,2,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 2 " + str(n))
else:
print(-1)
| 7 | PYTHON3 |
def solve():
n = int(input())
a = list(map(int, input().split()))
if a[0] + a[1] <= a[-1]:
print(1, 2, n)
return
print(-1)
for i in range(int(input())):
solve() | 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 k<=a[i]:
c=1
break
if c==1:
print(1,2,i+1)
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[-1]:
print(1,2,n)
else:
print(-1) | 7 | PYTHON3 |
from sys import stdin,stdout
from itertools import combinations
from collections import defaultdict,Counter
import math
def listIn():
return list((map(int,stdin.readline().strip().split())))
def stringListIn():
return([x for x in stdin.readline().split()])
def intIn():
return (int(stdin.readline()))
def stringIn():
return (stdin.readline().strip())
if __name__=="__main__":
t=intIn()
while(t>0):
t-=1
n=intIn()
a=listIn()
f=0
s=a[0]+a[1]
for i in range(2,n):
if s<=a[i]:
f=1
break
if f:
print(1,2,i+1)
else:
print(-1)
| 7 | PYTHON3 |
# begin FastIO
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 typ=int: typ(rdln())
inar=lambda typ=int: [typ(x) for x in rdln().split()]
inst=lambda: rdln().strip().decode()
# end FastIO
# begin DEBUG
_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()
# end DEBUG
_T_=inin()
for _t_ in range(_T_):
debug(_t_)
n=inin()
a=inar()
if a[0]+a[1]>a[n-1]:
print(-1)
else:
print(1,2,n) | 7 | PYTHON3 |
# def checkKey(dict, key):
# if key in dict:
# return True
# return False
# def helper(s):
# l=len(s)
# if (l==1):
# l=[]
# l.append(s)
# return l
# ch=s[0]
# recresult=helper(s[1:])
# myresult=[]
# myresult.append(ch)
# for st in recresult:
# myresult.append(st)
# ts=ch+st
# myresult.append(ts)
# return myresult
# mod=1000000000+7
# def helper(s,n,open,close,i):
# if(i==2*n):
# for i in s:
# print(i,end='')
# print()
# return
# if(open<n):
# s[i]='('
# helper(s,n,open+1,close,i+1)
# if(close<open):
# s[i]=')'
# helper(s,n,open,close+1,i+1)
# def helper(arr,i,n):
# if(i==n-1):
# recresult=[arr[i]]
# return recresult
# digit=arr[i]
# recresult=helper(arr,i+1,n)
# myresult=[]
# for i in recresult:
# myresult.append(i)
# myresult.append(i+digit);
# myresult.append(digit)
# return myresult
# import copy
# n=int(input())
# arr=list(map(int,input().split()))
# ans=[]
# def helper(arr,i,n):
# if(i==n-1):
# # for a in arr:
# # print(a,end=" ")
# # print()
# l=copy.deepcopy(arr)
# ans.append(l)
# return
# for j in range(i,n):
# if(i!=j):
# if(arr[i]==arr[j]):
# continue
# else:
# arr[i],arr[j]=arr[j],arr[i]
# helper(arr,i+1,n)
# arr[j],arr[i]=arr[i],arr[j]
# else:
# arr[i],arr[j]=arr[j],arr[i]
# helper(arr,i+1,n)
# def helper(sol,n,m):
# for i in range(n+1):
# for j in range(m+1):
# print(sol[i][j],end=" ")
# print()
# def rat_in_a_maze(maze,sol,i,j,n,m):
# if(i==n and j==m):
# sol[i][j]=1
# helper(sol,n,m)
# return True
# if(i>n or j>m):
# return False
# if(maze[i][j]=='X'):
# sol[i][j]=0
# return False
# sol[i][j]=1
# if(rat_in_a_maze(maze,sol,i,j+1,n,m)):
# sol[i][j]=0
# return True
# elif(rat_in_a_maze(maze,sol,i+1,j,n,m)):
# sol[i][j]=0
# return True
# else:
# sol[i][j]=0
# return False
# n,m=map(int,input().split())
# l=[]
# sol=[[0]*m]*n
# for i in range(n):
# arr=list(input())
# l.append(arr)
# rat_in_a_maze(l,sol,0,0,n-1,m-1)
test=int(input())
for _t in range(test):
n=int(input())
arr=list(map(int , input().split()))
if ((arr[0]+arr[1])<=arr[-1]):
print(1,end=" ")
print(2,end=" ")
print(n)
else:
print(-1)
| 7 | PYTHON3 |
#include <bits/stdc++.h>
using namespace std;
int main() {
int t;
cin >> t;
while (t--) {
long long n;
cin >> n;
long long a[n + 1];
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 |
for u in range(int(input())):
n = int(input())
x = [int(w) for w in input().split()]
if x[0] + x[1] > x[-1]:
print(-1)
else:
print(1, 2, n) | 7 | PYTHON3 |
#include <bits/stdc++.h>
using namespace std;
const int N = 100005;
const int oo = INT_MAX;
int t, n;
int a[N];
int main() {
cin >> t;
while (t--) {
scanf("%d", &n);
for (int i = 0; i < n; i++) scanf("%d", a + i);
if (a[0] + a[1] <= a[n - 1])
printf("%d %d %d\n", 1, 2, n);
else
puts("-1");
}
}
| 7 | CPP |
t = int(input())
cnt = 0
while (cnt < t):
cnt += 1
n = int(input())
flag = False
a = [int(i) for i in input().split()]
if a[0] + a[1] <= a[n - 1]:
print(1, 2, n)
else:
print(-1) | 7 | PYTHON3 |
for t in range(int(input())):
n = int(input())
li = [int(x) for x in input().split()]
if li[0]+li[1]<=li[-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 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 |
import math
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 |
#include <bits/stdc++.h>
using namespace std;
int main() {
int i, j, k, t, n;
cin >> t;
while (t--) {
cin >> n;
int arr[n];
for (i = 0; i < n; i++) {
cin >> arr[i];
}
if ((arr[0] + arr[1] <= arr[n - 1]) || (arr[1] + arr[n - 1] <= arr[0]) ||
(arr[0] + arr[n - 1] <= arr[1])) {
cout << "1"
<< " "
<< "2"
<< " " << n << endl;
} else {
cout << "-1" << endl;
}
}
}
| 7 | CPP |
t = int(input())
for _ in range(t):
n = int(input())
a = [int(i) for i in input().split()]
if a[0] + a[1] > a[-1]:
print(-1)
else:
print("1 2", n)
| 7 | PYTHON3 |
for i in range(int(input())):
n = int(input())
array = list(map(int, input().split()))
if(array[0] + array[1] <= array[-1]):
print(1, 2, n)
else:
print(-1)
| 7 | PYTHON3 |
for i in [0]*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 |
from sys import stdin
for _ in range(int(stdin.readline())):
n = int(stdin.readline())
a = list(map(int, stdin.readline().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 s[50001];
signed main() {
int t;
scanf("%d", &t);
while (t--) {
int n;
scanf("%d", &n);
for (int i = 0; i < (n); i++) {
scanf("%d", &s[i]);
}
for (int i = 1; i < n - 1; i++) {
if (s[0] + s[i] <= s[n - 1]) {
printf("%d %d %d\n", 1, i + 1, n);
goto hell;
}
}
printf("-1\n");
hell : {}
}
}
| 7 | CPP |
t = int(input())
for i in range(t):
n = int(input())
a = [int(s) for s in input().split()]
sum = a[0] + a[1]
flag = 0
j = 2
while(flag == 0):
if(sum <= a[j]):
print(1, 2, j+1)
flag = 1
if(j == n-1 and flag == 0):
print(-1)
flag = 1
j += 1 | 7 | PYTHON3 |
t = int(input())
for x in range(t):
n = int(input())
a = list(map(int, input().split()))
b = list(a)
max1 = max(a)
a.remove(max1)
min1 = min(a)
a.remove(min1)
min2 = min(a)
a.remove(min2)
if (max1 >= (min1 + min2)):
print(1, 2, len(b))
continue
a = b
max1 = max(a)
a.remove(max1)
min1 = min(a)
a.remove(min1)
max2 = max(a)
a.remove(min2)
if max1 >= (max2 + min1):
print(1, len(b) - 1, len(b))
else:
print(-1) | 7 | PYTHON3 |
t = int(input())
for _ in range(t):
n = int(input())
num = list(map(int, input().split()))
if num[0] + num[1] > num[n-1]:
print("-1")
else:
print("{} {} {}".format(1, 2, n))
| 7 | PYTHON3 |
for _ in range(int(input())):
n=int(input())
l=list(map(int,input().split()))
a=l[0]
b=l[1]
c=l[len(l)-1]
if (a+b>c and b+c>a and c+a>b)==False:
print(1,2,n)
else:
print(-1) | 7 | PYTHON3 |
#include <bits/stdc++.h>
using namespace std;
int a[50005];
int main() {
int t, n;
cin >> t;
while (t--) {
cin >> n;
for (int i = 1; i <= n; i++) {
cin >> a[i];
}
if (a[1] + a[2] <= a[n]) {
printf("1 2 %d\n", n);
} else {
puts("-1");
}
}
}
| 7 | CPP |
import sys
from collections import defaultdict as dd
from collections import deque
from functools import *
from fractions import Fraction as f
from copy import *
from bisect import *
from heapq import *
from math import *
from itertools import permutations
def eprint(*args):
print(*args, file=sys.stderr)
zz=1
#sys.setrecursionlimit(10**6)
if zz:
input=sys.stdin.readline
else:
sys.stdin=open('input.txt', 'r')
sys.stdout=open('all.txt','w')
def inc(d,c):
d[c]=d[c]+1 if c in d else 1
def li():
return [int(xx) for xx in input().split()]
def fli():
return [float(x) for x in input().split()]
def comp(a,b):
if(a>b):
return 2
return 2 if a==b else 0
def gi():
return [xx for xx in input().split()]
def fi():
return int(input())
def pro(a):
return reduce(lambda a,b:a*b,a)
def swap(a,i,j):
a[i],a[j]=a[j],a[i]
def si():
return list(input().rstrip())
def mi():
return map(int,input().split())
def gh():
sys.stdout.flush()
def isvalid(i,j):
return 0<=i<n and 0<=j<n
def graph(n,m):
for i in range(m):
x,y=mi()
a[x].append(y)
a[y].append(x)
t=fi()
while t>0:
t-=1
n=fi()
a=li()
if a[0]+a[1]<=a[n-1] :
print(1,2,n )
else :
print(-1 )
| 7 | PYTHON3 |
test=int(input())
for t in range(test):
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 |
import sys
# sys.stdin = open('input.txt', 'r')
# sys.stdout = open('output.txt', 'w')
import math
import collections
from sys import stdin,stdout,setrecursionlimit
import bisect as bs
setrecursionlimit(2**20)
M = 10**9+7
T = int(stdin.readline())
# T = 1
for _ in range(T):
n = int(stdin.readline())
# n,d,m = list(map(int,stdin.readline().split()))
a = list(map(int,stdin.readline().split()))
# q = int(stdin.readline())
# a = list(map(int,stdin.readline().split()))
# b = list(map(int,stdin.readline().split()))
b = []
for i in range(n):
b.append((a[i],i+1))
b.sort()
if(b[-1][0] >= b[0][0]+b[1][0]):
fin = [b[-1][1], b[0][1], b[1][1]]
fin.sort()
for h in fin:
print(h,end=' ')
print('')
else:
print(-1) | 7 | PYTHON3 |
from sys import stdin,stdout
for _ in range(int(stdin.readline())):
n=int(stdin.readline())
# =map(int,stdin.readline().split())
a=list(map(int,stdin.readline().split()))
x=a[0];y=a[1];z=a[-1]
if x+y>z and y+z>x and x+z>y:
print(-1)
continue
print(1,2,n) | 7 | PYTHON3 |
t = int(input())
while t:
t-=1
n = int(input())
l = list(map(int, input().split()))
if l[0]+l[1]<=l[-1]:
print(1, 2, n)
else:
print(-1) | 7 | PYTHON3 |
T = int(input())
for _ in range(T):
input()
l = list(map(int,input().split()))
for i in range(len(l)):
l[i] = (l[i], i)
l.sort()
if l[0][0] + l[1][0] <= l[-1][0]:
print(l[0][1] + 1, l[1][1] + 1, l[-1][1] + 1)
else:
print(-1)
| 7 | PYTHON3 |
a=int(input())
for i in range(0,a):
b=int(input())
arr=list(map(int,input().split()))
if(arr[0]+arr[1]>arr[len(arr)-1]):
print(-1)
else:
print(1,2,len(arr)) | 7 | PYTHON3 |
t=int(input())
for castle in range(t):
n=int(input())
ls=list(map(int,input().split()))
a,b,c=ls[0],ls[1],ls[-1]
if a+b>c:
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 |
def main():
t = int(input())
for case in range(t):
n = int(input())
A = [int(x) for x in input().split()]
flag = False
for i in range(n-2):
last = n-1
for rt in range(n-i-2):
last = n-1 - rt
if(A[i] + A[i+1] > A[last]):
break
else:
print(i+1, i+2, last+1)
flag = True
break
if(flag):
break
if(not flag):
print(-1)
""" flag = False
for a in range(n):
for b in range(a+1,n):
lhs = A[a]+A[b]
for c in range(b+1,n):
if(lhs <= A[c]):
print(a+1, b+1, c+1)
flag = True
break
if(flag):
break
if(flag):
break
if(not flag):
print(-1) """
if __name__ == '__main__':
main() | 7 | PYTHON3 |
case=int(input())
while case!=0:
n=int(input())
a=list(map(int,input().split()))
chk=False
i=0
for i in range(n-2):
if a[i]+a[i+1]<=a[n-1]:
print("1","2",n)
chk=True
break
if chk==False:
print("-1")
case-=1
| 7 | PYTHON3 |
## necessary imports
import sys
input = sys.stdin.readline
from bisect import bisect_left;
from bisect import bisect_right;
from math import ceil, factorial;
def ceil(x):
if x != int(x):
x = int(x) + 1;
return x;
# swap_array function
def swaparr(arr, a,b):
temp = arr[a];
arr[a] = arr[b];
arr[b] = temp;
## gcd function
def gcd(a,b):
if b == 0:
return a;
return gcd(b, a % b);
## nCr function efficient using Binomial Cofficient
def nCr(n, k):
if(k > n - k):
k = n - k;
res = 1;
for i in range(k):
res = res * (n - i);
res = res / (i + 1);
return int(res);
## prime factorization
def primefs(n):
## if n == 1 ## calculating primes
primes = {}
while(n%2 == 0 and n > 0):
primes[2] = primes.get(2, 0) + 1
n = n//2
for i in range(3, int(n**0.5)+2, 2):
while(n%i == 0 and n > 0):
primes[i] = primes.get(i, 0) + 1
n = n//i
if n > 2:
primes[n] = primes.get(n, 0) + 1
## prime factoriazation of n is stored in dictionary
## primes and can be accesed. O(sqrt n)
return primes
## MODULAR EXPONENTIATION FUNCTION
def power(x, y, p):
res = 1
x = x % p
if (x == 0) :
return 0
while (y > 0) :
if ((y & 1) == 1) :
res = (res * x) % p
y = y >> 1
x = (x * x) % p
return res
## DISJOINT SET UNINON FUNCTIONS
def swap(a,b):
temp = a
a = b
b = temp
return a,b;
# find function with path compression included (recursive)
# def find(x, link):
# if link[x] == x:
# return x
# link[x] = find(link[x], link);
# return link[x];
# find function with path compression (ITERATIVE)
def find(x, link):
p = x;
while( p != link[p]):
p = link[p];
while( x != p):
nex = link[x];
link[x] = p;
x = nex;
return p;
# the union function which makes union(x,y)
# of two nodes x and y
def union(x, y, link, size):
x = find(x, link)
y = find(y, link)
if size[x] < size[y]:
x,y = swap(x,y)
if x != y:
size[x] += size[y]
link[y] = x
## returns an array of boolean if primes or not USING SIEVE OF ERATOSTHANES
def sieve(n):
prime = [True for i in range(n+1)]
p = 2
while (p * p <= n):
if (prime[p] == True):
for i in range(p * p, n+1, p):
prime[i] = False
p += 1
return prime
#### PRIME FACTORIZATION IN O(log n) using Sieve ####
MAXN = int(1e5 + 5)
def spf_sieve():
spf[1] = 1;
for i in range(2, MAXN):
spf[i] = i;
for i in range(4, MAXN, 2):
spf[i] = 2;
for i in range(3, ceil(MAXN ** 0.5), 2):
if spf[i] == i:
for j in range(i*i, MAXN, i):
if spf[j] == j:
spf[j] = i;
## function for storing smallest prime factors (spf) in the array
################## un-comment below 2 lines when using factorization #################
# spf = [0 for i in range(MAXN)]
# spf_sieve();
def factoriazation(x):
ret = {};
while x != 1:
ret[spf[x]] = ret.get(spf[x], 0) + 1;
x = x//spf[x]
return ret;
## this function is useful for multiple queries only, o/w use
## primefs function above. complexity O(log n)
## taking integer array input
def int_array():
return list(map(int, input().strip().split()));
def float_array():
return list(map(float, input().strip().split()));
## taking string array input
def str_array():
return input().strip().split();
#defining a couple constants
MOD = int(1e9)+7;
CMOD = 998244353;
INF = float('inf'); NINF = -float('inf');
################### ---------------- TEMPLATE ENDS HERE ---------------- ###################
for _ in range(int(input())):
n = int(input()); a = int_array();
if a[0] + a[1] <= a[-1]:
print(*[1, 2, n]);
else:
print(-1); | 7 | PYTHON3 |
from sys import stdin
input = lambda : stdin.readline().strip()
for _ in range(int(input())):
n = int(input())
a = list(map(int,input().split()))
r = range(1,n+1)
a.insert(0,n-1)
ans = False
x = a[1]
y = a[2]
for k in range(2,n+1):
if(x+y<=a[k]):
print(1,2,k)
ans = True
break
if(not ans):
print(-1)
| 7 | PYTHON3 |
#include <bits/stdc++.h>
using namespace std;
int main() {
int t;
cin >> t;
for (int tc = 1; tc <= t; tc++) {
int n;
cin >> n;
vector<int> v(n);
for (int i = 0; i < n; i++) cin >> v[i];
int i = 0, j = 1, k = n - 1;
if (v[i] + v[j] > v[k])
cout << -1 << endl;
else {
cout << i + 1 << " " << j + 1 << " " << k + 1 << endl;
}
}
}
| 7 | CPP |
#include <bits/stdc++.h>
using namespace std;
int main() {
int t;
cin >> t;
for (int p = 0; p < t; p++) {
int n;
cin >> n;
int a[n];
for (int i = 0; i < n; i++) cin >> a[i];
int flag = 0;
int ans[3];
for (int i = 0; i < n - 2; i++) {
int temp;
temp = a[i] + a[i + 1];
if (temp <= a[n - 1]) {
flag = 1;
ans[0] = i + 1;
ans[1] = i + 2;
ans[2] = n;
}
if (flag == 1) break;
}
if (flag == 1)
cout << ans[0] << " " << ans[1] << " " << ans[2] << endl;
else
cout << "-1" << endl;
}
return 0;
}
| 7 | CPP |
t=int(input())
for _ in range(t):
n=int(input())
a=list(map(int,input().split()))
flag=0
for i in range(n-1):
x=a[i]
y=a[i+1]
if(a[-1]>=x+y):
x=i+1
y=i+2
flag=1
break
if(flag==1):
print(x,y,n)
else:
print(-1)
| 7 | PYTHON3 |
t=int(input())
for count 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 i in range(t):
n = int(input())
a = [int(x) for x in 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;
using ll = long long;
mt19937 gen(time(0));
void setIO(string name = "") {
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
}
int main() {
setIO();
int t, n, x;
cin >> t;
for (int j = 0; j < t; j++) {
cin >> n;
vector<int> a(n);
for (int i = 0; i < n; i++) {
cin >> a[i];
}
if (a[n - 1] >= a[0] + a[1]) {
cout << "1 2 " << n << "\n";
} else {
cout << "-1\n";
}
}
}
| 7 | CPP |
t = int(input(""))
for i in range(t):
n = int(input(""))
arr = input().split(" ")
if int(arr[0])+int(arr[1])<=int(arr[-1]):
print(1,2,n)
else:
print(-1)
| 7 | PYTHON3 |
test_cases = int(input())
for tests in range(0, test_cases):
n = int(input())
l = list(map(int, input().split()))
if l[0] + l[1] <= l[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[0]+a[1]<=a[-1]):
print(1,2,n)
else:
print(-1)
| 7 | PYTHON3 |
#include <bits/stdc++.h>
using namespace std;
template <class T>
bool mini(T &a, T b) {
return a > b ? (a = b, true) : false;
}
template <class T>
bool maxi(T &a, T b) {
return a < b ? (a = b, true) : false;
}
signed main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
cout.precision(10);
cout << fixed;
int t;
cin >> t;
while (t--) {
int n;
cin >> n;
vector<long long> a(n + 3);
for (int i = 0; i < (int)(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 _ in range(int(input())):
n=int(input())
list1=[int(x) for x in input().split()]
val1=list1[0]+list1[1]
if val1<=list1[n-1]:
print(1,2,n)
else:
print(-1)
| 7 | PYTHON3 |
import sys
max_int = 1000000001 # 10^9+1
min_int = -max_int
t = int(input())
for _t in range(t):
n = int(sys.stdin.readline())
a = list(map(int, sys.stdin.readline().split()))
if a[0] + a[1] <= a[-1]:
print(1, 2, n)
else:
print(-1)
| 7 | PYTHON3 |
t = int(input())
while t > 0:
n = int(input())
x = list(map(int, input().split()))
arr = list()
arr2 = list()
a = 0
arr = sorted(x)
for i in range(3, n+1):
if arr[i-1] >= (arr[0] + arr[1]):
print(1, 2, i)
a = a + 1
break
if a == 0:
print(-1)
t = t - 1
| 7 | PYTHON3 |
# cook your dish here
for x in range(int(input())):
n=int(input())
a=[int(x) for x in input().split()][:n]
c=a[0]+a[1]
d=0
for x in range(2,n):
if(c<=a[x] and n>=3):
print('1 2',x+1)
d=1
break
if(d==0):
print('-1') | 7 | PYTHON3 |
# cook your dish here
def compute_lcm(num1, num2):
if(num1>num2):
num = num1
den = num2
else:
num = num2
den = num1
rem = num % den
while(rem != 0):
num = den
den = rem
rem = num % den
gcd = den
lcm = int(int(num1 * num2)/int(gcd))
return lcm
t = int(input())
import math
import collections
for i in range(t):
n = int(input())
a = list(map(int,input().split()))
s = a[0]+a[1]
for i in range(2,n):
if s>a[i]:
continue
else:
print(1,2,i+1)
break
else:
print(-1)
| 7 | PYTHON3 |
for _ in range(int(input())):
n = int(input())
x = list(map(int, input().split()))
a = x[0]
b = x[1]
c = x[n-1]
if a+b <= c:
print(1, 2, n)
else:
print(-1)
| 7 | PYTHON3 |
# -*- coding: utf-8 -*-
"""
Created on Fri Aug 14 20:10:59 2020
@author: Utkarsh
"""
n=int(input(''))
a=[]
while n>0:
l=int(input(''))
a=list(map(int, input().split(' ')[:l]))
for i in range(0,l):
if a[i]+a[i+1]<=a[l-i-1]:
print( i+1, i+2,l-i)
break
else:
print(-1)
break
n-=1
| 7 | PYTHON3 |
def sol(inp, n):
sm = []
ind = []
po = 0
for i in range(n):
sm.append(inp[i])
ind.append(i+1)
po += 1
if po==2 and sum(sm) <= inp[-1]:
print(*ind, end=" ")
print(n)
return
if sum(sm)>inp[-1]:
sm = []
ind = []
po = 0
continue
print(-1)
return
if __name__ == '__main__':
for _ in range(int(input())):
n = int(input())
inp = list(map(int, input().split()))
sol(inp, n)
| 7 | PYTHON3 |
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 '+str(n))
else:
print(-1)
| 7 | PYTHON3 |
import sys
from collections import Counter
from math import ceil,gcd,log
from bisect import bisect ,bisect_left,bisect_right
input = sys.stdin.readline
def check(a, b, c):
if (a + b <= c) or (a + c <= b) or (b + c <= a) :
return False
else:
return True
def solve(n,arr):
a = arr[0]
b = arr[1]
p = arr.index(a)
q = arr.index(b)
flag =False
arr = arr[2:]
for j,i in enumerate(arr):
c = i
if (not check(a,b,c)):
ans = (a,b,j)
flag = True
break
else:
continue
if(flag):
if(p==q):
q+=1
print(p+1,q+1,3+ans[-1])
else:
print(-1)
return
def main():
for _ in range(int(input())):
n = int(input())
arr = list(map(int,input().split()))
solve(n,arr)
return
if __name__ == '__main__':
main() | 7 | PYTHON3 |
t = int(input())
#print("out")
for _ in range(t):
n = int(input())
a = list(map(int,input().split()))
i = 0
k = n-1
f = False
while i+1<n and i+1<k:
j = i+1
while j<k and a[i]+a[j]>a[k]:
k-=1
if j<k and (not a[i]+a[j]>a[k]):
print(i+1,j+1,k+1)
break
i+=1
else:
print(-1) | 7 | PYTHON3 |
def solution(arr):
a,b,c = arr[0] , arr[1] ,arr[-1]
if a + b > c :
return -1
return 1
for _ in range(int(input())):
n = int(input())
arr = [int(x) for x in input().split()]
ans = solution(arr)
if ans == -1 :
print(-1)
else:
print(ans,ans+1,len(arr)) | 7 | PYTHON3 |
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
using namespace std;
void test() {
long long n;
cin >> n;
long long a[n];
for (long long i = 0; i < n; i++) cin >> a[i];
if (a[n - 1] >= a[0] + a[1])
cout << 1 << " " << 2 << " " << n << endl;
else
cout << -1 << endl;
}
int main() {
ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
long long t = 1;
cin >> t;
while (t--) {
test();
}
return 0;
}
| 7 | CPP |
for _ in range(int(input())):
n=int(input())
a=list(map(int,input().split()))
for i in range(n-2):
for j in range(i+1,n-1):
for k in range(j+1,n):
if a[i]+a[j]>a[k] and a[i]+a[k]>a[j] and a[j]+a[k]>a[i]:
c=1
continue
else:
c=0
print("{} {} {}".format(i+1,j+1,k+1))
break
break
break
break
if c==1:
print(-1) | 7 | PYTHON3 |
from sys import stdin,stdout
import bisect
n=int(stdin.readline())
for i in range(n):
ans=0
a=int(stdin.readline())
x=[int(i) for i in stdin.readline().split()]
x.sort()
if x[0]+x[1]>x[-1]:
stdout.write('-1'+'\n')
continue
stdout.write(str(1)+' '+str(2)+' '+str(len(x))+'\n')
| 7 | PYTHON3 |
t = int(input())
while t:
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 |
import copy
def get_output(array,length):
max=array[-1]
i=0
while(i!=length-2):
sum=array[i]+array[i+1]
if sum<=max:
return i+1,i+2,length
else:
i+=1
return -1
test_cases=int(input())
for i in range(test_cases):
length=int(input())
array=[int(i) for i in input().split()]
res=get_output(array,length)
if res!=-1:
for i in res:
print(i,end=" ")
print()
else:
print(res)
| 7 | PYTHON3 |
import sys
input = sys.stdin.readline
T = int(input())
for testcase 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 |
def Solution(arr):
if not arr[0] + arr[1] > arr[-1]:
return str(1) + ' ' + str(2) + ' ' + str(len(arr))
else:
return -1
t = int(input())
for _ in range(t):
__ = input()
arr = list(map(int, input().split(' ')))
print(Solution(arr)) | 7 | PYTHON3 |
# fin = open("a.in", "r")
# buf = fin.read()
# fin.close()
import sys
buf = sys.stdin.read()
nowbuf = 0
endbuf = len(buf)
def getint():
global nowbuf
valnow = 0
while buf[nowbuf] < '0' or buf[nowbuf] > '9':
nowbuf += 1
while nowbuf < endbuf and buf[nowbuf] >= '0' and buf[nowbuf] <= '9':
valnow = valnow * 10 + int(buf[nowbuf])
nowbuf += 1
return valnow
def solve(n):
a = []
for i in range(0, n):
a.append(getint())
if a[0] + a[1] <= a[n - 1]:
print("1 2", n)
else:
print("-1")
return
t = getint()
for i in range(0, t):
solve(getint()) | 7 | PYTHON3 |
import sys, math, heapq, collections, itertools, bisect
sys.setrecursionlimit(101000)
def solve(n, a):
l1, l2, l3 = a[0], a[1], a[n-1]
if l1+l2 <= l3:
return 1, 2, n
return None, None, None
t = int(input())
for _ in range(t):
n = int(input())
a = list(map(int, input().split()))
i, j, k = solve(n, a)
if i is None:
print(-1)
else:
print(i, j, k) | 7 | PYTHON3 |
t=int(input())
while(t>0):
n=int(input())
A=list(map(int,input().split()))
if A[0]+A[1]<=A[n-1]:
print(1,2,n)
else:
print(-1)
t-=1 | 7 | PYTHON3 |
#include <bits/stdc++.h>
using namespace std;
struct solution {
int t, n{0};
vector<int> a{};
void get_data() { cin >> t; }
void solve() {
while (t--) {
cin >> n;
a.clear();
a.resize(n);
for (auto &el : a) cin >> el;
auto f = a[0];
auto s = a[1];
bool printed = false;
for (auto i = 2; i < a.size(); ++i) {
if ((f + s) <= a[i]) {
cout << 1 << " " << 2 << " " << i + 1 << "\n";
printed = true;
break;
}
}
if (!printed) cout << "-1\n";
}
}
};
int main() {
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
solution s;
s.get_data();
s.solve();
return 0;
}
| 7 | CPP |
for _ in range(int(input())):
n = int(input())
arr = list(map(int,input().split()))
p = (arr[0]+arr[1]+arr[n-1])/2
if p > arr[0] and p > arr[1] and p > arr[n-1]:
print(-1)
else:
print("1 2",n) | 7 | PYTHON3 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.