solution
stringlengths 11
983k
| difficulty
int64 0
21
| language
stringclasses 2
values |
---|---|---|
t=int(input())
def check(a,b,c):
if c>=b+a:
return True
else:
return False
while t:
t-=1
n=int(input())
a=[int(i) for i in input().split()]
a.sort()
if check(a[0],a[1],a[-1]):
print(1,2,n)
else:
print(-1)
| 7 | PYTHON3 |
cases = int(input())
for i in range(cases):
n = int(input())
line2 = input().split(' ')
arr = []
for a in line2:
arr.append(int(a))
mi = arr[0]
pos = False
for j in range(1,n):
s = mi + arr[j]
if s <= arr[-1]:
print(1, j+1, n)
pos = True
break
if not pos:
print(-1)
| 7 | PYTHON3 |
def main():
test_case = int(input())
for i in range(test_case):
n = int(input())
lst = list(map(int,input().split()))
if(lst[0] + lst[1] <= lst[n-1]):
print("{0} {1} {2}".format(1,2,n))
else:
print("-1")
main()
| 7 | PYTHON3 |
inp = lambda cast=int: [cast(x) for x in input().split()]
printf = lambda s='', *args, **kwargs: print(str(s).format(*args), flush=True, **kwargs)
t, = inp()
for _ in range(t):
n, = inp()
A = inp()
a, b, c = A[0], A[1], A[-1]
if a + b <= c:
print(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,len(a))
else:
print(-1) | 7 | PYTHON3 |
#include <bits/stdc++.h>
using namespace std;
void solve() {
int n;
cin >> n;
vector<int> v(n);
for (int i = 0; i < n; i++) cin >> v[i];
if (v[0] + v[1] <= v.back())
cout << "1 2 " << n << "\n";
else
cout << "-1\n";
}
int32_t main() {
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int tst;
cin >> tst;
while (tst--) {
solve();
}
}
| 7 | CPP |
m=int(input())
for i in range(m):
n=int(input())
a=list(map(int,input().split(' ')))
for j in range(2,len(a)):
if a[j]>=a[0]+a[1]:
print(1 ,2 ,j+1)
break
else:
print(-1)
| 7 | PYTHON3 |
import sys
read = lambda: sys.stdin.readline().strip()
for _ in range(int(read())):
length = int(read())
nums = list(map(int, read().split()))
end = length - 1
start = 0
mid = start + 1
a = nums[start]
b = nums[mid]
c = nums[end]
# print("Ans", end=" ")
if a + b <= c:
print(start+1, mid+1, end+1)
else:
print(-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,n)
else:
print(-1) | 7 | PYTHON3 |
t=int(input())
for _ in range(t):
n=int(input())
a=list(map(int,input().split()))
sum1=a[0]+a[1]
found=0
for i in range(2,n):
if sum1<=a[i]:
found=1
break
if found!=1:
print("-1")
else:
print(1,2,i+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 {}".format(n))
else:
print(-1) | 7 | PYTHON3 |
import sys
t=int(sys.stdin.readline())
for _ in range(t):
n=int(sys.stdin.readline())
a=list(map(int,(sys.stdin.readline()).split()))
counter=0
for i in range(n-1):
su=a[i]+a[i+1]
if su <=a[n-1]:
print('{} {} {}'.format(i+1,i+2,n))
counter=1
break
if counter==0:
print(-1)
| 7 | PYTHON3 |
t = int(input())
for z in range(t):
n = int(input())
li = list(map(int,input().split()))
first = li[0]+li[1]
last = max(li)
if last>=first:
print(1,2,n)
else:
print(-1) | 7 | PYTHON3 |
for _ in range(int(input())):
n = int(input())
arr = list(map(int,input().split()))
notexist = False
for i in range(2,len(arr)):
if arr[0] + arr[1] <= arr[i]:
n = i + 1
notexist = True
break
if notexist:
print(1,2,n)
else:
print(-1)
| 7 | PYTHON3 |
for i in range(int(input())):
n=int(input())
x=list(map(int,input().split()))
if x[0]+x[1]>x[-1]:
print(-1)
else:
print(1,2,n)
| 7 | PYTHON3 |
t = int(input())
while(t):
n = int(input())
l = [int(i) for i in input().split()]
for i in range(n):
for j in range(1,n):
for k in range(2,n):
if((l[i] + l[j]) > l[k]):
pass
else:
print(i+1,j+1,k+1)
break
else:
print(-1)
break
break
break
t-=1
| 7 | PYTHON3 |
# This is a sample Python script.
# Press ⌃R to execute it or replace it with your code.
# Press Double ⇧ to search everywhere for classes, files, tool windows, actions, and settings.
def check(arrayList):
result = "-1"
if arrayList[0] + arrayList[1] <= arrayList[len(arrayList)-1]:
last_index = str(len(arrayList))
result = "1 2 "
result = result + last_index
print(result)
# Press the green button in the gutter to run the script.
if __name__ == '__main__':
# print_hi('PyCharm')
t = int(input())
for i in range(0, t):
n = int(input())
lists = list(int(num) for num in input().strip().split())[:n]
check(lists)
# See PyCharm help at https://www.jetbrains.com/help/pycharm/
| 7 | PYTHON3 |
t = int(input())
for _ in range(t):
n = int(input())
l = [int(x) for x in input().split()]
if l[0]+l[1]<=l[-1]:
print(1,2,n)
else:
print(-1) | 7 | PYTHON3 |
t = int(input())
while t:
n, v = int(input()), list(map(int, input().split()))
print("1 2 " + str(n) if v[0]+v[1] <= v[n-1] else -1)
t -= 1 | 7 | PYTHON3 |
import sys
# sys.stdin = open("input.txt")
def main():
tn = int(sys.stdin.readline())
r = None
for ti in range(tn):
n = int(sys.stdin.readline())
A = [int(a) for a in sys.stdin.readline().split()]
if A[0] + A[1] <= A[-1]:
print(f"1 2 {n}")
else:
print("-1")
if __name__ == "__main__":
main()
| 7 | PYTHON3 |
t=int(input())
while (t>0):
t=t-1
n=int(input())
a=list(map(int,input().split()))
c=a[0]+a[1]
d=0
for i in range(2,len(a)):
if (c<=a[i]):
d=i+1
break
if (d!=0):
print(1,2,d)
else:
print(-1) | 7 | PYTHON3 |
t=int(input())
for _ in range(t):
n=int(input())
a=list(map(int,input().split()))
for i in range(n):
for j in range(i+1,n):
if a[i] + a[j] <= a[-1]:
print(i+1,j+1,n)
break
else:
print('-1')
break
break | 7 | PYTHON3 |
t = int(input())
for i in range(t):
n = int(input())
l = list(map(int,input().split()))
ans = []
flag = 0
for j in range(2,n):
if(l[0]+l[1]<=l[j]):
flag = 1
ans = [1,2,j+1]
break
if(flag==1):
print(*ans)
else:
print(-1)
| 7 | PYTHON3 |
t = int(input())
for case in range(t):
n = int(input())
a = list(map(int, input().split()))
minNum = 1000000000
minInd = -1
maxNum = 0
maxInd = -1
for i in range(n):
num = a[i]
if num < minNum:
minInd = i
minNum = num
if num > maxNum:
maxInd = i
maxNum = num
secondMin = 1000000000
secondInd = -1
for i in range(n):
num = a[i]
if num < secondMin:
if i != minInd and i != maxInd:
secondMin = num
secondInd = i
if minNum + secondMin <= maxNum:
b = [minInd, secondInd, maxInd]
b.remove(min(minInd, secondInd, maxInd))
b.remove(max(minInd, secondInd, maxInd))
middle = b[0]
print(str(min(minInd, secondInd, maxInd) + 1) + " " + str(middle + 1) + " " + str(max(minInd, secondInd, maxInd) + 1))
else:
print(-1)
| 7 | PYTHON3 |
def badTriangle(arr):
if arr[0] + arr[1] in arr:
print(*[1,2, arr.index(arr[0]+arr[1])+1])
elif arr[0] + arr[1] <= arr[-1]:
print(*[1,2,len(arr)])
else:
print(-1)
tc = int(input())
for i in range(tc):
n = int(input())
a = list(map(int, input().split()))
badTriangle(a) | 7 | PYTHON3 |
def solve():
n = int(input())
l = [int(x) for x in input().split()]
for i in range(2, n):
if l[0]+l[1] <= l[i]:
print(1,2,i+1)
break
else:
print(-1)
for _ in range(int(input())):
solve() | 7 | PYTHON3 |
#!/usr/bin/env python3
def main():
for _ in range(int(input())):
n = int(input())
a = sorted(map(int, input().split()))
if a[0] + a[1] <= a[-1]:
print(1, 2, n)
else:
print(-1)
if __name__ == "__main__":
main()
| 7 | PYTHON3 |
t = int(input())
for _ in range(t):
n = int(input())
a = list(map(int, input().split()))
done = 0
if (a[0] + a[1] <= a[-1]):
print(1, 2, n)
else:
print(-1) | 7 | PYTHON3 |
t = int(input())
for i in range(t):
n = int(input())
arr = input()
arr = arr.strip()
arr = arr.split(' ')
arr = list(map(int, arr))
a = arr[0]
b = arr[1]
c = arr[n-1]
if c >= a+b :
print(1, 2, n)
else:
print(-1)
| 7 | PYTHON3 |
def solve(arr):
n = len(arr)
if arr[0] + arr[1] <= arr[-1]:
return [1, 2, n]
return -1
t = int(input())
while t:
n = int(input())
arr = list(map(int, input().split()))
res = (solve(arr))
if res == -1:
print(-1)
else:
print(" ".join(list(map(str,res))))
t -= 1 | 7 | PYTHON3 |
for t in range(int(input())):
n=int(input())
num=list(map(int,input().split()))
if num[-1]<num[0]+num[1]:
print(-1)
else:
print(1,2,n) | 7 | PYTHON3 |
t = int(input())
for _ in range(t):
n = int(input())
a = sorted([int(x) for x in input().split()])
if a[0]+a[1]>a[-1]:
print(-1)
else:
print(1,2,len(a)) | 7 | PYTHON3 |
t = int(input())
def doit(t):
s = int(input())
a = input()
na = list(map(int, a.split()))
if na[0] + na[1] > na[s-1]:
print(-1)
else:
print("1 2", s)
while t:
t -= 1
doit(t) | 7 | PYTHON3 |
def algo(a, N):
if a[0]+a[1]<=a[-1]:
s="1"+" "+"2"+" "+str(n)
return s
return -1
for _ in range(int(input())):
n=int(input())
a=list(map(int,input().split()))
print(algo(a,n)) | 7 | PYTHON3 |
for i in range(int(input())):
s = input()
x = list(map(int, input().split()))
if x[0] + x[1] <= x[-1]:
print(1, 2, len(x), sep=" ")
else:
print(-1) | 7 | PYTHON3 |
t = int(input())
for _ in range(t):
n = int(input())
a = [int(ele) for ele in input().split()]
if (a[0] + a[1]) <= a[-1]:
print(1, 2, n, end = " ")
print("")
else:
print(-1) | 7 | PYTHON3 |
for _ in range(int(input())):
n = int(input())
arr =[int(c) for c in input().split()]
if arr[0] + arr[1] <= arr[-1] :
print(1,2,n)
else:
print(-1) | 7 | PYTHON3 |
for _ in range(int(input())):
n=int(input())
a=list(map(int,input().split()))
if a[0]+a[1]<=a[-1]:
print(f"1 2 {n}")
else:
print(-1) | 7 | PYTHON3 |
for _ in range(int(input())):
n = int(input())
a = [int(i) for i in input().split()]
ans = [-1]
a.sort()
if a[0] + a[1] <= a[n-1]:
ans = [1,2,n]
print(*ans) | 7 | PYTHON3 |
#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5;
int main() {
int t;
scanf("%d", &t);
;
while (t--) {
int n;
scanf("%d", &n);
;
long long arr[n];
for (int i = 0; i < n; i++) scanf("%lld", &arr[i]);
;
if (arr[0] + arr[1] <= arr[n - 1]) {
cout << 1 << " " << 2 << " " << n << "\n";
} else {
cout << -1 << "\n";
}
}
}
| 7 | CPP |
for t in range(int(input())):
n = int(input())
a = list(map(int, input().split()))
if a[-1] >= a[0] + a[1]:
print(1, 2, len(a))
else:
print(-1)
| 7 | PYTHON3 |
t = int(input())
flag = bool(False)
for q in range(t):
a = []
flag = False
c = int(input())
a = list(map(int, input().split()))
for e in range (1, c-1):
if (a[0] + a[e] <= a[c-1]):
flag = True
break
if (flag == True):
print (1, e+1, c)
else:
print(-1)
| 7 | PYTHON3 |
t=int(input())
for i in range(t):
n=int(input())
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())
a = list(map(int, input().split()))
v = a[0] + a[1]
ans = 0
for i in range(2,n):
if a[i] >= v:
ans = i
break
if ans:
print(1,2,ans+1)
else:
print(-1)
| 7 | PYTHON3 |
#include <bits/stdc++.h>
using namespace std;
int t;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
cin >> t;
while (t--) {
int n, fir, sec, last;
cin >> n;
for (int i = 1; i <= n; i++) {
int x;
cin >> x;
if (i == 1) fir = x;
if (i == 2) sec = x;
if (i == n) last = x;
}
if (last >= fir + sec)
cout << 1 << ' ' << 2 << ' ' << n << "\n";
else
cout << "-1\n";
}
}
| 7 | CPP |
from collections import defaultdict
t=int(input())
while(t>0):
t-=1
n=int(input())
a=[int(j) for j in input().split()]
if(a[0]+a[1]<=a[-1]):
print("1 2",end=" ")
print(len(a))
else:
print(-1)
| 7 | PYTHON3 |
import sys
t=int(input())
while t>0:
n=int(input())
a=[int(x) for x in input().split()]
s=a[0]+a[1]
c=0
for i in range(2,n):
if(a[i]>=s):
print(1,2,i+1)
c+=1
break
if(c==0):
print(-1)
t-=1
| 7 | PYTHON3 |
#include <bits/stdc++.h>
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
int t;
cin >> t;
while (t--) {
int n;
cin >> n;
vector<int> a(n);
for (int i = 0; i < n; i++) cin >> a[i];
int f = -1;
for (int i = 2; i < n; i++) {
if (a[i] >= a[0] + a[1]) {
f = i;
break;
}
}
if (f == -1) {
cout << -1 << '\n';
} else {
cout << 1 << ' ' << 2 << ' ' << (f + 1) << '\n';
}
}
}
| 7 | CPP |
MOD = 1000000007
ii = lambda : int(input())
si = lambda : input()
dgl = lambda : list(map(int, input()))
f = lambda : map(int, input().split())
il = lambda : list(map(int, input().split()))
ls = lambda : list(input())
from collections import Counter
for _ in range(ii()):
n=ii()
a=il()
if(a[0]+a[1]>a[n-1]):
print(-1)
else:
print(1,2,n)
| 7 | PYTHON3 |
import sys
import os.path # =========================================================================
if(os.path.exists('in.txt')):
sys.stdin = open("in.txt", "r")
sys.stdout = open("out.txt", "w")
# =============================================================================================
for _ in range(int(input())):
n = int(input())
li = list(map(int, input().split()))
l = sorted(li)
if(l[0] + l[1] > l[-1]):
print(-1)
else:
print(1, 2, n)
| 7 | PYTHON3 |
for _ in range(int(input())):
n=int(input())
a=list(map(int,input().split()))
if a[0]+a[1]>a[-1]:
print(-1)
else:
print(1,2,len(a)) | 7 | PYTHON3 |
import math as mt
def tran(n,arr):
if arr[0]+arr[1]>arr[-1]:
return [-1]
else:
return [1,2,n]
if __name__ == '__main__':
t = int(input())
ans = []
for i in range(t):
n=int(input())
arr = list(map(int, input().rstrip().split()))
r = tran(n,arr)
ans.append(r)
for i in ans:
print(*i)
| 7 | PYTHON3 |
# bad_triangle.py
for _ in range(int(input())):
n = int(input())
a = list(map(int,input().split()))
sm = a[0]+a[1]
ok = True
for i in range(n-1,1,-1):
if a[i]>=sm:
print(1,2,i+1)
ok = False
break
if ok:
print('-1') | 7 | PYTHON3 |
for i in range(int(input())):
n=int(input())
l=[int(x) for x in input().split()]
count=0
if l[0]+l[1]<=l[n-1]:
print(*[1,2,n])
else:
print(-1)
| 7 | PYTHON3 |
test_cases = int(input())
for _ in range(test_cases):
n = int(input())
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 |
#code By Abhishek
def solve(arr,n):
for i in range(2,n):
if arr[0] + arr[1]<=arr[i]:
print(1,2,i+1)
return
print(-1)
return
for _ in range(int(input())):
n=int(input())
arr=list(map(int,input().split()))
solve(arr,n) | 7 | PYTHON3 |
#include <bits/stdc++.h>
using namespace std;
void solve() {
long long int n;
cin >> n;
long long int a[n];
long long int i;
for (long long 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';
}
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
;
long long int t = 1;
cin >> t;
while (t--) solve();
return 0;
}
| 7 | CPP |
#include <bits/stdc++.h>
using namespace std;
const long long INF = 2e15;
const long long MB = 20;
const long long MOD = 1e9 + 7;
void solve() {
long long n;
cin >> n;
vector<long long> a(n);
for (long long i = 0; i < n; i++) {
cin >> a[i];
}
if (a.back() >= a[0] + a[1]) {
cout << "1 2 " << n << '\n';
return;
}
cout << "-1\n";
}
signed main() {
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
cout << fixed;
cout.precision(12);
srand(time(0));
long long t;
cin >> t;
while (t--) solve();
}
| 7 | CPP |
n=int(input())
for i in range(n):
t=int(input())
c=list(map(int,input().split()))
g=c[0]+c[1]
h=0
for j in range(2,t):
if(g<=c[j]):
h=j
break
if(h!=0):
print(1,end=" ")
print(2,end=" ")
print(h+1,end=" ")
print()
else:
print(-1) | 7 | PYTHON3 |
for _ in range(int(input())):
n = int(input())
arr = list(map(int,input().split()))
print(*[[1,2,n],[-1]][arr[0]+arr[1]>arr[n-1]])
| 7 | PYTHON3 |
def resolve():
N = int(input())
for _ in range(N):
length_of_array = int(input())
A = [int(x) for x in input().split(" ")]
isFound = False
for i in range(length_of_array - 2):
if A[i] + A[i+1] <= A[length_of_array-1]:
isFound = True
print(i+1, i+2, length_of_array)
break
if not isFound:
print(-1)
if __name__ == "__main__":
resolve() | 7 | PYTHON3 |
t=int(input())
for i in range(t) :
n=int(input())
a=list(map(int,input().split()))
if a[n-1]>=a[0]+a[1] :
print(1,2,n)
else :
print(-1)
| 7 | PYTHON3 |
t=int(input())
for _ in range(t):
n=int(input())
ls=list(map(int,input().split()))
s=ls[0]+ls[1]
if ls[-1]<s:
print(-1)
else:
print('{} {} {}'.format(1,2,n)) | 7 | PYTHON3 |
t = int(input())
while t>0:
n = int(input())
a = input().split(" ")
i, j, k = 0, 1, n-1
if int(a[i])+int(a[j])<=int(a[k]) or int(a[j])+int(a[k])<=int(a[i]) or int(a[i])+int(a[k])<=int(a[j]):
print(i+1, j+1, k+1)
else:
print(-1)
t-=1 | 7 | PYTHON3 |
t=int(input())
l=[]
for i in range(0,t):
n=int(input())
s=input()
l=s.split()
if int(l[0])+int(l[1])>int(l[-1]):
print(-1)
else:
print(1,2,n)
| 7 | PYTHON3 |
from sys import stdin
t = int(input())
for _ in range(t):
n = int(input())
a = list(map(int,input().split()))
if a[0] + a[1] <= a[n-1]:
print(1,2,n)
else:
print(-1) | 7 | PYTHON3 |
t=int(input())
for i in range(0,t):
m=int(input())
arr1=list(map(int,input().strip().split()))[:m]
l1=[]
ct=0
for i in range(0,m-2):
if(arr1[i]+arr1[i+1]<=arr1[-1]):
l1.append(i+1)
l1.append(i+2)
l1.append(m)
print(*l1,sep=" ")
ct+=1
break
if(ct==0):
print("-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())
vals = [int(x) for x in input().split()]
if vals[0] + vals[1] <= vals[-1]:
print(1, 2, n)
else:
print(-1) | 7 | PYTHON3 |
# https://codeforces.com/problemset/problem/1398/A
for _ in range(int(input())):
n = input()
lengths = tuple(map(int, input().split()))
if lengths[0] + lengths[1] > lengths[-1]:
print(-1)
else:
print(1, 2, n) | 7 | PYTHON3 |
t = int(input())
for i in range(t):
n = int(input())
a = list(map(int, input().split()))
if a[n-1] >= (a[0]+a[1]):
print(" 1 2", n)
else:
print("-1") | 7 | PYTHON3 |
for ctr 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 asdasd in range(t):
n = int(input())
a = [int(x) for x in input().split()]
p = a[0]
q = a[1]
r = a[n-1]
if(p+q <= r):
print(1,2,n)
else:
print("-1")
| 7 | PYTHON3 |
#include <bits/stdc++.h>
using namespace std;
long long max(long long a, long long b) {
if (a > b)
return a;
else
return b;
}
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
long long t;
cin >> t;
while (t--) {
long long n;
cin >> n;
vector<long long> v(n);
for (long long i = 0; i < n; i++) cin >> v[i];
sort(v.begin(), v.end());
if (n < 3) {
cout << -1 << "\n";
continue;
}
long long mn1 = v[0];
long long mn2 = v[1];
long long mx = v[n - 1];
if (mn1 + mn2 > mx)
cout << -1 << "\n";
else
cout << 1 << " " << 2 << " " << n << "\n";
}
return 0;
}
| 7 | CPP |
x=int(input())
for z in range(x):
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>
using namespace std;
const int N = 100007;
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
int t = 1;
cin >> t;
while (t--) {
int n;
cin >> n;
int a[n];
for (int i = 0; i < n; i++) {
cin >> a[i];
}
int ind;
bool found = false;
if (a[0] + a[1] <= a[n - 1]) found = true;
if (found) {
cout << 1 << " " << 2 << " " << n << "\n";
} else
cout << "-1\n";
}
return 0;
}
| 7 | CPP |
T = int(input())
for test in range(T):
n = int(input())
a = [int(x) for x in input().split()]
if a[0] + a[1] <= a[-1]:
print("1 2 {}".format(n))
else: print(-1) | 7 | PYTHON3 |
"""
pppppppppppppppppppp
ppppp ppppppppppppppppppp
ppppppp ppppppppppppppppppppp
pppppppp pppppppppppppppppppppp
pppppppppppppppppppppppppppppppp
pppppppppppppppppppppppp
ppppppppppppppppppppppppppppppppppppppppppppppp pppppppppppppppppppp
pppppppppppppppppppppppppppppppppppppppppppppppp ppppppppppppppppppppp
ppppppppppppppppppppppppppppppppppppppppppppppppp pppppppppppppppppppppp
ppppppppppppppppppppppppppppppppppppppppppppppp pppppppppppppppppppppppp
pppppppppppppppppppppppppppppppppppppppppppppp pppppppppppppppppppppppppp
ppppppppppppppppppppppppppppppppppppppppppppp pppppppppppppppppppppppppppp
pppppppppppppppppppppppppppppppp pppppppppppppppppppppppppppppppp
pppppppppppppppppppppppppppp pppppppppppppppppppppppppppppppppppppppppppppp
ppppppppppppppppppppppppppp pppppppppppppppppppppppppppppppppppppppppppppppp
pppppppppppppppppppppppp pppppppppppppppppppppppppppppppppppppppppppppppppp
ppppppppppppppppppppppp ppppppppppppppppppppppppppppppppppppppppppppppppp
pppppppppppppppppppppp ppppppppppppppppppppppppppppppppppppppppppppppp
ppppppppppppppppppppp ppppppppppppppppppppppppppppppppppppppppppppp
pppppppppppppppppppppppp
pppppppppppppppppppppppppppppppp
pppppppppppppppppppppp pppppppp
ppppppppppppppppppppp ppppppp
ppppppppppppppppppp ppppp
pppppppppppppppppppp
"""
import sys
from functools import lru_cache, cmp_to_key
from heapq import merge, heapify, heappop, heappush, nsmallest
from math import ceil, floor, gcd, fabs, factorial, fmod, sqrt, inf
from collections import defaultdict as dd, deque, Counter as C
from itertools import combinations as comb, permutations as perm
from bisect import bisect_left as bl, bisect_right as br, bisect
from time import perf_counter
from fractions import Fraction
from decimal import Decimal
# sys.setrecursionlimit(2 * (10 ** 5))
# sys.stdin = open("input.txt", "r")
# sys.stdout = open("output.txt", "w")
mod = pow(10, 9) + 7
mod2 = 998244353
def data(): return sys.stdin.readline().strip()
def out(var): sys.stdout.write(str(var)+"\n")
def outa(*var, end="\n"): sys.stdout.write(' '.join(map(str, var)) + end)
def l(): return list(sp())
def sl(): return list(ssp())
def sp(): return map(int, data().split())
def ssp(): return map(str, data().split())
def l1d(n, val=0): return [val for i in range(n)]
def l2d(n, m, val=0): return [l1d(n, val) for j in range(m)]
for _ in range(int(data())):
n = int(data())
arr = l()
if arr[0] + arr[1] <= arr[-1]:
outa(1, 2, n)
continue
out(-1)
| 7 | PYTHON3 |
t=int(input())
for _ in range(t):
n=int(input())
l=list(map(int,input().split()))
f=0
for i in range(2,n):
if l[0]+l[1]<=l[i]:
f=1
print(1,2,i+1)
break
if f==0:
print(-1) | 7 | PYTHON3 |
for _ in range(int(input())):
n=int(input())
k=list(map(int,input().split()))
if k[0]+k[1]<=k[n-1]:
print(1,2,n)
else:
print(-1)
| 7 | PYTHON3 |
import bisect
t = int(input())
ans = []
for _ in range(t):
n = int(input())
A = list(map(int, input().split()))
i = 0
j = 1
check_index = bisect.bisect_left(A, A[i] + A[j])
if check_index >= n:
ans.append([-1])
else:
k = check_index
ans.append([i+1, j+1, k+1])
for a in ans:
print(*a) | 7 | PYTHON3 |
t = int(input())
for te in range(t):
n = int(input())
a = [int(x) for x in input().split()]
a.sort()
if (a[0] + a[1] <= a[n - 1]):
print(1, 2, n)
else:
print(-1)
| 7 | PYTHON3 |
from collections import defaultdict as dd
import math
import sys
import string
input=sys.stdin.readline
def nn():
return int(input())
def li():
return list(input())
def mi():
return map(int, input().split())
def lm():
return list(map(int, input().split()))
def solve():
n = nn()
lens = lm()
if lens[0]+lens[1]<=lens[n-1]:
print(1,2,n)
return
print(-1)
return
q=nn()
for _ in range(q):
solve()
| 7 | PYTHON3 |
import sys
input = sys.stdin.readline
for nt 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 |
from math import *
from collections import deque
from copy import deepcopy
import sys
def inp(): return sys.stdin.readline().rstrip("\r\n") #for fast input
def multi(): return map(int,input().split())
def strmulti(): return map(str, inp().split())
def lis(): return list(map(int, inp().split()))
def lcm(a,b): return (a*b)//gcd(a,b)
def ncr(n,r): return factorial(n) // (factorial(r) * factorial(max(n - r, 1)))
def stringlis(): return list(map(str, inp().split()))
def out(var): sys.stdout.write(str(var)) #for fast output, always take string
def printlist(a) :
print(' '.join(str(a[i]) for i in range(len(a))))
def isPrime(n) :
if (n <= 1) : return False
if (n <= 3) : return True
if (n % 2 == 0 or n % 3 == 0) : return False
i = 5
while(i * i <= n) :
if (n % i == 0 or n % (i + 2) == 0) :
return False
i = i + 6
return True
#copied functions end
#start coding
t=int(inp())
for _ in range(t):
n=int(input())
a=lis()
if(a[0]+a[1]>a[-1]):
print(-1)
continue
print(1,2,n)
| 7 | PYTHON3 |
#include <bits/stdc++.h>
using namespace std;
int main() {
int t;
cin >> t;
for (int i = 0; i < t; i++) {
long long int n;
cin >> n;
long long int a[n];
for (long long 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;
}
}
| 7 | CPP |
import math
def dtb(n):
return bin(n).replace("0b","")
def btd(n):
return int(n,2)
t=int(input())
for k in range(t):
n=int(input())
a=list(map(int,input().split()))[:n]
x,z=0,n-1
flag=0
for i in range(1,n-1):
if(a[i]+a[x]<=a[z] or a[i]+a[z]<=a[x] or a[x]+a[z]<=a[i]):
print(x+1,i+1,z+1)
flag=1
break
if flag==0:
print(-1)
| 7 | PYTHON3 |
try:
for _ in range(int(input())):
a=int(input())
b=list(map(int,input().split()))
i=0
k=a-1
flag=True
j=a-2
while flag and i<j and j<k:
temp=b[k]-b[i]
if b[j]<=temp:
print(i+1,j+1,k+1)
flag=False
else:
j-=1
if flag:
print(-1)
except Exception as e:
print(e) | 7 | PYTHON3 |
#include <bits/stdc++.h>
using namespace std;
const long double EPS = 1e-10;
const long long INF = 1e18;
const long double PI = acos(-1.0L);
long long gcd(long long a, long long b) {
if (b == 0) {
return a;
}
return gcd(b, a % b);
}
int main() {
int cnt = 1;
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";
}
}
return 0;
}
| 7 | CPP |
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,len(a))
else:
print(-1) | 7 | PYTHON3 |
t = int(input())
r = ""
for i in range(t):
n = int(input())
a = []
a = input().split()
if int(a[0]) + int(a[1]) <= int(a[len(a) - 1]):
r += "1 2 " + str(len(a)) + "\n"
else:
r += "-1\n"
"""
for j in range(n):
b = int(a[j])
for j in range(n):
for k in range(n):
for z in range(n):
if (j != k) and (k != z) and (b[j] + b[k] <= b[z]):
r += str(i) + " " + str(j) + " " + str(k) + "\n"
break
"""
print(r) | 7 | PYTHON3 |
tests = int(input())
for test in range(tests):
num = int(input())
nums = list(map(int, input().split()))
if nums[0] + nums[1] <= nums[-1]:
print(1, 2, num)
else:
print(-1)
| 7 | PYTHON3 |
import sys
def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(N=None): return list(MAP()) if N is None else [INT() for i in range(N)]
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
INF = 10 ** 19
MOD = 10 ** 9 + 7
for _ in range(INT()):
N = INT()
A = LIST()
a, b, c = A[0], A[1], A[-1]
if a+b <= c:
print(1, 2, N)
else:
print(-1)
| 7 | PYTHON3 |
import sys
import random
from fractions import Fraction
from math import *
def input():
return sys.stdin.readline().strip()
def iinput():
return int(input())
def finput():
return float(input())
def tinput():
return input().split()
def linput():
return list(input())
def rinput():
return map(int, tinput())
def fiinput():
return map(float, tinput())
def flinput():
return list(fiinput())
def rlinput():
return list(map(int, input().split()))
def trinput():
return tuple(rinput())
def srlinput():
return sorted(list(map(int, input().split())))
def NOYES(fl):
if fl:
print("NO")
else:
print("YES")
def YESNO(fl):
if fl:
print("YES")
else:
print("NO")
def main():
n = iinput()
q = rlinput()
m2 = q.index(max(q))
mm2 = max(q)
m = q.index(min(q))
mm1 = min(q)
del q[m]
m1 = q.index(min(q))
if m1 >= m:
m1 += 1
q.sort()
if mm1 + min(q) <= mm2:
print(*sorted([m + 1, m1 + 1, m2 + 1]))
else:
print(-1)
for TESTING in range(iinput()):
main()
| 7 | PYTHON3 |
#include <bits/stdc++.h>
using namespace std;
int main() {
int t, n, flag, j;
cin >> t;
int arr1[t];
for (int i = 0; i < t; i++) {
cin >> n;
int arr[n];
for (j = 0; j < n; j++) {
cin >> arr[j];
}
flag = 0;
for (j = 2; j < n; j++) {
if (arr[j] >= arr[0] + arr[1]) {
flag = 1;
break;
}
}
if (flag == 1)
arr1[i] = j + 1;
else
arr1[i] = -1;
}
for (int i = 0; i < t; i++) {
if (arr1[i] != -1)
cout << "1 2"
<< " " << arr1[i] << endl;
else
cout << "-1" << endl;
}
}
| 7 | CPP |
for i in range(int(input())):
n=int(input())
arr=list(map(int,input().split()))
flag=0
for i in range(len(arr)-1):
for j in range(i+1,len(arr)-1):
if arr[i]+arr[j]<=arr[len(arr)-1]:
flag=1
print(i+1,j+1,len(arr))
m=len(arr)
arr.remove(arr[m-1])
break
break
if flag==0:
print(-1) | 7 | PYTHON3 |
def sieve():
n=10**5
s=[[] for i in range(n+1)]
for i in range(2,n+1,2):
s[i]=[2]
for i in range(3,n+1,2):
if(s[i]):
continue
else:
for j in range(i,n+1,i):
s[j].append(i)
return s
def prime():
n=10**5
s=[1 for i in range(n+1)]
for i in range(2,n+1):
if(s[i]==1):
for j in range(i*i,i<n+1,i):
s[j]=0
primes=[]
for i in range(2,n+1):
if(s[i]==1):
primes.append(i)
return primes
for cases in range(int(input())):
n=int(input())
l=list(map(int,input().split()))
a=l[0]
b=l[1]
c=l[-1]
if(c<a+b):
print(-1)
else:
print(1,2,len(l))
| 7 | PYTHON3 |
for xyz in range(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 |
#include <bits/stdc++.h>
using namespace std;
int main() {
int t, n, i;
scanf("%d", &t);
while (t--) {
scanf("%d", &n);
vector<int> a(n);
for (i = 0; i < n; i++) scanf("%d", &a[i]);
if (a[0] + a[1] <= a[n - 1])
printf("1 2 %d\n", n);
else
printf("-1\n");
}
return 0;
}
| 7 | CPP |
#include <bits/stdc++.h>
using namespace std;
void solve() {
long long int n;
cin >> n;
vector<long long int> arr;
set<long long int> s;
for (int i = 0; i < n; i++) {
long long int val;
cin >> val;
arr.push_back(val);
}
bool temp = false;
long long int sum = arr[0] + arr[1];
for (int i = 2; i < n; i++) {
if (sum <= arr[i]) {
temp = true;
cout << 1 << " " << 2 << " " << i + 1 << '\n';
break;
}
}
if (!temp) {
cout << -1 << '\n';
}
}
int main() {
int t;
cin >> t;
while (t--) {
solve();
}
}
| 7 | CPP |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.