solution
stringlengths
11
983k
difficulty
int64
0
21
language
stringclasses
2 values
from sys import * input = stdin.readline output = stdout.write for _ in range(int(input())): n = int(input()) a = list(map(int,input().split())) ind = -1 sn = a[0]+a[1] for i in range(2,n): if(a[i]>=sn): ind = i break if(ind == -1): output(str(-1)+'\n') else: output(str(1)+' '+str(2)+' '+str(ind+1)+'\n')
7
PYTHON3
t=int(input()) while t>0: inp_int=int(input()) inp=list(map(int, input().split())) if inp[0]+inp[1]<=inp[inp_int-1]: print(1,2,inp_int) elif inp[0]<=inp[inp_int-1]-inp[inp_int-2]: print(1,inp_int-1,inp_int) else: print(-1) t-=1
7
PYTHON3
t=int(input()) for i in range(t): n=int(input()) a=list(map(int,input().split())) s=a[0]+a[1] sa=a[n-1] if s<=sa : print("{} {} {}".format(1,2,n)) else: print('-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, n; cin >> t; for (int i = 0; i < t; i++) { cin >> n; unsigned long long int arr[n]; for (int i = 0; i < n; i++) { cin >> arr[i]; } if (arr[0] + arr[1] <= arr[n - 1]) { cout << 1 << " " << 2 << " " << n << "\n"; } else { cout << "-1\n"; } } return 0; }
7
CPP
a=int(input()) for i in range(a): b=int(input()) l=list(map(int,input().split())) if l[0]+l[1]<=l[-1]: print(1,2,b) else: print(-1)
7
PYTHON3
def test(a, b, c): if a+b <= c or b+c <= a or a+c <= b: return False return True n = int(input()) ans = [] for i in range(n): key = True n = int(input()) a, b, c = 0, 1, n-1 m = [int(j) for j in input().split()] for j in range(1, n-1): b = j if not test(m[a], m[b], m[c]): key = False break if key: ans.append([-1]) else: ans.append([a+1, b+1, c+1]) for i in ans: print(*i)
7
PYTHON3
if __name__ == "__main__": # Happens num times num_cases = int(input()) for i in range(num_cases): # Do loop calling length and integers, num times length = int(input()) integers = list(map(int, input().split())) if integers[0] + integers[1] > integers[-1]: print(-1) else: print(1, 2, length)
7
PYTHON3
import sys input = sys.stdin.readline for _ in range(int(input())): n = int(input()) lst = list(map(int, input().split())) a, b, c = [1, 2, -1] end = False for i in range(2, n): if lst[a-1] + lst[b-1] <= lst[i] or lst[a-1] + lst[i] <= lst[b-1] or lst[b-1] + lst[i] <= lst[a-1]: end = True print(a, b, i+1) break if not end: print(-1)
7
PYTHON3
# ---------------------------iye ha aam zindegi--------------------------------------------- import math import heapq, bisect import sys from collections import deque, defaultdict from fractions import Fraction import sys mod = 10 ** 9 + 7 mod1 = 998244353 #setrecursionlimit(300000) # ------------------------------warmup---------------------------- import os import sys from io import BytesIO, IOBase BUFSIZE = 8192 sys.setrecursionlimit(300000) 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") # -------------------game starts now----------------------------------------------------import math class SegmentTree: def __init__(self, data, default=0, func=lambda a, b: a + b): """initialize the segment tree with data""" self._default = default self._func = func self._len = len(data) self._size = _size = 1 << (self._len - 1).bit_length() self.data = [default] * (2 * _size) self.data[_size:_size + self._len] = data for i in reversed(range(_size)): self.data[i] = func(self.data[i + i], self.data[i + i + 1]) def __delitem__(self, idx): self[idx] = self._default def __getitem__(self, idx): return self.data[idx + self._size] def __setitem__(self, idx, value): idx += self._size self.data[idx] = value idx >>= 1 while idx: self.data[idx] = self._func(self.data[2 * idx], self.data[2 * idx + 1]) idx >>= 1 def __len__(self): return self._len def query(self, start, stop): if start == stop: return self.__getitem__(start) stop += 1 start += self._size stop += self._size res = self._default while start < stop: if start & 1: res = self._func(res, self.data[start]) start += 1 if stop & 1: stop -= 1 res = self._func(res, self.data[stop]) start >>= 1 stop >>= 1 return res def __repr__(self): return "SegmentTree({0})".format(self.data) # -------------------------------iye ha chutiya zindegi------------------------------------- class Factorial: def __init__(self, MOD): self.MOD = MOD self.factorials = [1, 1] self.invModulos = [0, 1] self.invFactorial_ = [1, 1] def calc(self, n): if n <= -1: print("Invalid argument to calculate n!") print("n must be non-negative value. But the argument was " + str(n)) exit() if n < len(self.factorials): return self.factorials[n] nextArr = [0] * (n + 1 - len(self.factorials)) initialI = len(self.factorials) prev = self.factorials[-1] m = self.MOD for i in range(initialI, n + 1): prev = nextArr[i - initialI] = prev * i % m self.factorials += nextArr return self.factorials[n] def inv(self, n): if n <= -1: print("Invalid argument to calculate n^(-1)") print("n must be non-negative value. But the argument was " + str(n)) exit() p = self.MOD pi = n % p if pi < len(self.invModulos): return self.invModulos[pi] nextArr = [0] * (n + 1 - len(self.invModulos)) initialI = len(self.invModulos) for i in range(initialI, min(p, n + 1)): next = -self.invModulos[p % i] * (p // i) % p self.invModulos.append(next) return self.invModulos[pi] def invFactorial(self, n): if n <= -1: print("Invalid argument to calculate (n^(-1))!") print("n must be non-negative value. But the argument was " + str(n)) exit() if n < len(self.invFactorial_): return self.invFactorial_[n] self.inv(n) # To make sure already calculated n^-1 nextArr = [0] * (n + 1 - len(self.invFactorial_)) initialI = len(self.invFactorial_) prev = self.invFactorial_[-1] p = self.MOD for i in range(initialI, n + 1): prev = nextArr[i - initialI] = (prev * self.invModulos[i % p]) % p self.invFactorial_ += nextArr return self.invFactorial_[n] class Combination: def __init__(self, MOD): self.MOD = MOD self.factorial = Factorial(MOD) def ncr(self, n, k): if k < 0 or n < k: return 0 k = min(k, n - k) f = self.factorial return f.calc(n) * f.invFactorial(max(n - k, k)) * f.invFactorial(min(k, n - k)) % self.MOD # --------------------------------------iye ha combinations ka zindegi--------------------------------- def powm(a, n, m): if a == 1 or n == 0: return 1 if n % 2 == 0: s = powm(a, n // 2, m) return s * s % m else: return a * powm(a, n - 1, m) % m # --------------------------------------iye ha power ka zindegi--------------------------------- def sort_list(list1, list2): zipped_pairs = zip(list2, list1) z = [x for _, x in sorted(zipped_pairs)] return z # --------------------------------------------------product---------------------------------------- def product(l): por = 1 for i in range(len(l)): por *= l[i] return por # --------------------------------------------------binary---------------------------------------- def binarySearchCount(arr, n, key): left = 0 right = n - 1 count = 0 while (left <= right): mid = int((right + left) / 2) # Check if middle element is # less than or equal to key if (arr[mid] < key): count = mid + 1 left = mid + 1 # If key is smaller, ignore right half else: right = mid - 1 return count # --------------------------------------------------binary---------------------------------------- def countdig(n): c = 0 while (n > 0): n //= 10 c += 1 return c def binary(x, length): y = bin(x)[2:] return y if len(y) >= length else "0" * (length - len(y)) + y def countGreater(arr, n, k): l = 0 r = n - 1 # Stores the index of the left most element # from the array which is greater than k leftGreater = n # Finds number of elements greater than k while (l <= r): m = int(l + (r - l) / 2) if (arr[m] >= k): leftGreater = m r = m - 1 # If mid element is less than # or equal to k update l else: l = m + 1 # Return the count of elements # greater than k return (n - leftGreater) # --------------------------------------------------binary------------------------------------ class BinaryTrie: class Node: def __init__(self, bit: bool = False): self.bit = bit # Stores the current bit (False if 0, True if 1) self.children = [] self.count = 0 # stores number of keys finishing at this bit self.counter = 1 # stores number of keys with this bit as prefix def __init__(self, size): self.root = BinaryTrie.Node() self.size = size # Maximum size of each key def convert(self, key): """Converts key from string/integer to a list of boolean values!""" bits = [] if isinstance(key, int): key = bin(key)[2:] if isinstance(key, str): for i in range(self.size - len(key)): bits += [False] for i in key: if i == "0": bits += [False] else: bits += [True] else: return list(key) return bits def add(self, key): """Add a key to the trie!""" node = self.root bits = self.convert(key) for bit in bits: found_in_child = False for child in node.children: if child.bit == bit: child.counter += 1 node = child found_in_child = True break if not found_in_child: new_node = BinaryTrie.Node(bit) node.children.append(new_node) node = new_node node.count += 1 def remove(self, key): """Removes a key from the trie! If there are multiple occurences, it removes only one of them.""" node = self.root bits = self.convert(key) nodelist = [node] for bit in bits: for child in node.children: if child.bit == bit: node = child node.counter -= 1 nodelist.append(node) break node.count -= 1 if not node.children and not node.count: for i in range(len(nodelist) - 2, -1, -1): nodelist[i].children.remove(nodelist[i + 1]) if nodelist[i].children or nodelist[i].count: break def query(self, prefix, root=None): """Search for a prefix in the trie! Returns the node if found, otherwise 0.""" if not root: root = self.root node = root if not root.children: return 0 for bit in prefix: bit_not_found = True for child in node.children: if child.bit == bit: bit_not_found = False node = child break if bit_not_found: return 0 return node #--------------------------------------------trie------------------------------------------------- class TrieNode: # Trie node class def __init__(self): self.children = [None] * 26 self.data=0 self.isEndOfWord = False class Trie: # Trie data structure class def __init__(self): self.root = self.getNode() def getNode(self): # Returns new trie node (initialized to NULLs) return TrieNode() def _charToIndex(self, ch): # private helper function # Converts key current character into index # use only 'a' through 'z' and lower case return ord(ch) - ord('a') def insert(self, key,val): pCrawl = self.root length = len(key) for level in range(length): index = self._charToIndex(key[level]) # if current character is not present if not pCrawl.children[index]: pCrawl.children[index] = self.getNode() pCrawl = pCrawl.children[index] pCrawl.data+=val pCrawl.isEndOfWord = True def search(self, key): # Search key in the trie # Returns true if key presents # in trie, else false pCrawl = self.root length = len(key) c=0 for level in range(length): index = self._charToIndex(key[level]) if not pCrawl.children[index]: return False pCrawl = pCrawl.children[index] return pCrawl!=None def present(self, key): ans=0 pCrawl = self.root length = len(key) c=0 for level in range(length): index = self._charToIndex(key[level]) if not pCrawl.children[index]: return False pCrawl = pCrawl.children[index] ans+=pCrawl.data if pCrawl!=None: return ans return -1 #----------------------------------trie---------------------------- for ik in range(int(input())): n=int(input()) l=list(map(int,input().split())) l.sort() f=0 for i in range(2,n): if l[i-1]+l[i-2]<=l[-1]: print(i-1,i,n) f=1 break if f==0: print(-1)
7
PYTHON3
import sys input = sys.stdin.readline for kek 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 bisect import bisect_left for _ in range(int(input())): N = int(input()) X = list(map(int, input().split())) Index = bisect_left(X, X[0] + X[1]) print(-1 if Index == N else "1 2 " + str(Index+1)) # New Start
7
PYTHON3
t=int(input()) while(t): n=int(input()) l=list(map(int,input().split())) a=l[0]+l[1] b=l[-1] if(a<=b): print(1,2,n) else: print(-1) t-=1
7
PYTHON3
for _ in range(int(input())): n,a = int(input()),list(map(int,input().split())) print(1,2,n) if a[0]+a[1] <= a[-1] else print(-1)
7
PYTHON3
import sys;input=sys.stdin.readline T, = map(int, input().split()) for _ in range(T): N, = map(int, input().split()) X = list(map(int, input().split())) if X[0]+X[1]<=X[-1]: print(1, 2, N) else: print(-1)
7
PYTHON3
def ans(n,A): if A[0]+A[1]>A[-1]: return [-1] else: return [1,2,n] t=int(input()) L=[] for i in range(t): n=int(input()) A=[int(x) for x in input().split()] L.append(ans(n,A)) for l in L: for w in l: print(w,end=' ') print()
7
PYTHON3
for _ in range(int(input())): n = int(input()) a = list(map(int, input().split())) flag = True temp = a[0] + a[1] x = 1 y = 2 for i in range(2, n): if temp <= a[i]: print(x, y, i+1) flag = False break if flag: print(-1)
7
PYTHON3
import sys #another one inp=sys.stdin.buffer.readline read=lambda typ=int: [typ(x) for x in inp().split()] input=lambda : inp().decode().strip() _T_,=read() for _t_ in range(_T_): n,=read() a=read() 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()) l=list(map(int,input().split())) f=0 a,b=l[0],l[1] for i in range(2,n): if a+b<=l[i]: f=1 break if f==1: print(1,2,i+1) else: print(-1)
7
PYTHON3
for _ in range(int(input())): n=int(input()) a=[int(o) for o in input().split()] if a[0]+a[1]<=a[-1]: print(1,2,n) else: print(-1)
7
PYTHON3
for _ in range(int(input())): n = int(input()) alst = list(map(int, input().split())) if alst[0] + alst[1] > alst[-1]: print(-1) else: print(1, 2, n)
7
PYTHON3
#include <bits/stdc++.h> using namespace std; int main() { int t; cin >> t; while (t--) { int n; cin >> n; int arr[n]; for (int i = 0; i < n; i++) { cin >> arr[i]; } if (arr[0] + arr[1] <= arr[n - 1]) { cout << "1 2 " << n << "\n"; } else { cout << "-1" << "\n"; } } }
7
CPP
#include <bits/stdc++.h> const long long MOD = 1e9 + 7; using namespace std; int main() { int t; cin >> t; while (t--) { int n; cin >> n; long long arr[n]; for (int i = 0; i < n; ++i) cin >> arr[i]; if (arr[0] + arr[1] <= arr[n - 1]) cout << 1 << " " << 2 << " " << n << endl; else cout << -1 << endl; } return 0; }
7
CPP
# Anuneet Anand T = int(input()) while T: n = int(input()) A = list(map(int,input().split())) a = A[0] b = -1 c = A[n-1] k = -1 for i in range(1,n-1): if a+A[i]<=c: b = A[i] k = i+1 break if b>0: print(1,k,n) else: print(-1) T = T - 1
7
PYTHON3
import io import os import sys from collections import deque, defaultdict from itertools import accumulate inf = (1 << 65) def _input(): x = sys.stdin.readline() x = x.replace('\r', '') x = x.replace('\n', '') return x if 'STDINPUT' not in os.environ: input = _input else: print('Standard input') def solve(): n = int(input()) a = [int(x) for x in input().split()] x, y, c = a[0], a[1], a[-1] if x + y <= c: print(1, 2, n) else: print(-1) test_cases = True if test_cases: _q = int(input()) for _ in range(_q): solve() else: solve()
7
PYTHON3
#https://codeforces.com/contest/1398/problem/A t = int(input()) for i in range(t): n = int(input()) a = list(map(int, input().split())) if a[0]+a[1] <= a[n-1]: print("1 2 " + str(n)) else: print(-1)
7
PYTHON3
#include <bits/stdc++.h> using namespace std; const long long int modu = 1e9 + 7; int noofdig(int N) { return floor(log10(N)) + 1; } int bits_count(unsigned int u) { unsigned int uCount; uCount = u - ((u >> 1) & 033333333333) - ((u >> 2) & 011111111111); return ((uCount + (uCount >> 3)) & 030707070707) % 63; } long long int f(long long int a) { return 0; } void pre() {} void solve() { int n; cin >> n; vector<int> a(n); for (auto &t : a) cin >> t; if (a[0] + a[1] <= a[n - 1]) { cout << 1 << " " << 2 << " " << n << '\n'; return; } cout << -1 << '\n'; } int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int t = 1; cin >> t; while (t--) { solve(); } }
7
CPP
case = int(input()) for caseNum in range(0, case): n = int(input()) numberList = [int(x) for x in input().split()] if numberList[0] + numberList[1] > numberList[n-1]: print(-1) else: print(1, 2, n)
7
PYTHON3
for _ in range(int(input())): n=int(input()) a=list(int(num) for num in input().split()) ans=[1,2,n] if a[0]+a[1]>a[n-1]: print("-1") else: print(*ans)
7
PYTHON3
import math t = input() t = int(t) while t > 0: n = input() n = int(n) s = input() s = [int(x) for x in s.split()] if s[0] + s[1] > s[-1]: print(-1) else: print(1, 2, n) t -= 1
7
PYTHON3
t=int(input()) for _ in range(t): n=int(input()) x=list(map(int,input().split())) if x[0]+x[1]<=x[-1]: print(1,2,n) else: print(-1)
7
PYTHON3
cases = int(input()) for t in range(cases): n = int(input()) a = list(map(int,input().split())) p = a[0]+a[1] pos = -1 for i in range(2,n): if a[i]>=p: pos = i break if pos == -1: print(-1) else: print(1,2,pos+1)
7
PYTHON3
""" Perfection is achieved not when there is nothing more to add, but rather when there is nothing more to take away. """ import sys input = sys.stdin.readline # from bisect import bisect_left as lower_bound; # from bisect import bisect_right as upper_bound; # from math import ceil, factorial; def ceil(x): if x != int(x): x = int(x) + 1; return x; def factorial(x, m): val = 1 while x>0: val = (val * x) % m x -= 1 return val # 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); ## upper bound function code -- such that e in a[:i] e < x; def upper_bound(a, x, lo=0, hi = None): if hi == None: hi = len(a); while lo < hi: mid = (lo+hi)//2; if a[mid] < x: lo = mid+1; else: hi = mid; return lo; ## 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 ---------------- ################### from itertools import permutations def solve(): n = int(input()) a = list(map(int, input().split())) minim = a.index(min(a)) maxim = a.index(max(a)) ans = [minim + 1, maxim + 1] val = 0 for x in range(n): if x == minim or x == maxim: continue if a[minim] + a[x] <= a[maxim]: val = x + 1 break ans.append(val) if val == 0: print(-1) else: print(*list(sorted(ans))) if __name__ == '__main__': for _ in range(int(input())): solve() # fin_time = datetime.now() # print("Execution time (for loop): ", (fin_time-init_time))
7
PYTHON3
#include <bits/stdc++.h> using namespace std; const int MAXN = 5e4 + 5; int a[MAXN]; int main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); int t; cin >> t; while (t--) { int n; cin >> n; for (int i = 0; i < n; i++) { cin >> a[i]; } int sum = a[0] + a[1]; int c = -1; for (int i = 2; i < n; i++) { if (a[i] >= sum) { c = i; break; } } if (c == -1) { cout << c << endl; } else { cout << "1 2 " << c + 1 << endl; } } return 0; }
7
CPP
#include <bits/stdc++.h> using namespace std; int v[500005]; int main() { ios_base::sync_with_stdio(false); cin.tie(0); long long n, m, d, i, j, t; cin >> t; while (t--) { cin >> n; for (i = 1; i <= n; ++i) cin >> v[i]; if (v[1] + v[2] > v[n]) cout << -1 << '\n'; else cout << "1 2 " << n << '\n'; } return 0; }
7
CPP
#!/usr/bin/python3 import sys input = lambda: sys.stdin.readline().strip() for _ 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, len(a)) else: print(-1)
7
PYTHON3
t = int(input()) for i in range(t): s = int(input()) l=list(map(int,input().split())) if l[0]+l[1]>l[-1]: ans=[] for j in range(0,s-2): if l[j]+l[j+1]<=l[j+2]: ans=[j+1,j+2,j+3] break if ans==[]: print(-1) else: print(*ans) else: print(1,2,s)
7
PYTHON3
t=int(input()) for _ in range(t): n=int(input()) li=list(map(int,input().split())) val=False for i in range(2,n): if li[0]+li[1]<=li[i]: print(f'1 2 {i+1}') val=True break if not val: print(-1)
7
PYTHON3
t=int(input()) while t>0: n=int(input()) a=[int(x) for x in input().split()] flag=0 if a[0]+a[1]<=a[n-1]: flag=1 print(1,2,n) if flag==0: print("-1") t-=1
7
PYTHON3
for i in range(int(input())): n = int(input()) l = list(map(int,input().split())) t = l[0]+l[1] if l[-1] >= t: print(1,2,n) else: print(-1)
7
PYTHON3
num = int(input()) for n in range(num): num2 = int(input()) lis = list(map(int,input().split())) lis2 = lis[:] a = lis.index(min(lis)) numa = lis.pop(a) b = lis.index(min(lis)) numb = lis.pop(b) ch = True for i in lis2: if numa + numb <= i: print(1,2,lis2.index(i)+1) ch = False break if ch: print(-1)
7
PYTHON3
t = int(input()) while t: t-= 1 n = int(input()) ls = list(map(int, input().split())) flag = 0 for i in range(len(ls)-2): if ls[i]+ls[i+1]<=ls[n-1]: print(i+1, i+2, n) flag = 1 break if flag == 0: print(-1)
7
PYTHON3
for _ in range(int(input())): 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 def rs(): return sys.stdin.readline().rstrip() def ri(): return int(sys.stdin.readline()) def ria(): return list(map(int, sys.stdin.readline().split())) def ws(s): sys.stdout.write(s + '\n') def wi(n): sys.stdout.write(str(n) + '\n') def wia(a): sys.stdout.write(' '.join([str(x) for x in a]) + '\n') import math from collections import defaultdict for _ in range(ri()): n=ri() l=ria() x=l[0]+l[1] for i in range(2,n): if l[i]>=x: print(1,2,i+1) break else: print(-1)
7
PYTHON3
t=int(input()) for i in range(t): n=int(input()) l=list(map(int,input().split())) f=0 for j in range(2,n): if l[0]+l[1]<=l[j]: print(1,2,j+1,sep=' ') f=1 break if f==0: print(-1)
7
PYTHON3
def function(n, nums): if nums[0]+nums[1]<=nums[-1]: return f'{1} {2} {len(nums)}' else: return -1 if __name__=="__main__": t=int(input()) for k in range(t): n=int(input()) nums=list(map(int, input().rstrip().split())) print(function(n, nums))
7
PYTHON3
def check(a,b,c): l=[a,b,c] l.sort() if (l[0]+l[1])>l[2]: return False return True T=int(input()) for _ in range(T): n=int(input()) arr=list(map(int,input().split())) if n<=2: print(-1) continue if check(arr[0],arr[1],arr[-1]): print("%d %d %d"%(1,2,n)) else: print(-1)
7
PYTHON3
t=int(input()) for _ in range(t): n=int(input()) l=list(map(int,input().split())) maxx = max(l) minn = min(l) minn_ind = l.index(minn) minn2 = maxx for i in range(n): if i==minn_ind: continue if l[i]==minn: minn2 = minn minn2_ind = i break if l[i]<minn2: minn2 = l[i] minn2_ind = i if (minn+minn2)<=maxx: maxx_ind = l.index(maxx) temp = [minn_ind,minn2_ind,maxx_ind] temp.sort() for j in temp: print(j+1,end = ' ') print() continue print("-1")
7
PYTHON3
# import sys # 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[-1]: print(1,2,n) elif a[0]+a[-2]<=a[-1]: print(1,n-1,n) else: print(-1)
7
PYTHON3
for _ in range(int(input())): n=int(input()) a=list(map(int,input().split()))[:n] for i in range(n-2): if(a[0]+a[1]<=a[i+2]): print(1,2,i+3) d=0 break else: d=1 if(d==1): print('-1')
7
PYTHON3
from sys import* input= stdin.readline t=int(input()) for _ in range(t): n=int(input()) l=list(map(int,input().split())) c=0 a=l[0]+l[1] b=l[-1] if(a<=b): print(1,2,n) else: print(-1)
7
PYTHON3
for __ in range(int(input())): n=int(input()) l=list(map(int,input().split())) n=len(l) if (l[0]+l[1])<=l[-1]: print(1, 2, n) else: print(-1)
7
PYTHON3
for _ in range(int(input())): n = int(input()) A = [int(a) for a in input().split()] i, j, k = 1, 2, n flag = True if A[0] + A[1] > A[n - 1]: flag = False if flag: print(i, j, k) else: print(-1)
7
PYTHON3
import io,os inp=io.BytesIO(os.read(0,os.fstat(0).st_size)).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
t = int(input()) for aaa in range(t): m = int(input()) a = [int(aaa) for aaa in input().split()] if a[0] + a[1] <= a[-1]: print(1,2,m) else: print(-1)
7
PYTHON3
import math import sys #####sorting a dictionary by the values##### def dict_sort(ans): ans=sorted(ans.items(),reverse=True,key=lambda kv:(kv[1])) ##### naive method for testing prime or not##### def is_prime(n): if n==1: return 0 for i in range(2,int(math.sqrt(n))+1): if n%i==0: return False return True #####greatest common divisor of two numbers##### def gcd(a,b): if b==0: return a return gcd(b,a%b) #####least common multiplyer of two numbers##### def lcm(a,b): return (a*b)//gcd(a,b) #####function that return all the letters##### def alphbates(): return "abcdefghijklmnopqrstuvwxyz" #####binary search##### def binary_search(ls,n,flag): low=0 hi=n-1 while(low<=hi): mid=(low+hi)//2 if ls[mid]==flag: return mid elif ls[mid]>flag: hi=mid-1 else: low=mid+1 return -1 #####taking an array/list as input##### def inp(): ls=list(map(int,input().split())) return ls #####taking multiple inputs##### def mult_inp(): return map(int,input().split()) #####Main function starts from here##### t=int(input()) for _i in range(t): n=int(input()) ls=inp() flag=ls[0]+ls[1] chk=0 for i in range(2,n): if flag<=ls[i]: print("1 2",i+1) chk=1 break if chk==0: print(-1)
7
PYTHON3
t=int(input()) for _ in range(t): n=int(input()) i=0 a=list(map(int,input().split())) if a[i]+a[i+1] <= a[-1]: print(i+1,i+2,n) else: print("-1")
7
PYTHON3
T=int(input()) for _ in range(T): N=int(input()) A=list(map(int,input().split())) last=A[-1] if A[0]+A[1]<=last: print(1,2,N) else: print(-1)
7
PYTHON3
from itertools import combinations def f(lst): if lst[0] + lst[1] <= lst[-1]: return ' '.join(map(str,(1, 2, len(lst)))) return -1 for _ in range(int(input())): input() print(f(list(map(int, input().split()))))
7
PYTHON3
from functools import reduce from collections import Counter import time import datetime def time_t(): print("Current date and time: " , datetime.datetime.now()) print("Current year: ", datetime.date.today().strftime("%Y")) print("Month of year: ", datetime.date.today().strftime("%B")) print("Week number of the year: ", datetime.date.today().strftime("%W")) print("Weekday of the week: ", datetime.date.today().strftime("%w")) print("Day of year: ", datetime.date.today().strftime("%j")) print("Day of the month : ", datetime.date.today().strftime("%d")) print("Day of week: ", datetime.date.today().strftime("%A")) def ip(): return int(input()) def sip(): return input() def mip(): return map(int,input().split()) def mips(): return map(str,input().split()) def lip(): return list(map(int,input().split())) def matip(n,m): lst=[] for i in range(n): arr = lip() lst.append(arr) return lst def factors(n): # find the factors of a number return list(set(reduce(list.__add__, ([i, n//i] for i in range(1, int(n**0.5) + 1) if n % i == 0)))) def minJumps(arr, n): #to reach from 0 to n-1 in the array in minimum steps jumps = [0 for i in range(n)] if (n == 0) or (arr[0] == 0): return float('inf') jumps[0] = 0 for i in range(1, n): jumps[i] = float('inf') for j in range(i): if (i <= j + arr[j]) and (jumps[j] != float('inf')): jumps[i] = min(jumps[i], jumps[j] + 1) break return jumps[n-1] def dic(arr): # converting list into dict of count return Counter(arr) t = ip() while t: t-=1 n = ip() arr = lip() k = 0 j = 1 a = arr[k] b = arr[j] flag = 0 for i in range(2,n): if a+b<=arr[i]: print(1,2,i+1) flag = 1 break if flag==0: print(-1)
7
PYTHON3
t=int(input()) for t in range(t): n=int(input()) l=list(map(int,input().split())) flag=0 ans=l[0]+l[1] for i in range(2,n): if ans<=l[i]: print(1,2,i+1) flag=1 break if flag==0: print(-1)
7
PYTHON3
q=int(input()) while q>0: q=q-1; n=int(input()) lst=[None]*n lst=list(map(int,input().split())) if lst[0]+lst[1]<=lst[-1]: print(1,2,n) else: print(-1)
7
PYTHON3
import sys input = sys.stdin.readline def prog(): for _ in range(int(input())): n = int(input()) a = list(map(int,input().split())) worked = False ans = [] if a[0] + a[1] <= a[n-1]: print(1,2,n) else: print(-1) prog()
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,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) else: print(1,2,n)
7
PYTHON3
import os import sys from io import BytesIO, IOBase def main(): pass # 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() def test(): n = int(input()) a = sorted(list(map(int, input().split()))) if a[0] + a[1] <= a[-1]: return f'{1} {2} {len(a)}' else: return -1 t = int(input()) for _ in range(t): print(test())
7
PYTHON3
q = int(input()) for _ in range(q): 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
f = lambda: map(int, input().split()) for _ in range(int(input())): n = input() a = list(f()) print(-1 if a[0]+a[1]>a[-1] else '1 2 '+str(n))
7
PYTHON3
t=int(input()) while(t): n=int(input()) l=[] l=list(map(int,input().split())) f=0 for i in range(len(l)-2): if l[i]+l[i+1]<=l[n-1]: f=1 break else: f=0 if f==0: print(-1) else: print(i+1,i+2,n) t-=1
7
PYTHON3
T = int(input()) res = list() for _ in range(T): n = int(input()) x = list(map(int, input().split())) if len(x) <= 2: res.append([-1]) continue a, b = x[0], x[1] ok = False for i in range(2, len(x)): if a + b <= x[i]: res.append([1, 2, i + 1]) ok = False break else: ok = True if ok: res.append([-1]) for i in res: if len(i) == 3: print(i[0], i[1], i[2]) else: print(i[0])
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 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
k = lambda: map(int, input().split()) for _ in range(int(input())): n = input() a = list(k()) print(-1 if a[0]+a[1]>a[-1] else '1 2 '+str(n))
7
PYTHON3
for _ in range(int(input())): n=int(input()) l=list(map(int,input().split())) l=[0]+l a=l[1] b=l[2] for i in range(2,n+1): c=l[i] if a+b<=c: print(1,2,i) break else: print(-1)
7
PYTHON3
for _ in range(int(input())): n = int(input()) l = list(map(int,input().split())) l.sort() if l[0] + l[1] > l[-1] and l[0] + l[-1] > l[1] and l[1] + l[-1] > l[0] : print(-1) else: print(1,2,n)
7
PYTHON3
t = int(input()) for _ in range(t): n = int(input()) a = [int(i) for i in input().split()] b = [] for i, val in enumerate(a): b.append((val, i)) b.sort() i = b[0][1] j = b[1][1] k = b[n-1][1] if a[k] < a[i] + a[j] and a[j] - a[i] < a[k]: print(-1) else: print(i+1, j+1, k+1)
7
PYTHON3
for _ in range(int(input())): n = int(input()) arr = list(map(int,input().split())) flag = True for index in range(n-2): if arr[index] + arr[index+1] <= arr[-1]: print(index+1,index+2,n) flag= False break if flag: print("-1")
7
PYTHON3
t = int(input()) for _ in range(t): n = int(input()) a = list(map(int,input().strip().split()))[:n] if a[0]+a[1]>a[n-1]: print(-1) else: print(1,2,n)
7
PYTHON3
s=int(input()) for i in range(s): n=int(input()) arr=list(map(int,input().split())) if(arr[0]+arr[1]<=arr[-1]): print(1,2,n) else: print(-1)
7
PYTHON3
n = int(input()) for i in range(n): a = int(input()) l = list(map(int,input().split())) if l[0]+l[1]>l[-1]:print(-1) else:print(1,2,a)
7
PYTHON3
#include <bits/stdc++.h> using namespace std; template <typename Arg1> void __f(const char* name, Arg1&& arg1) { cerr << name << " : " << arg1 << "\n"; } template <typename Arg1, typename... Args> void __f(const char* names, Arg1&& arg1, Args&&... args) { const char* comma = strchr(names + 1, ','); cerr.write(names, comma - names) << " : " << arg1 << " | "; __f(comma + 1, args...); } template <class T> ostream& operator<<(ostream& os, vector<T> V) { os << "[ "; for (auto v : V) os << v << " "; return os << "]"; } template <class T> ostream& operator<<(ostream& os, set<T> second) { os << "{ "; for (auto s : second) os << s << " "; return os << "}"; } template <class T> ostream& operator<<(ostream& os, unordered_set<T> second) { os << "{ "; for (auto s : second) os << s << " "; return os << "}"; } template <class L, class R> ostream& operator<<(ostream& os, pair<L, R> P) { return os << "(" << P.first << "," << P.second << ")"; } template <class L, class R> ostream& operator<<(ostream& os, map<L, R> M) { os << "{ "; for (auto m : M) os << "(" << m.first << ":" << m.second << ") "; return os << "}"; } template <class L, class R> ostream& operator<<(ostream& os, unordered_map<L, R> M) { os << "{ "; for (auto m : M) os << "(" << m.first << ":" << m.second << ") "; return os << "}"; } const long long mod = 1e9 + 7; inline long long add(long long x, long long y) { x += y; if (x >= mod) return x - mod; return x; } inline long long sub(long long x, long long y) { x -= y; if (x < 0) return x + mod; return x; } inline long long mul(long long x, long long y) { return (x * 1ll * y) % mod; } inline long long power(long long x, long long y) { long long ans = 1; while (y) { if (y & 1) ans = mul(ans, x); x = mul(x, x); y >>= 1; } return ans; } inline long long inv(long long x) { return power(x, mod - 2); } const long long maxn = 1e6 + 100; const long long INF = 1e16 + 7; const long long MXI = 2e5 + 5; const long double PI = acos((long double)-1); const long long xd[4] = {1, 0, -1, 0}, yd[4] = {0, 1, 0, -1}; void Code_karr_bsdk() { long long n, data; cin >> n; long long a, b, c; for (long long i = 1; i <= n; i++) { cin >> data; if (i == 1) a = data; if (i == 2) b = data; if (i == n) c = data; } if (a + b <= c) cout << "1 2 " << n << "\n"; else cout << "-1\n"; return; } int32_t main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); auto start = std::chrono::high_resolution_clock::now(); long long t = 1; cin >> t; while (t--) { Code_karr_bsdk(); } auto stop = std::chrono::high_resolution_clock::now(); auto duration = std::chrono::duration_cast<std::chrono::nanoseconds>(stop - start); return 0; }
7
CPP
#872 for _ 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
t=int(input()) for _ in range(t): n=int(input()) arr=[int(x) for x in input().split()] total=arr[0]+arr[1] j=0 for i in range(2,n): if arr[i] >= total: j=i+1 break if j == 0: print("-1") else: print('1 2',j)
7
PYTHON3
for i in " "*int(input()): n=int(input()) a=list(map(int,input().split()))[:n] print(*([1,2,n],[-1])[a[0]+a[1]>a[-1]])
7
PYTHON3
for _ in range(int(input())): n = int(input()) a = list(map(int,input().split(' '))) if a[0] + a[1] <= a[n-1]: print(1,2,n) else: print(-1)
7
PYTHON3
if __name__ == '__main__': T=int(input()) for t in range(T): n=int(input()) L=list(map(int,input().split())) b=0 d=L[n-1]-L[0] for i in range(1,n): if(L[i]<=d): print(str(1)+" "+str(i+1)+" "+str(n)) b=1 break if(b==0): print("-1")
7
PYTHON3
def ques1(n,a): if a[0] + a[1] <= a[-1]: print(1,2,n) else: print(-1) t = int(input()) for i in range(t): n = int(input()) a = [int(i) for i in input().split()] ans = ques1(n,a) ans
7
PYTHON3
import sys input=sys.stdin.readline T=int(input()) for _ in range(T): N=int(input()) A=list(map(int,input().split())) a=A[0] b=A[1] c=A[N-1] if (a + b <= c) or (a + c <= b) or (b + c <= a) : print(1,2,N) else: print(-1)
7
PYTHON3
t=int(input()) while t>0: t-=1 n=int(input()) l=list(map(int,input().split())) k=0 if l[0]+l[1]<=l[n-1]: print(1,2,n) else: print(-1)
7
PYTHON3
#include <bits/stdc++.h> using namespace std; int main() { int t = 0; cin >> t; while (t--) { int n; cin >> n; int a[n]; for (int i = 0; i < n; i++) { cin >> a[i]; } if (a[0] + a[1] <= a[n - 1]) { cout << 1 << " " << 2 << " " << n << "\n"; } else cout << -1 << "\n"; } }
7
CPP
#include <bits/stdc++.h> using namespace std; int dirx[] = {-1, -1, -1, 0, 0, 1, 1, 1}; int diry[] = {-1, 0, 1, -1, 1, -1, 0, 1}; vector<string> vec_splitter(string s) { s += ','; vector<string> res; while (!s.empty()) { res.push_back(s.substr(0, s.find(','))); s = s.substr(s.find(',') + 1); } return res; } void debug_out(vector<string> __attribute__((unused)) args, __attribute__((unused)) int idx, __attribute__((unused)) int LINE_NUM) { cerr << endl; } template <typename Head, typename... Tail> void debug_out(vector<string> args, int idx, int LINE_NUM, Head H, Tail... T) { if (idx > 0) cerr << ", "; else cerr << "Line(" << LINE_NUM << ") "; stringstream ss; ss << H; cerr << args[idx] << " = " << ss.str(); debug_out(args, idx + 1, LINE_NUM, T...); } int const lmt = 2e5 + 5; int a[lmt]; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int t; cin >> t; while (t--) { long long n; cin >> n; for (long long i = 0; i < n; i++) cin >> a[i]; if (a[0] + a[1] <= a[n - 1]) { cout << 1 << " "; cout << 2 << " "; cout << n << "\n"; } else { cout << -1 << "\n"; } } }
7
CPP
#include <bits/stdc++.h> #pragma GCC optimize("O2") #pragma GCC optimize("tree-vectorize") #pragma GCC target("sse4") using namespace std; using lint = long long; using pii = pair<int, int>; using pll = pair<lint, lint>; template <typename T> using vc = vector<T>; template <typename T> using vvc = vector<vector<T>>; template <typename T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; } template <typename T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; } constexpr lint ten(int n) { return n == 0 ? 1 : ten(n - 1) * 10; } class ABadTriangle { public: void solve(std::istream& in, std::ostream& out) { ios_base::sync_with_stdio(false); in.tie(nullptr), out.tie(nullptr); int tt; in >> tt; while (tt--) { int N; in >> N; vc<int> A(N); for (int i = (0); i < (N); ++i) in >> A[i]; if (A[0] + A[1] > A[N - 1]) out << "-1\n"; else out << 1 << ' ' << 2 << ' ' << N << '\n'; } } }; int main() { ABadTriangle solver; std::istream& in(std::cin); std::ostream& out(std::cout); solver.solve(in, out); return 0; }
7
CPP
import io import os from collections import Counter, defaultdict, deque def solve(N, A): a = A[0] b = A[1] c = A[-1] if a + b > c and a + c > b and b + c > a: return -1 return str(1) + ' ' + str(2) + ' ' + str(N) if __name__ == "__main__": input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline TC = int(input()) for tc in range(1, TC + 1): N, = [int(x) for x in input().split()] A = [int(x) for x in input().split()] ans = solve(N, A) print(ans)
7
PYTHON3
#dt = {} for i in x: dt[i] = dt.get(i,0)+1 import sys;input = sys.stdin.readline inp,ip = lambda :int(input()),lambda :[int(w) for w in input().split()] for _ in range(inp()): n = inp() x = ip() if x[0]+x[1] <= x[-1]: print(1,2,n) else: print(-1)
7
PYTHON3
n = int(input()) rez = [] for i in range(n): tmp = input() tmp = list(map(int, input().split())) if tmp[0] + tmp[1] <= tmp[-1]: rez.append(str(1) + " " + str(2) + " " +str(len(tmp))) else: rez.append(-1) for i in range(n): print(rez[i])
7
PYTHON3
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
def main(): t=int(input ()) for tt in range (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) main()
7
PYTHON3
#include <bits/stdc++.h> using namespace std; int main() { int t; cin >> t; while (t--) { int n; cin >> n; long long int a[n]; for (int i = 0; i < n; i++) { cin >> a[i]; } long long int i = 0; int flag = 0; while (i < n - 2) { long long int x, y, z; x = a[i]; y = a[i + 1]; z = a[n - 1]; if (z >= x + y) { cout << i + 1 << " " << i + 2 << " " << n << endl; flag = 1; break; } i++; } if (flag == 0) { cout << "-1" << endl; } } }
7
CPP
for u in range(int(input())): n=int(input()) l=list(map(int,input().split())) s=l[0]+l[1] f=0 for i in range(2,n): if(l[n-1]>=s): f=1 print(1,2,n) break if(f==0): print(-1)
7
PYTHON3
#!/usr/bin/pypy3 # import sys # sys.stdin = open("/home/vaibhav/python/input.txt", "r") # sys.stdout = open("/home/vaibhav/python/output.txt", "w") 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
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
t = int(input()) for p 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