solution
stringlengths 11
983k
| difficulty
int64 0
21
| language
stringclasses 2
values |
---|---|---|
def main():
for _ in range(int(input())):
s = int(input())
l = [int(i) for i in input().split()]
if l[0] + l[1] > l[-1]:
print(-1)
else:
print(1,2, s)
main()
# | 7 | PYTHON3 |
t=int(input())
for i in range (t):
n=int(input())
arr=list(map(int,input().split()))
flag=0
for j in range(n-2) :
if flag==1:
break
for k in range (n-1,j+1,-1):
if arr[k] >= arr[j]+arr[j+1]:
print (j+1,j+2,k+1)
flag=1
break
if arr[k]< arr[j]+arr[j+1]:
break
if flag ==0:
print(-1) | 7 | PYTHON3 |
#include <bits/stdc++.h>
using namespace std;
inline int Int() {
int x;
cin >> x;
return x;
}
inline long long Long() {
long long x;
cin >> x;
return x;
}
inline float Float() {
float x;
cin >> x;
return x;
}
inline double Double() {
double x;
cin >> x;
return x;
}
inline void Yes() { cout << "Yes" << endl; }
inline void No() { cout << "No" << endl; }
inline void YES() { cout << "YES" << endl; }
inline void NO() { cout << "NO" << endl; }
const int N = (int)2e5 + 5;
const int maxN = (int)1e6 + 6;
const long long Mod = (long long)1e9 + 7;
const int inf = (int)2e9;
const long long Inf = (long long)1e18;
int main() {
ios_base::sync_with_stdio(false), cin.tie(NULL);
int t, q;
cin >> t;
for (q = 1; q <= t; q++) {
long long n, i, x, c = 0, c1 = 1, c2 = 1, c3 = 1;
cin >> n;
long long a[n], b[n];
for (int i = 0; i < n; i++) {
cin >> a[i];
b[i] = a[i];
}
sort(b, b + n);
for (i = n - 1; i >= 2; i--) {
if (b[0] + b[1] <= b[i]) {
x = b[i];
c = 1;
break;
}
}
if (c) {
vector<long long> v;
for (i = 0; i < n; i++) {
if (v.size() == 3) break;
if (b[0] == a[i] and c1) {
v.push_back(i + 1);
c1 = 0;
} else if (b[1] == a[i] and c2) {
v.push_back(i + 1);
c2 = 0;
} else if (x == a[i] and c3) {
v.push_back(i + 1);
c3 = 0;
}
}
sort(v.begin(), v.end());
for (i = 0; i < 3; i++) cout << v[i] << " ";
cout << endl;
} else
cout << -1 << endl;
}
return 0;
}
| 7 | CPP |
'''
___ ___ ___ ___ ___ ___
/\__\ /\ \ _____ /\ \ /\ \ /\ \ /\__\
/:/ _/_ \:\ \ /::\ \ \:\ \ ___ /::\ \ |::\ \ ___ /:/ _/_
/:/ /\ \ \:\ \ /:/\:\ \ \:\ \ /\__\ /:/\:\__\ |:|:\ \ /\__\ /:/ /\ \
/:/ /::\ \ ___ \:\ \ /:/ \:\__\ ___ /::\ \ /:/__/ /:/ /:/ / __|:|\:\ \ /:/ / /:/ /::\ \
/:/_/:/\:\__\ /\ \ \:\__\ /:/__/ \:|__| /\ /:/\:\__\ /::\ \ /:/_/:/__/___ /::::|_\:\__\ /:/__/ /:/_/:/\:\__\
\:\/:/ /:/ / \:\ \ /:/ / \:\ \ /:/ / \:\/:/ \/__/ \/\:\ \__ \:\/:::::/ / \:\~~\ \/__/ /::\ \ \:\/:/ /:/ /
\::/ /:/ / \:\ /:/ / \:\ /:/ / \::/__/ ~~\:\/\__\ \::/~~/~~~~ \:\ \ /:/\:\ \ \::/ /:/ /
\/_/:/ / \:\/:/ / \:\/:/ / \:\ \ \::/ / \:\~~\ \:\ \ \/__\:\ \ \/_/:/ /
/:/ / \::/ / \::/ / \:\__\ /:/ / \:\__\ \:\__\ \:\__\ /:/ /
\/__/ \/__/ \/__/ \/__/ \/__/ \/__/ \/__/ \/__/ \/__/
'''
"""
βββββββββββββββββββ
ββββββββββββββββββββ
ββββββββββββββββββββ
ββββββββββββββββββββ
ββββββββββββββββββββ
ββββββββββββββββββββ
ββββββββββββββββββββ
ββββββββββββββββββββ
ββββββββββββββββββββ
ββββββββββββββββββββ
ββββββββββββββββββββ
ββββββββββββββββββββ
ββββββββββββββββββββ
"""
import sys
import math
import collections
import operator as op
from collections import deque
from math import gcd, inf, sqrt, pi, cos, sin, ceil, log2
from bisect import bisect_right, bisect_left
# sys.stdin = open('input.txt', 'r')
# sys.stdout = open('output.txt', 'w')
from functools import reduce
from sys import stdin, stdout, setrecursionlimit
setrecursionlimit(2**20)
def factorial(n):
if n == 0:
return 1
return (n * factorial(n - 1))
def ncr(n, r):
r = min(r, n - r)
numer = reduce(op.mul, range(n, n - r, -1), 1)
denom = reduce(op.mul, range(1, r + 1), 1)
return numer // denom # or / in Python 2
def prime_factors(n):
i = 2
factors = []
while i * i <= n:
if n % i:
i += 1
else:
n //= i
factors.append(i)
if n > 1:
factors.append(n)
return (list(factors))
def sumDigits(no):
return 0 if no == 0 else int(no % 10) + sumDigits(int(no / 10))
MOD = 1000000007
PMOD = 998244353
N = 10**5
T = 1
T = int(stdin.readline())
for _ in range(T):
# n, m = list(map(int, stdin.readline().rstrip().split()))
n = int(stdin.readline())
a = list(map(int, stdin.readline().rstrip().split()))
# b = list(map(int, stdin.readline().rstrip().split()))
# a = str(stdin.readline().strip('\n'))
# k = int(stdin.readline())
# c = list(map(int, stdin.readline().rstrip().split()))
if a[0] + a[1] <= a[-1]:
print(1, 2, n)
else:
print(-1)
| 7 | PYTHON3 |
from __future__ import division, print_function
# import threading
# threading.stack_size(2**27)
# import sys
# sys.setrecursionlimit(10**7)
# sys.stdin = open('inpy.txt', 'r')
# sys.stdout = open('outpy.txt', 'w')
from sys import stdin, stdout
import bisect #c++ upperbound
import math
import heapq
i_m=9223372036854775807
def inin():
return int(input())
def stin():
return input()
def spin():
return map(int,stin().split())
def lin(): #takes array as input
return list(map(int,stin().split()))
def matrix(n):
#matrix input
return [list(map(int,input().split()))for i in range(n)]
################################################
def calculate_sum(a, N): #sum of a to N
# Number of multiples
m = N / a
# sum of first m natural numbers
sum = m * (m + 1) / 2
# sum of multiples
ans = a * sum
return ans
def series(N):
return (N*(N+1))//2
def count2Dmatrix(i,list):
return sum(c.count(i) for c in list)
def modinv(n,p):
return pow(n,p-2,p)
def GCD(x, y):
x=abs(x)
y=abs(y)
if(min(x,y)==0):
return max(x,y)
while(y):
x, y = y, x % y
return x
def LCM (x, y):
return (x * y) // GCD(x, y)
def Divisors(n) :
l = []
for i in range(1, int(math.sqrt(n) + 1)) :
if (n % i == 0) :
if (n // i == i) :
l.append(i)
else :
l.append(i)
l.append(n//i)
return l
def isprime(n):
for i in range(2, int(math.sqrt(n))+1):
if n%i==0:
return False
return True
prime=[]
def SieveOfEratosthenes(n):
global prime
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
f=[]
for p in range(2, n):
if prime[p]:
f.append(p)
return f
q=[]
def dfs(n,d,v,c):
global q
v[n]=1
x=d[n]
q.append(n)
j=c
for i in x:
if i not in v:
f=dfs(i,d,v,c+1)
j=max(j,f)
# print(f)
return j
# d = {}
for _ in range(inin()):
n = inin()
a = lin()
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())
arr = [i for i in map(int,input().split())]
sorted(arr)
if(arr[0]+arr[1]<=arr[n-1]):
print(f"1 2 {n}")
else:
print(-1)
| 7 | PYTHON3 |
import sys
I = lambda: int(input())
RL = readline = lambda: sys.stdin.readline().strip('\n')
RM = readmap = lambda x = int: map(x,readline().split(' '))
#A
for _ in range(I()):
n,l = I(),[*RM()]
if l[0]+l[1] <= l[-1]:
print(1,2,n)
else:
print(-1)
| 7 | PYTHON3 |
import sys
from sys import stdin
import math
#Find Set LSB = (x&(-x)), isPowerOfTwo = (x & (x-1))
def iinput():
return int(input())
def minput():
return map(int,input().split())
def linput():
return list(map(int,input().split()))
def fiinput():
return int(stdin.readline())
def fminput():
return map(int,stdin.readline().strip().split())
def flinput():
return list(map(int,stdin.readline().strip().split()))
for _ in range(iinput()):
n=iinput()
list1=linput()
x=list1[0]
y=list1[1]
z=list1[-1]
if(x+y<=z):
print(1,2,n)
else:
print(-1) | 7 | PYTHON3 |
def solve(n, arr):
val = arr[0] + arr[1]
for i in range(2, n):
if val <= arr[i]:
print(1, 2, i+1)
return
for j in range(n-2):
if arr[j] + arr[j+1] <= arr[j+2]:
print(j+1, j+2, j+3)
return
else:
continue
print(-1)
for _ in range(int(input())):
n = int(input())
arr = list(map(int, input().split(' ')))
(solve(n, arr))
| 7 | PYTHON3 |
#include <bits/stdc++.h>
using namespace std;
void solve() {
long long n, i;
cin >> n;
vector<long long> v(n);
for (i = 0; i < n; i++) cin >> v[i];
if (v[0] + v[1] <= v[n - 1])
cout << '1' << " " << '2' << " " << n << "\n";
else
cout << "-1"
<< "\n";
return;
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
long long t = 1;
cin >> t;
while (t--) solve();
return 0;
}
| 7 | CPP |
#include <bits/stdc++.h>
using namespace std;
long long GCD(long long x, long long y) {
if (y == 0) return x;
return GCD(y, x % y);
}
long long LCM(long long x, long long y) { return (x * y) / (GCD(x, y)); }
long long LOGK(long long x, long long k) {
if (x >= k) return 1 + LOGK(x / k, k);
return 0;
}
long long MPOW(long long a, long long b, long long m) {
if (b == 0) return 1;
long long x = MPOW(a, b / 2, m);
x = (x * x) % m;
if (b % 2 == 1) x = (x * a) % m;
return x;
}
long long MINV(long long a, long long m) { return MPOW(a, m - 2, m); }
class pnc {
long long FACT_MAX, MODU;
vector<long long> fact;
public:
pnc(long long n, long long m) {
FACT_MAX = n;
fact.resize(FACT_MAX);
MODU = m;
MFACT_INIT(MODU);
}
void MFACT_INIT(long long m) {
fact[0] = 1;
for (long long i = 1; i < FACT_MAX; ++i) fact[i] = (i * fact[i - 1]) % MODU;
}
long long MFACT(long long n) { return fact[n]; }
long long PERM(long long n, long long r) {
return (fact[n] * ::MINV(fact[n - r], MODU)) % MODU;
}
long long COMB(long long n, long long r) {
return (PERM(n, r) * ::MINV(fact[r], MODU)) % MODU;
}
};
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
long long test = 1;
cin >> test;
while (test--) {
long long n;
cin >> n;
long long ar[n];
for (long long i = 0; i < n; i++) cin >> ar[i];
if (ar[0] + ar[1] <= ar[n - 1]) {
cout << 1 << ' ' << 2 << ' ' << n;
cout << "\n";
continue;
}
if (ar[n - 1] - ar[n - 2] >= ar[0]) {
cout << 1 << ' ' << n - 1 << ' ' << n;
cout << "\n";
continue;
}
cout << -1 << "\n";
}
}
| 7 | CPP |
t = int(input())
res = []
for _ in range(t):
n = int(input())
A = list(map(int, input().split()))
if A[0] + A[1] <= A[-1]:
res.append('{} {} {}'.format(1, 2, n))
else:
res.append('-1')
print('\n'.join(res)) | 7 | PYTHON3 |
# cook your dish here
for _ in range(int(input())):
k = int(input())
l = list(map(int,input().split()))
a = 0
v = l[0]+l[1]
for i in range(2,len(l)):
if v<=l[i]:
z = i+1
a = 1
break
if a == 1:
print(1,2,z)
else:
print(-1) | 7 | PYTHON3 |
# -*- coding: utf-8 -*-
for i 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 |
t = int(input())
for _ in range(t):
n = int(input())
a = list(map(int, input().split()))
x, y = a[0], a[1]
f = False
for i in range(2, n):
if x + y <= a[i]:
print(1, 2, i + 1)
f = True
break
if not f:
print(-1) | 7 | PYTHON3 |
#include <bits/stdc++.h>
int main() {
int t;
scanf("%d", &t);
while (t--) {
int n;
scanf("%d", &n);
int a[50005];
for (int x = 0; x < n; x++) {
scanf("%d", &a[x]);
}
if (a[0] + a[1] > a[n - 1]) {
printf("-1\n");
} else {
printf("1 2 %d\n", n);
}
}
return 0;
}
| 7 | CPP |
import sys
import heapq, functools, collections
import math, random
from collections import Counter, defaultdict
# available on Google, not available on Codeforces
# import numpy as np
# import scipy
def solve(lst): # fix inputs here
console("----- solving ------")
lst = sorted(lst)
if lst[0] + lst[1] > lst[-1]:
return -1
else:
return "{} {} {}".format(1, 2, len(lst))
def console(*args): # the judge will not read these print statement
print('\033[36m', *args, '\033[0m', file=sys.stderr)
return
# fast read all
# sys.stdin.readlines()
for case_num in range(int(input())):
# read line as a string
# strr = input()
# read line as an integer
_ = int(input())
# read one line and parse each word as a string
# lst = input().split()
# read one line and parse each word as an integer
lst = list(map(int,input().split()))
# read matrix and parse as integers (after reading read nrows)
# lst = list(map(int,input().split()))
# nrows = lst[0] # index containing information, please change
# grid = []
# for _ in range(nrows):
# grid.append(list(map(int,input().split())))
res = solve(lst) # please change
# Google - case number required
# print("Case #{}: {}".format(case_num+1, res))
# Codeforces - no case number required
print(res)
| 7 | PYTHON3 |
t=int(input())
for i in range(t):
n=int(input())
l=list(map(int,input().split()))
if(l[-1]<l[0]+l[1]):
print("-1\n")
else:
print("1 2",n,'\n')
| 7 | PYTHON3 |
#!/usr/bin/env python3
'''
Author: andyli
Time: 2020-08-14 22:35:30
'''
import os
from io import BytesIO, IOBase
import sys
def main():
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,n)
return
# region fastio
BUFSIZE = 1048576
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)
def input(): return sys.stdin.readline().rstrip('\r\n')
# endregion
if __name__ == '__main__':
main()
| 7 | PYTHON3 |
#include <bits/stdc++.h>
using namespace std;
int n;
const int N = 5e4 + 10;
int a[N];
void solve() {
cin >> n;
for (int i = 0; i < n; ++i) cin >> a[i];
cout << (a[0] + a[1] > a[n - 1] ? "-1" : "1 2 " + to_string(n)) << "\n";
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
int t = 1;
cin >> t;
while (t--) solve();
return 0;
}
| 7 | CPP |
for _ in range(int(input())):
n=int(input())
a=list(map(int,input().split()))
x=a[0]
y=a[1]
c=0
k=0
for i in range(2,n):
if x+y<=a[i]:
c=0
k=i
break
else:
c=c+1
if c==0:
print(1,2,k+1)
else:
print(-1) | 7 | PYTHON3 |
for tt in range(int(input())):
n = int(input())
a = [int(_) for _ in input().split()]
if a[0] + a[1] <= a[n-1]:
print(1,2,n)
else:
print(-1) | 7 | PYTHON3 |
def triangle(a):
j=len(a)//2
for i in range(len(arr)):
while(j<len(arr)):
if a[i]+a[i+1]<=a[j]:
print(i+1,i+2,j+1)
return
j+=1
print(-1)
n=int(input())
for i in range(n):
m=int(input())
arr=[0]*m
arr=list(map(int,input().split()))
triangle(arr) | 7 | PYTHON3 |
t = int(input())
for _ in range(t):
n = int(input())
arr = list(map(int, input().split()))
a = arr[0]
b = arr[1]
flag = False
for i in range(2, n):
if (a + b) <= arr[i]:
print(1, 2, i + 1)
flag = True
break
if flag is False:
print(-1) | 7 | PYTHON3 |
from sys import stdin, stdout
from collections import Counter,deque
import math
input = stdin.readline
print = stdout.write
def inpn():
return(int(input()))
def inpl():
return(list(map(int,input().split())))
def inps():
return input()
def invr():
return (map(int, input().split()))
def outs(s):
print(s)
def outn(n):
print(str(n))
def outl(l):
for i in l:
print(str(i))
for _ in range(int(input())):
n = inpn()
l=inpl()
def bin_search(data, target): # order of log(n) # works only on sorted list
low = 0
high = len(data) - 1
while low <= high:
mid = (low + high) // 2
if data[mid] >= target:
return mid
elif data[mid] < target:
low = mid + 1
else:
high = mid - 1
return -1
for i in range(n - 2):
a = bin_search(l, l[i] + l[i + 1])
if a != -1:
outn(i + 1)
print(" ")
outn(i+2)
print(" ")
outn(a+1)
print("\n")
break
else:
outn(-1)
print("\n") | 7 | PYTHON3 |
for _ in range(int(input())):
n=int(input())
a=list(map(int,input().split()));a.sort()
k=a[0]+a[1];c=0
for i in range(2,n):
if a[i]>=k:
b=i;c=1
break
if c==0:
print(-1)
else:
print(1,2,b+1) | 7 | PYTHON3 |
test = int(input())
for _ in range(test):
n = int(input())
arr = list(map(int, input().split()))
t = arr[0]+arr[1]
o = arr[-1]
if t<=o:
print(1, end=' ')
print(2, end=' ')
print(n)
else:
print(-1) | 7 | PYTHON3 |
t=int(input())
for k in range(t):
n=int(input())
flag=0
a= list(map(int,input().split()))
temp=a[0]+a[1]
if(a[n-1]>=temp):
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()))
i = 0
j = 1
k = 2
breaked = False
while i < n and j < n:
if a[i] + a[j] <= a[k]:
print(i+1, j+1, k+1)
breaked = True
break
if k < n-1:
k += 1
elif j < n-2:
j += 1
else:
i += 1
if not breaked:
print(-1) | 7 | PYTHON3 |
T = int(input())
for i in range(T):
n = int(input())
arr = list(map(int, input().split()))
a, b, c = arr[0], arr[1], arr[-1]
if a+b <= c:
print(1, 2, n)
else:
print(-1)
| 7 | PYTHON3 |
import sys
input = sys.stdin.readline
from collections import *
for _ in range(int(input())):
n = int(input())
a = list(map(int, input().split()))
x, y, z = a[0], a[1], a[-1]
if z>=x+y:
print(1, 2, n)
else:
print(-1) | 7 | PYTHON3 |
for _ in range(int(input())):
n = int(input())
b = list(map(int, input().split()))
ans = False
for i in range(2, len(b)):
if b[0]+b[1] <= b[i]:
ans = True
print(1, 2, i+1)
break
if ans == False:
print(-1)
| 7 | PYTHON3 |
# -*- coding: utf-8 -*-
"""
Created on Mon Aug 3 21:10:40 2020
@author: dennis
"""
import atexit
import io
import sys
_INPUT_LINES = sys.stdin.read().splitlines()
input = iter(_INPUT_LINES).__next__
_OUTPUT_BUFFER = io.StringIO()
sys.stdout = _OUTPUT_BUFFER
@atexit.register
def write():
sys.__stdout__.write(_OUTPUT_BUFFER.getvalue())
for case in range(int(input())):
n = int(input())
a = [int(x) for x in input().split()]
if a[0] + a[1] <= a[-1]:
print(1, 2, n)
else:
print(-1)
| 7 | PYTHON3 |
# cook your dish here
t = int(input())
while t:
n = int(input())
l = list(map(int,input().split()))
i = 0
j = 1
count = 0
for k in range(2,n):
if (l[k])>=(l[i]+l[j]):
print(f'{i+1} {j+1} {k+1}')
count = 1
break
if count ==0:
print('-1')
t-=1 | 7 | PYTHON3 |
for _ in range(int(input())):
n = int(input())
arr = list(map(int, input().split()))
arr.sort()
if arr[0] + arr[1] <= arr[-1]:
print(1, 2, n)
else:
print(-1) | 7 | PYTHON3 |
#_______________________________________________________________#
def fact(x):
if x == 0:
return 1
else:
return x * fact(x-1)
def lower_bound(li, num): #return 0 if all are greater or equal to
answer = len(li)-1
start = 0
end = len(li)-1
while(start <= end):
middle = (end+start)//2
if li[middle] >= num:
answer = middle
end = middle - 1
else:
start = middle + 1
return answer #index where x is not less than num
def upper_bound(li, num): #return n-1 if all are small or equal
answer = -1
start = 0
end = len(li)-1
while(start <= end):
middle = (end+start)//2
if li[middle] <= num:
answer = middle
start = middle + 1
else:
end = middle - 1
return answer #index where x is not greater than num
def abs(x):
return x if x >=0 else -x
def binary_search(li, val, lb, ub): # ITS A BINARY
ans = 0
while(lb <= ub):
mid = (lb+ub)//2
#print(mid, li[mid])
if li[mid] > val:
ub = mid-1
elif val > li[mid]:
lb = mid + 1
else:
ans = 1
break
return ans
def sieve_of_eratosthenes(n):
ans = []
arr = [1]*(n+1)
arr[0],arr[1], i = 0, 0, 2
while(i*i <= n):
if arr[i] == 1:
j = i+i
while(j <= n):
arr[j] = 0
j += i
i += 1
for k in range(n):
if arr[k] == 1:
ans.append(k)
return ans
def nc2(x):
if x == 1:
return 0
else:
return x*(x-1)//2
def kadane(x): #maximum subarray sum
sum_so_far = 0
current_sum = 0
for i in x:
current_sum += i
if current_sum < 0:
current_sum = 0
else:
sum_so_far = max(sum_so_far,current_sum)
return sum_so_far
def mex(li):
check = [0]*1001
for i in li:
check[i] += 1
for i in range(len(check)):
if check[i] == 0:
return i
def sumdigits(n):
ans = 0
while(n!=0):
ans += n%10
n //= 10
return ans
def product(li):
ans = 1
for i in li:
ans *= i
return ans
def maxpower(n,k):
cnt = 0
while(n>1):
cnt += 1
n //= k
return cnt
def knapsack(li,sumi,s,n,dp):
if s == sumi//2:
return 1
elif n==0:
return 0
else:
if dp[n][s] != -1:
return dp[n][s]
else:
if li[n-1] <= s:
dp[n][s] = knapsack(li,sumi,s-li[n-1],n-1,dp) or knapsack(li,sumi,s,n-1,dp)
else:
dp[n][s] = knapsack(li,sumi,s,n-1,dp)
return dp[n][s]
def pref(li):
pref_sum = [0]
for i in li:
pref_sum.append(pref_sum[-1] + i)
return pref_sum
#_______________________________________________________________#
'''
ββββββββββββββββ
ββββββββββββββββββββββ
βββββββββAestroixβββββββββ
βββββββββββββββββββββββββββ
βββββββββKARMANYAβββββββββββ ________________
ββββββββββββββββββββββββββββ ? ? |ββββββββββββββββ|
ββββββββββββββββββββββββββββ ? |___CM ONE DAY___|
βββββββββββββββββββββββββββ ? ? |ββββββββββββββββ|
ββββββββββββββββββββββββββ ? ?
ββββββββββββββββββββββββββ ?
βββββββββββββββββββββββββ ? ?
ββββββββββββββββββββββββ ?
ββββββββββββββ ββββ=========βββββ
ββββββββββββββββββββββ
βββββββββββββββββββββ
βββββββββββββββββββββ
βββββββββββββββββββββ
'''
from math import *
for _ in range(int(input())):
#for _ in range(1):
n = int(input())
#n,m,sx,sy = map(int,input().split())
#s = input()
#s2 = input()
#r, g, b, w = map(int,input().split())
a = list(map(int,input().split()))
#b = list(map(int,input().split()))
#s1 = list(st)
#a = [int(x) for x in list(s1)]
#b = [int(x) for x in list(s2)]
f = 0
ans = lower_bound(a,a[0]+a[1])
if a[ans] < a[0]+a[1]:
print(-1)
else:
print(1,2,ans+1)
| 7 | PYTHON3 |
t = int(input())
for _ in range(t):
n = int(input())
a = [int(x) for x in input().split()]
if a[0] + a[1] <= a[-1]:
print(1, 2, n)
else:
print(-1) | 7 | PYTHON3 |
t=int(input())
for _ in range(t):
n=int(input())
arr=list(map(int,input().split()))
s=arr[0]+arr[1]
f=0
th=0
for i in range(2,n):
if s > arr[i]:
continue
else:
f=1
th=i
if f==1:
print("1 2",end=" ")
print(th+1)
else:
print(-1)
| 7 | PYTHON3 |
#include <bits/stdc++.h>
using namespace std;
int main() {
int t;
cin >> t;
while (t--) {
int size;
cin >> size;
std::vector<int> v(size);
for (auto& x : v) cin >> x;
if (v[0] + v[1] > v[size - 1])
cout << -1 << endl;
else
cout << 1 << " " << 2 << " " << size << endl;
}
return 0;
}
| 7 | CPP |
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 |
import sys
import math
input = sys.stdin.readline
t = int(input())
for _ in range(t):
n = int(input())
a = list(map(int, input().split()))
if a[0] + a[1] <= a[n-1]:
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[n-1]>=a[0]+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()))
mi = min(a)
mii = a.index(mi)
ma = max(a)
mai = a.index(ma)
fl = False
i = -1
for i in range(len(a)):
if i != mai and i != mii and mi + a[i] <= ma:
fl = True
break
b = [mii+1, mai+1, i+1]
b.sort()
if fl:
print(b[0], b[1], b[2])
else:
print(-1)
| 7 | PYTHON3 |
def read_int():
return int(input().strip())
def read_ints():
return list(map(int, input().strip().split(' ')))
def solve():
N = read_int()
A = read_ints() # a+b < c
if A[0]+A[1] <= A[-1]:
return 1, 2, N
return [-1]
if __name__ == '__main__':
T = read_int()
for _ in range(T):
print(*solve())
| 7 | PYTHON3 |
for _ in range(int(input())):
x= int(input())
ar = list(map(int , input().split()))
if ar[len(ar)-1]>=(ar[0]+ar[1]):
print(f'1 2 {len(ar)}')
else:
print(-1) | 7 | PYTHON3 |
t = int(input())
for i in range(t):
n = int(input())
lst1 = list(map(int,input().split()))
a = max(lst1)
b = 0
for i in range(1,n-1):
if(lst1[0]+lst1[i] > a):
continue
else:
b = 1
break
if(b == 1):
print(1,end = " ")
print(i+1,end = " ")
print(n)
else:
print(-1) | 7 | PYTHON3 |
T = int(input())
for t in range(T):
n = int(input())
L = list(map(int, input().split()))
if L[0] + L[1] <= L[-1]:
print("1 2 {}".format(n))
else:
print(-1) | 7 | PYTHON3 |
import sys
inp=sys.stdin.buffer.readline
def inin(typ=int):
return typ(inp())
def inar(typ=int):
return list(map(typ,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 i in range(t):
n = int(input())
l = list(map(int,input().split()))
if l[0]+l[1] > l[-1]:
print('-1')
else:
print('1 2',n)
| 7 | PYTHON3 |
def fun(l):
sum=l[0]+l[1]
for i in range(len(l)):
if sum<=l[i]:
return [1,2,i+1]
return [-1]
t=int(input())
for _ in range(t):
n=int(input())
l=list(map(int,input().split()))
ans=fun(l)
print(*ans)
| 7 | PYTHON3 |
for _ in range(int(input())):
temp = input()
arr = list(map(int, input().split()))
arr.sort()
if arr[0] + arr[1] <= arr[-1]:
print("%d %d %d"% (1, 2, len(arr)))
else:
print("-1")
| 7 | PYTHON3 |
t=int(input())
for _ in range(t):
l=int(input())
flag=0
a=list(map(int,input().split(" ")))
k=a[-1]-a[0]
for i in range(1,l-1):
if(a[i]<=k):
print(1,i+1,l,end=" ")
flag=1
print()
break
if(flag==0):
print("-1") | 7 | PYTHON3 |
#include <bits/stdc++.h>
using namespace std;
const int INF = 1e9 + 7;
const int N = 1e5 + 5;
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
;
int t;
cin >> t;
while (t--) {
int n;
cin >> n;
vector<long long int> a(n);
for (int i = 0; i < n; ++i) {
cin >> a[i];
}
int i = a[0];
int k = a[n - 1];
for (int j = 1; j < n - 1; ++j) {
if (i + a[j] <= k) {
cout << 1 << " " << j + 1 << " " << n;
break;
} else if (i + a[j] > k) {
cout << -1;
break;
}
}
cout << endl;
}
}
| 7 | CPP |
import collections
from functools import lru_cache
def read():
return input().strip()
def readInt():
return int(input().strip())
def readList():
return list(map(int, input().strip().split()))
def solve(N, arr):
a, b, c = arr[0], arr[1], arr[-1]
if a+b <= c:
return " ".join(map(str, [1, 2, N]))
else:
return "-1"
t = readInt()
for i in range(t):
N = readInt()
arr = readList()
print(solve(N, arr))
| 7 | PYTHON3 |
from math import sqrt
t = int(input())
def area(a, b, c):
p = (a+b+c)/2
area = sqrt(p*(p-a)*(p-b)*(p-c))
return area
while 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)
else:
print(-1)
t -= 1
| 7 | PYTHON3 |
#!/usr/bin/env python
# https://github.com/cheran-senthil/PyRival/blob/master/templates/template_py3.py
import os
import sys,math
from io import BytesIO, IOBase
def main():
t=int(input())
for case in range(t):
n=int(input())
l=list(map(int,input().split()))
if l[0]+l[1]<=l[-1]:
print("1 2",n)
else:
print(-1)
# region fastio
BUFSIZE = 8192
class FastIO(IOBase):
newlines = 0
def __init__(self, file):
self._fd = file.fileno()
self.buffer = BytesIO()
self.writable = "x" in file.mode or "r" not in file.mode
self.write = self.buffer.write if self.writable else None
def read(self):
while True:
b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
if not b:
break
ptr = self.buffer.tell()
self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
self.newlines = 0
return self.buffer.read()
def readline(self):
while self.newlines == 0:
b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
self.newlines = b.count(b"\n") + (not b)
ptr = self.buffer.tell()
self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
self.newlines -= 1
return self.buffer.readline()
def flush(self):
if self.writable:
os.write(self._fd, self.buffer.getvalue())
self.buffer.truncate(0), self.buffer.seek(0)
class IOWrapper(IOBase):
def __init__(self, file):
self.buffer = FastIO(file)
self.flush = self.buffer.flush
self.writable = self.buffer.writable
self.write = lambda s: self.buffer.write(s.encode("ascii"))
self.read = lambda: self.buffer.read().decode("ascii")
self.readline = lambda: self.buffer.readline().decode("ascii")
sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)
input = lambda: sys.stdin.readline().rstrip("\r\n")
# endregion
if __name__ == "__main__":
main() | 7 | PYTHON3 |
"""
Satwik_Tiwari ;) .
14th AUGUST , 2020 - FRIDAY
"""
#===============================================================================================
#importing some useful libraries.
from __future__ import division, print_function
from fractions import Fraction
import sys
import os
from io import BytesIO, IOBase
from itertools import *
import bisect
from heapq import *
from math import *
from copy import *
from collections import deque
from collections import Counter as counter # Counter(list) return a dict with {key: count}
from itertools import combinations as comb # if a = [1,2,3] then print(list(comb(a,2))) -----> [(1, 2), (1, 3), (2, 3)]
from itertools import permutations as permutate
from bisect import bisect_left as bl
#If the element is already present in the list,
# the left most position where element has to be inserted is returned.
from bisect import bisect_right as br
from bisect import bisect
#If the element is already present in the list,
# the right most position where element has to be inserted is returned
#==============================================================================================
#fast I/O region
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")
def print(*args, **kwargs):
"""Prints the values to a stream, or to sys.stdout by default."""
sep, file = kwargs.pop("sep", " "), kwargs.pop("file", sys.stdout)
at_start = True
for x in args:
if not at_start:
file.write(sep)
file.write(str(x))
at_start = False
file.write(kwargs.pop("end", "\n"))
if kwargs.pop("flush", False):
file.flush()
if sys.version_info[0] < 3:
sys.stdin, sys.stdout = FastIO(sys.stdin), FastIO(sys.stdout)
else:
sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)
# inp = lambda: sys.stdin.readline().rstrip("\r\n")
#===============================================================================================
### START ITERATE RECURSION ###
from types import GeneratorType
def iterative(f, stack=[]):
def wrapped_func(*args, **kwargs):
if stack: return f(*args, **kwargs)
to = f(*args, **kwargs)
while True:
if type(to) is GeneratorType:
stack.append(to)
to = next(to)
continue
stack.pop()
if not stack: break
to = stack[-1].send(to)
return to
return wrapped_func
#### END ITERATE RECURSION ####
#===============================================================================================
#some shortcuts
mod = 1000000007
def inp(): return sys.stdin.readline().rstrip("\r\n") #for fast input
def out(var): sys.stdout.write(str(var)) #for fast output, always take string
def lis(): return list(map(int, inp().split()))
def stringlis(): return list(map(str, inp().split()))
def sep(): return map(int, inp().split())
def strsep(): return map(str, inp().split())
# def graph(vertex): return [[] for i in range(0,vertex+1)]
def zerolist(n): return [0]*n
def nextline(): out("\n") #as stdout.write always print sring.
def testcase(t):
for p in range(t):
solve()
def printlist(a) :
for p in range(0,len(a)):
out(str(a[p]) + ' ')
def lcm(a,b): return (a*b)//gcd(a,b)
def power(x, y, p) :
res = 1 # Initialize result
x = x % p # Update x if it is more , than or equal to p
if (x == 0) :
return 0
while (y > 0) :
if ((y & 1) == 1) : # If y is odd, multiply, x with result
res = (res * x) % p
y = y >> 1 # y = y/2
x = (x * x) % p
return res
def ncr(n,r): return factorial(n)//(factorial(r)*factorial(max(n-r,1)))
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
#===============================================================================================
# code here ;))
def solve():
n = int(inp())
a= lis()
if(a[0]+a[1]<=a[n-1]):
print(1,2,n)
return
print(-1)
# testcase(1)
testcase(int(inp()))
| 7 | PYTHON3 |
import os
import sys
from io import BytesIO, IOBase
# region fastio
BUFSIZE = 8192
class FastIO(IOBase):
newlines = 0
def __init__(self, file):
self._fd = file.fileno()
self.buffer = BytesIO()
self.writable = "x" in file.mode or "r" not in file.mode
self.write = self.buffer.write if self.writable else None
def read(self):
while True:
b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
if not b:
break
ptr = self.buffer.tell()
self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
self.newlines = 0
return self.buffer.read()
def readline(self):
while self.newlines == 0:
b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
self.newlines = b.count(b"\n") + (not b)
ptr = self.buffer.tell()
self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
self.newlines -= 1
return self.buffer.readline()
def flush(self):
if self.writable:
os.write(self._fd, self.buffer.getvalue())
self.buffer.truncate(0), self.buffer.seek(0)
class IOWrapper(IOBase):
def __init__(self, file):
self.buffer = FastIO(file)
self.flush = self.buffer.flush
self.writable = self.buffer.writable
self.write = lambda s: self.buffer.write(s.encode("ascii"))
self.read = lambda: self.buffer.read().decode("ascii")
self.readline = lambda: self.buffer.readline().decode("ascii")
sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)
inp = lambda: sys.stdin.readline().rstrip("\r\n")
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 |
def main():
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)
else:
print(1, 2, n)
main() | 7 | PYTHON3 |
T = int(input())
while T != 0:
N = int(input())
A = list(map(int,input().strip().split()))[:N]
found = False
if A[0] + A[1] <= A[N - 1]:
found = True
if found:
ans = [1,2,N]
print(*ans)
else:
print(-1)
T -= 1 | 7 | PYTHON3 |
#include <bits/stdc++.h>
using namespace std;
int main() {
int t;
scanf("%d", &t);
while (t--) {
int n;
scanf("%d", &n);
int a[n + 1];
for (int i = 0; i < n; i++) {
scanf("%d", &a[i]);
}
if (a[0] + a[1] > a[n - 1]) {
printf("-1\n");
continue;
} else {
printf("%d %d %d\n", 1, 2, n);
}
}
return 0;
}
| 7 | CPP |
for _ in range(int(input())):
n = int(input())
a = list(map(int, input().strip().split()))[:n]
i = a[0]
j1 = a[1]
j2 = a[-2]
k = a[-1]
if(i + j1 <= k):
print(1, 2, n)
elif(i + j2 <= k):
print(1, n-1, n)
else:
print(-1) | 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 '+str(n))
else:
print(-1)
| 7 | PYTHON3 |
tests = int(input())
for test in range(tests):
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 i in range(int(input())):
n=int(input())
a=list(map(int,input().split()))
k=0
if a[0]+a[1]<=max(a):
print(1,2,n)
else:
print(-1)
| 7 | PYTHON3 |
import sys
import string
import math
from collections import defaultdict
from functools import lru_cache
from collections import Counter
from fractions import Fraction
def mi(s):
return map(int, s.strip().split())
def lmi(s):
return list(mi(s))
def tmi(s):
return tuple(mi(s))
def mf(f, s):
return map(f, s)
def lmf(f, s):
return list(mf(f, s))
def js(lst):
return " ".join(str(d) for d in lst)
def jsns(lst):
return "".join(str(d) for d in lst)
def line():
return sys.stdin.readline().strip()
def linesp():
return line().split()
def iline():
return int(line())
def mat(n):
matr = []
for _ in range(n):
matr.append(linesp())
return matr
def matns(n):
mat = []
for _ in range(n):
mat.append([c for c in line()])
return mat
def mati(n):
mat = []
for _ in range(n):
mat.append(lmi(line()))
return mat
def pmat(mat):
for row in mat:
print(js(row))
def solve(arr):
arr = list(enumerate(arr))
arr.sort(key=lambda x: x[1])
i1, val1 = arr[-1]
i2, val2 = arr[0]
i3, val3 = arr[1]
if val2 + val3 <= val1:
x = min(i1, i2, i3)
rest = [jj for jj in [i1, i2, i3] if jj != x]
print(x + 1, min(rest) + 1, max(rest) + 1)
else:
print(-1)
def main():
t = iline()
for _ in range(t):
line()
arr = lmi(line())
solve(arr)
main()
| 7 | PYTHON3 |
#include <bits/stdc++.h>
using namespace std;
const long long max_n = 1000000000;
int main() {
long long t;
cin >> t;
while (t--) {
int n;
cin >> n;
int arr[n];
for (int i = 0; i < n; i++) {
cin >> arr[i];
}
sort(arr, arr + n);
int a = arr[0];
int b = arr[1];
int c = arr[n - 1];
if (arr[0] + arr[1] <= arr[n - 1]) {
cout << 1 << " " << 2 << " " << n << endl;
} else {
cout << -1 << endl;
}
}
}
| 7 | CPP |
t=int(input())
for _ in range(t):
n=int(input())
l=list(map(int,input().split()))
m=l[0]+l[1]
flag=False
for i in range(2,n):
if m<=l[i]:
print(1,2,i+1)
flag=True
break
if not flag:
print(-1)
| 7 | PYTHON3 |
try:
t=int(input())
for i in range(t):
n=int(input())
l=list(map(int,input().split()))
a=l[0]
b=l[1]
v=2
for i in range(2,n):
if(l[i]>=(a+b)):
c=i+1
break
else:
v+=1
if(v==n):
print(-1)
else:
print(1,2,c)
except:
pass
| 7 | PYTHON3 |
for _ in range(int(input())):
n,a = int(input()), list(map(int, input().split()))
if (a[0] + a[1] <= a[n-1]):
print("1 2 {}".format(n))
else:
print("-1")
| 7 | PYTHON3 |
import itertools
def testcases(a,n):
#x,y,z=0,1,n-1
"""for i in range(n-2):
#z=n-1
for j in range(i+1,n-1):
z=n-1
while(z>j):
if a[i]+a[j]<a[z]:
return i+1,j+1,z+1
else:
z-=1
return -1"""
if a[0]+a[1]<=a[n-1]:
return 1,2,n
else:
return -1
for _ in range(int(input())):
n=int(input())
#p=[int(x) for x in input().split()]
a=[int(x) for x in input().split()]
ans=(testcases(a,n))
if ans==-1:
print(-1)
else:
"""ans=list(ans)
if ans[0]==ans[1]:
ans[1]+=1
elif ans[0]==ans[2]:
ans[2]+=1
elif ans[1]==ans[2]:
ans[2]+=1"""
for i in ans:
print(i,end=" ")
print() | 7 | PYTHON3 |
from collections import defaultdict as dd
from sys import stdin,stdout
for t in range(int(stdin.readline().strip())):
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 func():
n = int(input())
a = list(map(int, input().split()))
first = a[0]
second = a[1]
last = a[n-1]
if(first + second <= last):
return "1 2 " + str(n)
else:
return "-1"
t = int(input())
for _ in range(t):
print(func())
| 7 | PYTHON3 |
t=int(input())
for hh in range(0,t):
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 |
t = int(input())
for _ in range(t):
n = int(input())
a = list(map(int, input().split()))
ans = -1
if a[0]+a[1] <= a[n-1]:
ans = '1 2 ' + str(n)
print(ans) | 7 | PYTHON3 |
def solve():
n=int(input())
a=list(map(int,input().split()))
i,j=0,1
tmp = a[0]+a[1]
for k in range(2,n):
if a[k]>= tmp:
print(i+1,j+1,k+1)
return
print(-1)
for _ in range(int(input())):
solve()
| 7 | PYTHON3 |
for _ in range(0,int(input())):
a=int(input())
b=list(map(int,input().split()))
b.sort()
if b[0]+b[1]>b[a-1] and b[1]-b[0]<b[a-1] and b[a-1]-b[1]<b[0] and b[a-1]-b[0]<b[1]:
print("-1")
else:
print(1,2,a) | 7 | PYTHON3 |
for _ in range(int(input())):
n = int(input())
arr = list(map(int,input().split()))
ls = arr[0] + arr[1]
if ls <= arr[-1]: print(1,2,n)
else: print(-1) | 7 | PYTHON3 |
import os #4
inp=os.read(0,os.fstat(0).st_size).split(b"\n");_ii=-1
def rdln():
global _ii
_ii+=1
return inp[_ii]
inin=lambda: int(rdln())
inar=lambda: [int(x) for x in rdln().split()]
inst=lambda: rdln().strip().decode()
_T_=inin()
for _t_ in range(_T_):
n=inin()
a=inar()
if a[0]+a[1]>a[n-1]:
print(-1)
else:
print(1,2,n) | 7 | PYTHON3 |
t = int(input())
while t:
n = int(input())
a = [int(i) for i in input().split()]
if a[0] + a[1] <= a[len(a)-1]:
print(1, 2, len(a))
else:
print(-1)
t -= 1 | 7 | PYTHON3 |
for _ in range(int(input())):
n=(int(input()))
a=list(map(int,input().strip().split()))[:n]
if(a[0]+a[1]<=a[-1]):
print(1,2,n)
else:
print("-1")
| 7 | PYTHON3 |
for z in range(int(input())):
n=int(input())
flag=True
a=[int(i) for i in input().split()]
for i in range(n-2):
if(a[i]+a[i+1]<=a[n-1]):
flag=False
print(i+1,i+2,n)
break
if flag==True:
print("-1") | 7 | PYTHON3 |
from itertools import combinations
def stdin(t):
for _ in range(t):
n = int(input())
a = [int(x) for x in input().split()]
print(main(a, n))
def main(a, n):
if a[n-1] >= a[0] + a[1]:
return '{} {} {}'.format(1, 2, n)
return -1
if __name__ == '__main__':
stdin(int(input()))
| 7 | PYTHON3 |
for _ in range(int(input())):
n = int(input())
l = list(map(int, input().split()))
a = l[0]
b = l[1]
c = l[-1]
if a+b <= c:
print(1,2,n)
else:
print(-1) | 7 | PYTHON3 |
for _ in range(int(input())):
n=int(input())
a=list(map(int,input().split()))
if a[0]+a[1]<=a[-1]:
print('1','2',n)
else:
print('-1')
| 7 | PYTHON3 |
for _ in range(int(input())):
n = input()
array = list(map(int,input().split()))
if array[0]+array[1]<=array[-1]:
print(1,2,n)
else:
print(-1) | 7 | PYTHON3 |
n = int(input())
for _ in range(n):
m = int(input())
arr = list(map(int, input().split()))
x = arr[0]+arr[1]
flag = False
for i in range(2, len(arr)):
if x <= arr[i]:
print(f"1 2 {i+1}")
flag = True
break
if not flag:
print("-1") | 7 | PYTHON3 |
import sys
input=sys.stdin.readline
for _ in range(int(input())):
n=int(input())
#n,m=map(int,input().split())
#s=input().strip()
a=list(map(int,input().split()))
if a[0]+a[1]>a[-1]:
print(-1)
else:
print(1,2,n) | 7 | PYTHON3 |
import sys #2
inp=sys.stdin.buffer.read().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()
_T_=inin()
for _t_ in range(_T_):
n=inin()
a=inar()
if a[0]+a[1]>a[n-1]:
print(-1)
else:
print(1,2,n) | 7 | PYTHON3 |
for _ 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 i in range(t):
n=int(input())
a=list(map(int,input().split()))
x=max(a)
b=sorted(a)
y=b[0]
z=b[1]
if y+z<=x:
m=a.index(x)
a[m]=0
k=a.index(y)
a[k]=0
l=a.index(z)
s=[m+1,k+1,l+1]
print(*sorted(s))
else:
print(-1) | 7 | PYTHON3 |
#from fractions import Fraction
from collections import defaultdict
from math import*
import os
import sys
from io import BytesIO, IOBase
from heapq import nlargest
from bisect import*
import copy
import itertools
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)
def input(): return sys.stdin.readline().rstrip("\r\n")
#-------------above part copied-----------------------
t=int(input())
while t:
t-=1
n=int(input())
arr=list(map(int,input().split()))
if arr[0]+arr[1]>arr[-1]:
print("-1")
else:
print("1 2",n) | 7 | PYTHON3 |
import os
import sys
from io import BytesIO, IOBase
def main():
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)
# FASTIO REGION
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, **kwargs):
while self.newlines == 0:
b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
self.newlines = b.count(b"\n") + (not b)
ptr = self.buffer.tell()
self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
self.newlines -= 1
return self.buffer.readline()
def flush(self):
if self.writable:
os.write(self._fd, self.buffer.getvalue())
self.buffer.truncate(0), self.buffer.seek(0)
class IOWrapper(IOBase):
def __init__(self, file):
self.buffer = FastIO(file)
self.flush = self.buffer.flush
self.writable = self.buffer.writable
self.write = lambda s: self.buffer.write(s.encode("ascii"))
self.read = lambda: self.buffer.read().decode("ascii")
self.readline = lambda: self.buffer.readline().decode("ascii")
sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)
input = lambda: sys.stdin.readline().rstrip("\r\n")
# endregion
if __name__ == "__main__":
main() | 7 | PYTHON3 |
#include <bits/stdc++.h>
using namespace std;
int main() {
int t;
cin >> t;
while (t--) {
int n;
cin >> n;
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 << endl;
else
cout << -1 << endl;
}
return 0;
}
| 7 | CPP |
for _ in range(int(input())):
n = int(input())
a = list(map(int,input().split()))
flag = 0
min = a[0] + a[1]
for i in range(2,len(a)):
if min <= a[i]:
print(1,2,i+1)
flag = 1
break
if flag == 0:
print(-1) | 7 | PYTHON3 |
#include <bits/stdc++.h>
using namespace std;
const int MAXN = 501011;
int a[MAXN];
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("-1\n");
else
printf("1 2 %d\n", n);
}
return 0;
}
| 7 | CPP |
for _ in range(int(input())):
a = int(input())
b = list(map(int,input().split()))
if b[0]+b[1]>b[-1]:
print(-1)
else:
print(1,2,a)
| 7 | PYTHON3 |
import sys
inp=sys.stdin.buffer.readline
inin=lambda typ=int: typ(inp())
inar=lambda typ=int: list(map(typ,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 |
# code by RAJ BHAVSAR
for _ in range(int(input())):
n = int(input())
arr = list(map(int,input().split()))
flag = 0
for i in range(1,n):
t = arr[i] + arr[i-1]
if(i != n-1):
if(arr[n-1] >= t):
flag = 1
print(i,i+1,n)
break
if(flag == 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)
elif last<first:
print(-1) | 7 | PYTHON3 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.