solution
stringlengths 11
983k
| difficulty
int64 0
21
| language
stringclasses 2
values |
---|---|---|
for _ in range(int(input())):
n = int(input())
a = list(map(int,input().split()))
if a[-1] >= (a[0] + a[1]):
print(1,2,n)
else:
print(-1) | 7 | PYTHON3 |
for _ in range(int(input())):
n=int(input())
ar=list(map(int,input().split()))
count=1
for i in range(2,n):
if ar[i]>=ar[0]+ar[1]:
print(1,2,i+1)
count=0
break
if count==1:
print(-1) | 7 | PYTHON3 |
t=int(input())
for i in range(t):
n=int(input())
a=list(map(int,input().split()))
x=a[0]
y=a[1]
z=a[-1]
c=len(a)
if(x+y>z):
print(-1)
else:
print(1,2,c) | 7 | PYTHON3 |
t=int(input())
## sum of two sides is greater than theird side
## 4 6 9 10 18
for _ in range(t):
n=int(input())
a=[int(x) for x in input().split()]
tr=0
for i in range(0,n-2):
s=a[i]+a[i+1]
if s<=a[n-1]:
b=[i,i+1,n-1]
tr=1
break
if tr==1:
print(b[0]+1,b[1]+1,b[2]+1)
else:
print("-1")
| 7 | PYTHON3 |
t=int(input())
for _ in range(t):
n=int(input())
a=list(map(int,input().split()))
a.sort()
s=a[0]+a[1]
flag=0
for i in range(2,n):
if a[i]>=s:
flag=1
break
if flag:
print(1,2,i+1)
else:
print(-1) | 7 | PYTHON3 |
test=int(input())
for t in range(0,test):
n=int(input())
lst=[int(x) for x in input().split()]
if lst[n-1]>=(lst[0]+lst[1]):
print(1,2,n)
else :
print(-1) | 7 | PYTHON3 |
#include <bits/stdc++.h>
using namespace std;
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
;
int t;
cin >> t;
while (t--) {
int n;
cin >> n;
long long int a[n], b[n];
for (int i = 0; i < n; i++) {
cin >> a[i];
b[i] = a[i];
}
sort(a, a + n);
int d[3];
d[0] = d[1] = d[2] = -1;
if (a[0] + a[1] > a[n - 1])
cout << "-1" << endl;
else {
for (int i = 0; i < n; i++) {
if (b[i] == a[0] && d[0] == -1 && d[1] != i && d[2] != i) d[0] = i;
if (b[i] == a[1] && d[0] != i && d[2] != i && d[1] == -1) d[1] = i;
if (b[i] == a[n - 1] && d[0] != i && d[1] != i && d[2] == -1) d[2] = i;
}
sort(d, d + 3);
cout << d[0] + 1 << " " << d[1] + 1 << " " << d[2] + 1 << endl;
}
}
return 0;
}
| 7 | CPP |
from collections import defaultdict as dd
from collections import deque
import bisect
import heapq
def ri():
return int(input())
def rl():
return list(map(int, input().split()))
def solve():
n = ri()
A = rl()
L = [[a, i + 1] for i, a in enumerate(A)]
L.sort()
if L[0][0] + L[1][0] <= L[-1][0]:
print (L[0][1], L[1][1], L[-1][1])
else:
print (-1)
mode = 'T'
if mode == 'T':
t = ri()
for i in range(t):
solve()
else:
solve()
| 7 | PYTHON3 |
for query in range(int(input())):
n=int(input())
b=input().split()
a=[]
for x in range(n):
a.append((int(b[x]),x+1))
a=sorted(a)
if a[0][0]+a[1][0]<=a[n-1][0]:
print(str(a[0][1])+" "+str(a[1][1])+" "+str(a[n-1][1]))
else:
print(-1)
| 7 | PYTHON3 |
# ------------------- fast io --------------------
import os
import sys
from io import BytesIO, IOBase
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")
# ------------------- fast io --------------------
for j in range(int(input())):
n=int(input());vals=list(map(int,input().split()))
a,b,c=vals[0],vals[1],vals[-1]
if a+b<=c:
print(1,2,n)
else:
print(-1) | 7 | PYTHON3 |
from sys import stdin
inp = lambda : stdin.readline().strip()
t = int(inp())
for _ in range(t):
n = int(inp())
a= [int(x) for x in inp().split()]
for i in range(2,n):
if a[i] >= a[0]+a[1]:
print(1,2,i+1)
break
else:
print(-1) | 7 | PYTHON3 |
t = int(input())
while t:
n = int(input())
a = list(map(int, input().split()))
if a[0] + a[1] > a[-1]:
print(-1)
else:
print(1, 2, n)
t -= 1
| 7 | PYTHON3 |
for z 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())
sol = []
for i in range(t):
n = int(input())
l = list(map(int, input().split()))
j = l.copy()
x = min(j)
j.remove(x)
y = min(j)
z = max(j)
if x + y <= z:
if x == y:
x = l.index(x) + 1
l.remove(y)
y = l.index(y) + 2
z = l.index(z) + 2
else:
x = l.index(x) + 1
y = l.index(y) + 1
z = l.index(z) + 1
sol.append(str(x) + " " + str(y) + " " + str(z))
else:
sol.append("-1")
for i in sol:
print(i)
| 7 | PYTHON3 |
def trian(arr):
if(arr[0]+arr[1]>arr[-1]):
print(-1)
else:
print(1,2,len(arr))
t=int(input())
for i in range(t):
n=int(input())
arr=list(map(int,input().split()))
(trian(arr))
| 7 | PYTHON3 |
t=int(input())
while t!=0:
t-=1
n=int(input())
l=list(map(int,input().split()))
fl=1
if l[0]+l[1]<=l[-1]:
print("1 2",n)
else:
print("-1")
| 7 | PYTHON3 |
t = int(input())
for _ in range(t):
n = int(input())
lst = [int(c) for c in input().split()]
if lst[0] + lst[1] > lst[-1]:
print(-1)
else:
print(1, 2, n)
| 7 | PYTHON3 |
for t 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 = int(input())
a = list(map(int,input().split()))
s = a[0]+a[1]
c = False
for i in range(2,n):
if s<=a[i]:
c = True
break
if c is True:
print(1,2,i+1)
else:
print(-1)
| 7 | PYTHON3 |
t=int(input())
for i in range(t):
n=int(input())
a=list(map(int,input().split()))
c=0
if(a[0]+a[1]>a[n-1]):
c+=1
if(a[n-1]+a[0]>a[1]):
c+=1
if(a[n-1]+a[1]>a[0]):
c+=1
if(c==3):
print("-1")
else:
print(1,2,n)
| 7 | PYTHON3 |
#!/usr/bin/env python
import os
import re
import sys
from bisect import bisect, bisect_left, insort, insort_left
from collections import Counter, defaultdict, deque
from copy import deepcopy
from decimal import Decimal
from fractions import gcd
from io import BytesIO, IOBase
from itertools import (
accumulate, combinations, combinations_with_replacement, groupby,
permutations, product)
from math import (
acos, asin, atan, ceil, cos, degrees, factorial, hypot, log2, pi, radians,
sin, sqrt, tan)
from operator import itemgetter, mul
from string import ascii_lowercase, ascii_uppercase, digits
def inp():
return(int(input()))
def inlist():
return(list(map(int, input().split())))
def instr():
s = input()
return(list(s[:len(s)]))
def invr():
return(map(int, input().split()))
def main():
t = inp()
for _ in range(t):
n = inp()
d = inlist()
a = d[0]
b = d[1]
c = d[-1]
if a + b > c and a + c > b and b + c > a:
print(-1)
else:
print(1, 2, n)
if __name__ == "__main__":
main()
| 7 | PYTHON3 |
t = int(input())
for _ in range(t):
n = int(input())
a = list(map(int,input().split()))
i = 0
k = n-1
f = False
while i+1<n and i+1<k:
j = i+1
while j<k and a[i]+a[j]>a[k]:
k-=1
if j<k and (not a[i]+a[j]>a[k]):
print(i+1,j+1,k+1)
break
i+=1
else:
print(-1) | 7 | PYTHON3 |
from bisect import *
T = int(input())
for i in range(T):
N = int(input())
A = list(map(int, input().split()))
for i in range(N-2):
if A[i]+A[i+1]>A[-1]:
continue
print(i+1,i+2,N)
break
else:
print(-1) | 7 | PYTHON3 |
#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }
long long lcm(long long a, long long b) { return (a / gcd(a, b)) * b; }
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
long long t;
cin >> t;
while (t--) {
long long n;
cin >> n;
vector<long long> a(n);
long long c = 0, c1 = 0;
long long sum = 0;
for (int i = 0; i < n; i++) {
cin >> a[i];
}
if (a[n - 1] >= (a[0] + a[1])) {
cout << 1 << " " << 2 << " " << n << endl;
} else {
cout << -1 << endl;
}
}
return 0;
}
| 7 | CPP |
def check(n):
i = 0
mi = n[2]
ma = n[-1]
while i <= len(n)-3:
a = n[i]
b = n[i+1]
c = n[i+2]
if a + b <= ma:
return [i, i+1, len(n)-1]
elif a + b <= c:
return [i, i+1, i+2]
i+=1
return [-1]
for _ in range(int(input())):
k = int(input())
l = list(map(int, input().split(' ')))
o = check(l)
if len(o) == 1:
print(-1)
else:
for k in o:
print(k+1, end=' ')
print() | 7 | PYTHON3 |
for t in range(int(input())):
n = int(input())
nums = list(map(int,input().split()))
a = sorted(nums)
a1 = 0
a2 = 0
a3 = 0
if (a[0] + a[1] <= a[n-1]):
c = 0
for i in range(n):
if (nums[i] == a[0] and a1 == 0):
a1 = 1
c += 1
print(i+1,end=" ")
elif (nums[i] == a[1] and a2 == 0):
a2 = 1
c += 1
print(i + 1, end=" ")
elif (nums[i] == a[n-1] and a3 == 0):
a3 = 1
c += 1
print(i + 1, end=" ")
if (c == 3):
print()
break
else:
print("-1")
| 7 | PYTHON3 |
#include <bits/stdc++.h>
using namespace std;
int32_t main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
long long t;
cin >> t;
while (t--) {
long long n;
cin >> n;
long long a[n];
for (long long i = 0; i < n; i++) cin >> a[i];
if (a[0] + a[1] <= a[n - 1])
cout << "1 2 " << n << "\n";
else
cout << "-1"
<< "\n";
}
return 0;
}
| 7 | CPP |
#include <bits/stdc++.h>
using namespace std;
const int sz = 1e5 + 5;
int n, cut, a[sz], dp[sz];
void solve() {
int n;
scanf("%d", &n);
for (int i = 0; i < n; i++) scanf("%d", &a[i]);
if (a[0] + a[1] <= a[n - 1])
printf("1 2 %d\n", n);
else
puts("-1");
}
int main() {
int t;
cin >> t;
while (t--) solve();
}
| 7 | CPP |
def nextInt():
return int(input())
def intArr():
arr = input().split(" ")
return [int(x) for x in arr]
t = nextInt()
ans = []
for tt in range(t):
length = nextInt()
a = []
s = intArr()
cur = s.pop()
if cur-s[0] <= 1:
ans.append(-1)
elif cur - (s[0]+s[1]) < 0:
ans.append(-1)
else:
ans.append("1 2 {}".format(len(s)+1))
for x in ans:
print(x)
| 7 | PYTHON3 |
t = int(input())
def check(a, j):
for i in range(n-1,j,-1):
if arr[i] > a:
return [True,i]
return [False, -1]
while t:
n = int(input())
arr = list(map(int, input().split()))
if arr[0] + arr[1] <= arr[n-1]:
print(1, 2, n)
else:
print("-1")
t-=1 | 7 | PYTHON3 |
from sys import stdin, stdout
import math,sys,heapq
from itertools import permutations, combinations
from collections import defaultdict,deque,OrderedDict
from os import path
import bisect as bi
def yes():print('YES')
def no():print('NO')
if (path.exists('input.txt')):
#------------------Sublime--------------------------------------#
sys.stdin=open('input.txt','r');sys.stdout=open('output.txt','w');
def I():return (int(input()))
def In():return(map(int,input().split()))
else:
#------------------PYPY FAst I/o--------------------------------#
def I():return (int(stdin.readline()))
def In():return(map(int,stdin.readline().split()))
#sys.setrecursionlimit(1500)
def dict(a):
d={}
for x in a:
if d.get(x,-1)!=-1:
d[x]+=1
else:
d[x]=1
return d
def find_gt(a, x):
'Find leftmost value greater than x'
i = bi.bisect_right(a, x)
if i != len(a):
return i
else:
return -1
def main():
try:
n=I()
l=list(In())
ans=-1
for x in range(2,n):
if l[0]+l[1]<=l[x]:
ans=x
break
if ans==-1:
print(-1)
else:
print(1,2,ans+1)
except:
pass
M = 998244353
P = 1000000007
if __name__ == '__main__':
for _ in range(I()):main()
#for _ in range(1):main()
| 7 | PYTHON3 |
#include <bits/stdc++.h>
using namespace std;
void IO() {
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
}
template <typename... T>
void read(T&... args) {
((cin >> args), ...);
}
template <typename... T>
void write(T&&... args) {
((cout << args << " "), ...);
}
int mpow(int, int);
long long int n;
void solve() {
read(n);
int a[n];
for (int i = 0; i < n; i += 1) read(a[i]);
int a1 = a[0];
int b = a[1];
int c = a[n - 1];
if ((a1 + b) <= c) {
write(1, 2, n);
} else {
cout << -1;
}
cout << "\n";
}
int main() {
IO();
int t = 1;
cin >> t;
while (t--) {
solve();
}
return 0;
}
int mpow(int base, int exp) {
base %= 1000000007;
int result = 1;
while (exp > 0) {
if (exp & 1) result = ((long long int)result * base) % 1000000007;
base = ((long long int)base * base) % 1000000007;
exp >>= 1;
}
return result;
}
| 7 | CPP |
t = int(input())
for _ in range(t):
n = int(input())
ls = list(map(int, input().split()))
if ls[0] + ls[1] <= ls[-1]:
print(1, 2, n)
else:
print(-1) | 7 | PYTHON3 |
t = int(input())
for _ 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 |
#include <bits/stdc++.h>
using namespace std;
template <class T>
bool ckmin(T& a, const T& b) {
return a > b ? a = b, true : false;
}
template <class T>
bool ckmax(T& a, const T& b) {
return a < b ? a = b, true : false;
}
template <typename T>
struct IsC {
template <typename C>
static char test(typename C::const_iterator*);
template <typename C>
static int test(...);
static const bool value = sizeof(test<T>(0)) == sizeof(char);
};
template <>
struct IsC<string> {
static const bool value = false;
};
template <typename C>
typename enable_if<IsC<C>::value, ostream&>::type operator<<(ostream&,
const C&);
template <typename T1, typename T2>
ostream& operator<<(ostream&, const pair<T1, T2>&);
template <typename... T>
using TS = tuple_size<tuple<T...>>;
template <size_t idx, typename... T>
typename enable_if<TS<T...>::value == idx + 1, ostream&>::type operator<<(
ostream& o, const tuple<T...>& t) {
return o << ", " << get<idx>(t) << ')';
}
template <size_t idx, typename... T>
typename enable_if<0 < idx && idx + 1 < TS<T...>::value, ostream&>::type
operator<<(ostream& o, const tuple<T...>& t) {
return operator<<<idx + 1>(o << ", " << get<idx>(t), t);
}
template <size_t idx = 0, typename... T>
typename enable_if<1 < TS<T...>::value && !idx, ostream&>::type operator<<(
ostream& o, const tuple<T...>& t) {
return operator<<<idx + 1>(o << '(' << get<idx>(t), t);
}
template <typename T>
ostream& operator<<(ostream& o, const tuple<T>& t) {
return o << get<0>(t);
}
template <typename T1, typename T2>
ostream& operator<<(ostream& o, const pair<T1, T2>& p) {
return o << make_tuple(p.first, p.second);
}
template <typename C>
typename enable_if<IsC<C>::value, ostream&>::type operator<<(ostream& o,
const C& c) {
o << '[';
for (auto it = c.cbegin(); it != c.cend(); ++it)
o << *it << (next(it) != c.cend() ? ", " : "");
return o << ']';
}
template <typename T>
void tprint(vector<vector<T>>& v, size_t width = 0, ostream& o = cerr) {
if (!0) return;
for (const auto& vv : v) {
for (const auto& i : vv) o << setw(width) << i;
o << '\n';
}
}
void solve() {
int n;
cin >> n;
int a, b, c;
cin >> a >> b;
for (auto i = (0); (i) < ((n - 2)); ++(i)) cin >> c;
if (a + b <= c)
cout << 1 << ' ' << 2 << ' ' << n << '\n';
else
cout << -1 << '\n';
}
int main() {
cin.tie(0);
ios_base::sync_with_stdio(0);
int tc = 1;
cin >> tc;
for (auto i = (1); (i) < (tc + 1); ++(i)) {
solve();
}
}
| 7 | CPP |
n = int(input())
for i in range(n):
m = input()
lst1 = list(map(int,input().split()))
lst2 = sorted(lst1)
if lst2[0]+lst2[1]<=lst2[-1]:
x = lst1.index(lst2[0])+1
y = lst1.index(lst2[1])+1
z = lst1.index(lst2[-1])+1
if x==y:
print(f"{x} {y+1} {z}")
else:
print(f"{x} {y} {z}")
else:
print(-1)
| 7 | PYTHON3 |
#BINOD
import math
test = int(input())
for t in range(test):
n = int(input())
A = list(map(int,input().split()))
a = A[0]+A[1]
if(A[-1]>=a):
print(1,2,n)
else:
print("-1")
#Binod | 7 | PYTHON3 |
#include <bits/stdc++.h>
using namespace std;
int main() {
long long int t;
cin >> t;
while (t--) {
long long int n;
cin >> n;
vector<long long int> a(n);
for (long long int i = 0; i < n; i++) cin >> a[i];
sort(a.begin(), a.end());
if (a[0] + a[1] <= a[n - 1])
cout << "1 2 " << n << endl;
else {
cout << "-1" << endl;
}
}
}
| 7 | CPP |
#include <bits/stdc++.h>
using namespace std;
int main() {
int t, n;
bool possible;
long long a1[100000];
cin >> t;
for (int i = 0; i < t; i++) {
cin >> n;
possible = false;
for (int j = 0; j < n; j++) {
cin >> a1[j];
}
for (int j = 2; j < n; j++) {
if (a1[j] >= a1[0] + a1[1]) {
possible = true;
cout << 1 << " " << 2 << " " << j + 1 << endl;
break;
}
}
if (possible == false) cout << -1 << endl;
}
return 0;
}
| 7 | CPP |
t = int(input())
for _ in range(t):
n = int(input())
a = list(map(int,input().split()))
if(a[0]+a[1] <= a[-1]):
print(1,2,n)
else:
print(-1) | 7 | PYTHON3 |
t = int(input())
#for each test cases
for i in range(t):
n=int(input())
q=list(map(int,input().split()))
if (q[0]+q[1]<=q[len(q)-1]):
print("1 2 "+str(len(q)))
else:
print("-1") | 7 | PYTHON3 |
for _ in range(int(input())):
n=int(input())
l=list(map(int,input().split()))
if l[0]+l[1]<=l[-1]:
print("1 2 "+str(n))
else:
print(-1) | 7 | PYTHON3 |
T = int(input())
for t in range(T):
n = int(input())
A = [int(i) for i in input().split()]
if A[0] + A[1] > A[-1]:
print(-1)
else:
print(1,2,n) | 7 | PYTHON3 |
# Om Namh Shivai
# Jai Shree Ram
# Radhe Krishna
# Jai BajrangBali
# Jai Maa Durga
# Jai Maa Kali
for _ in range(int(input())):
n = int(input())
arr = list(map(int, input().split()))
sa= arr
status = 0
result = list()
c = arr[len(arr)-1]
b = arr[0]
a = arr[1]
if(a+b <= c):
index1 = arr.index(a)+1
index2 = arr.index(b)+1
index3 = arr.index(c)+1
print(1,2,len(arr))
else:
print(-1) | 7 | PYTHON3 |
for _ in range(int(input())):
n=int(input())
arr=[int(i) for i in input().split()]
if arr[0]+arr[1]<=arr[-1]:
print(1,2,len(arr))
else:
print(-1) | 7 | PYTHON3 |
t=int(input())
for i in range(t):
n=int(input())
arr=list(map(int,input().split()))
if arr[0]+arr[1]<=arr[-1]:
print(1,2,n)
else:
print(-1)
| 7 | PYTHON3 |
for _ in range(int(input())):
n = int(input())
arr = list(map(int, input().split()))
if arr[-1] < arr[0] + arr[1]:
print(-1)
else:
print(1, 2, n)
| 7 | PYTHON3 |
def triangle(A):
n=len(A)
z=A[-1]
x=A[0]
y=A[1]
if x+y>z:
print(-1)
else:
print(1,2,n)
t=int(input())
for i in range(t):
n=int(input())
A=[int(z) for z in input().split()][:n]
triangle(A) | 7 | PYTHON3 |
t = int(input())
for _ in range (t):
n = int(input())
A = list(map(int, input().split()))
if A[0]+A[1] <= A[-1]:
print (1, 2, n)
else:
print (-1)
| 7 | PYTHON3 |
#include <bits/stdc++.h>
using namespace std;
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
int t;
cin >> t;
while (t--) {
int n;
cin >> n;
int a[n + 1];
for (int i = 1; i <= n; i++) {
cin >> a[i];
}
if (a[n] >= a[1] + a[2]) {
cout << 1 << " " << 2 << " " << n << endl;
} else {
cout << -1 << endl;
}
}
}
| 7 | CPP |
#include <bits/stdc++.h>
using namespace std;
int main() {
ios::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
int t;
cin >> t;
while (t--) {
long long int n, temp = 0;
cin >> n;
vector<long long int> a(n);
for (long long int i = 0; i < n; i++) cin >> a[i];
if (a[0] + a[1] <= a[n - 1]) {
cout << 1 << " " << 2 << " " << n << "\n";
temp = 1;
}
if (temp == 0) cout << -1 << "\n";
}
}
| 7 | CPP |
t=int(input())
for i in range(t):
n,a=int(input()),list(map(int,input().split()))
if(a[0]+a[1]<=a[-1]):
print(1,2,n)
else:
print(-1) | 7 | PYTHON3 |
import math
from itertools import combinations
from collections import Counter
t = int(input())
for _ in range(t):
n = int(input())
# a,b = map(int, input().split())
a = list(map(int, input().split()))
f = 0
x = [1,2]
for i in range(2,len(a)):
if a[x[0]-1] + a[x[1]-1] <= a[i]:
x.append(i+1)
f = 1
break
if f:
for i in sorted(x):
print(i,end=" ")
print()
else:
print(-1)
| 7 | PYTHON3 |
import sys #another one
inp=sys.stdin.buffer.readline
read=lambda: [int(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 |
import sys
input = sys.stdin.readline
############ ---- Input Functions ---- ############
def inp():
return(int(input()))
def inlt():
return(list(map(int,input().split())))
def insr():
s = input()
return(list(s[:len(s)]))
def invr():
return(map(int,input().split()))
t = inp()
for testcase in range(t):
c = True
n = inp()
s = inlt()
i = 0
j = 1
it = s[0]+s[1]
for k in range(2, n):
if s[k] >= it:
print(1, 2, k+1)
c = False
break
if not c:
continue
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);
long long t;
cin >> t;
while (t--) {
long long n, flag = 0;
cin >> n;
long long m[n], a[n], i;
for (int i = 1; i <= n; i++) cin >> m[i];
if (m[1] + m[2] <= m[n])
cout << "1 2 " << n << endl;
else
cout << "-1" << endl;
}
return 0;
}
| 7 | CPP |
#include <bits/stdc++.h>
using namespace std;
using PII = pair<long long, long long>;
const int maxn = 1e5 + 5;
const long long mod = 1e9 + 7;
int a[maxn];
int main() {
ios::sync_with_stdio(false);
cin.tie(0), cout.tie(0);
int T = 1;
cin >> T;
while (T--) {
int n;
cin >> n;
for (int i = 1; i <= n; i++) {
cin >> a[i];
}
if (a[1] + a[2] > a[n])
cout << -1 << '\n';
else
cout << "1 2 " << n << '\n';
}
}
| 7 | CPP |
for _ in range(int(input())):
n = int(input())
lis = list(map(int, input().split()))
if lis[0] + lis[1] <= lis[-1]:
print(1,2,n)
else:
print(-1) | 7 | PYTHON3 |
t=int(input())
for j in range(t):
n=int(input())
list1=list(map(int,input().split(" ")))
a=0
b=1
ct=0
for i in range(2,n):
if list1[i]>=list1[a]+list1[b]:
print(a+1,b+1,i+1)
ct+=1
break
if not ct:
print(-1)
| 7 | PYTHON3 |
test_cases = int(input())
for _ in range(test_cases):
n = int(input())
nums = list(map(int, input().split()))
if nums[0]+nums[1] > nums[-1]:
print("-1")
else:
print(1,2,n) | 7 | PYTHON3 |
t = int(input())
for _ in range(t):
n = input()
lst = list(map(int,input().split()))
if lst[0] + lst[1] > lst[-1]:
print("-1")
else:
print("1 2 " + n) | 7 | PYTHON3 |
test_cases=int(input())
for test_case in range(test_cases):
n=int(input())
a = list(map(int, input().split()))
sum=0
c=0
for i in range(n-2):
sum=a[i]+a[i+1]
if a[-1]>=sum:
c=1
break
sum=0
if c==0:
print('-1')
else:
print(i+1,i+2,n)
| 7 | PYTHON3 |
from math import *
from collections import *
from random import *
from decimal import Decimal
from heapq import *
from bisect import *
import sys
input=sys.stdin.readline
sys.setrecursionlimit(10**5)
def lis():
return list(map(int,input().split()))
def ma():
return map(int,input().split())
def inp():
return int(input())
def st1():
return input().rstrip('\n')
t=inp()
while(t):
t-=1
n=inp()
a=lis()
if(a[0]+a[1]<=a[-1]):
print(1,2,n)
else:
print(-1)
| 7 | PYTHON3 |
tests = int(input())
for t in range(tests):
length = int(input())
raw = input()
A = list(map(int, raw.split()))
if A[length-1] >= (A[0]+A[1]):
print("1 2", length)
else:
print("-1") | 7 | PYTHON3 |
import sys
input = sys.stdin.readline
for _ in range(int(input())):
n=int(input())
L=list(map(int,input().split()))
flag = 0
for i in range(n-2):
if L[i]+L[i+1]<=L[-1]:
print(i+1,i+2,n)
break
else:
print(-1)
| 7 | PYTHON3 |
#include <bits/stdc++.h>
using namespace std;
int main() {
int T;
cin >> T;
for (int i = 0; i < T; i++) {
int n;
cin >> n;
vector<int> array;
int a;
for (int j = 0; j < n; j++) {
cin >> a;
array.push_back(a);
}
int max = array[n - 1];
if (array[0] + array[1] <= max) {
cout << 1 << " " << 2 << " " << n << endl;
} else {
cout << -1 << endl;
}
}
return 0;
}
| 7 | CPP |
from sys import stdin
def input(): return stdin.readline().rstrip()
for _ in range(int(input())):
L=int(input())
s=list(map(int,input().split()))
if s[0]+s[1]>s[-1]:
print(-1)
else:
print(1,2,L) | 7 | PYTHON3 |
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 i in range(t):
n = int(input())
a = list(map(int,input().split()))
m = n-1
l = 1
if a[m]>=a[l-1]+a[l]:
print(l,l+1,m+1)
else:
print(-1)
| 7 | PYTHON3 |
for i in range(int(input())):
n=int(input())
a=[int(num) for num in input().split()]
if(a[0]+a[1]<=a[n-1]):
print(1,2,n)
else:
print(-1)
| 7 | PYTHON3 |
for _ in range(int(input())):
n = int(input())
arr = list(map(int, input().split()))
s = arr[0] + arr[1]
flag = -1
for i in range(2, n):
if arr[i] >= s:
flag = i+1
break
if flag == - 1:
print(-1)
else:
print(1, 2, flag) | 7 | PYTHON3 |
import sys
input = sys.stdin.readline
I = lambda : list(map(int,input().split()))
m,=I()
while m:
m-=1
n,=I()
arr=I()
a=b=c=0
flag=0
for i in range(n-1,1,-1):
if arr[0]+arr[1]<=arr[i]:
print(1,2,i+1)
flag=1
break
if flag==0:
print(-1)
| 7 | PYTHON3 |
n = int(input())
result = []
for i in range(n):
num = int(input())
l = list(map(int, input().split()))
maximum = max(l)
flag = 0
for i in range(len(l) - 2):
a = l[i]
b = l[i+1]
s = a+b
if s <= maximum:
flag = 1
result.append([i+1, i+2, num])
break
if flag == 0:
result.append(0)
else:
for i in result:
if i == 0 :
print(-1)
else:
for ele in i:
print(ele, end = ' ')
print()
| 7 | PYTHON3 |
for _ in range(int(input())):
N=int(input())
array=[int(x) for x in input().split()]
if array[0]+array[1]<=array[-1]:
print(1,2,N)
else:
print(-1) | 7 | PYTHON3 |
#include <bits/stdc++.h>
using namespace std;
int main() {
long long T;
cin >> T;
while (T--) {
long long n;
cin >> n;
long long a[n + 1];
vector<int> vct;
for (int i = 1; i <= n; i++) {
cin >> a[i];
}
bool b = false;
bool flag = false;
int k = 3;
for (int i = 3; i <= n; i++) {
vct.push_back(i);
if (a[1] + a[2] <= a[i]) {
k = i;
b = true;
flag = true;
break;
}
}
if (b == true) {
cout << 1 << " " << 2 << " " << k << "\n";
} else {
cout << "-1\n";
}
}
return 0;
}
| 7 | CPP |
for _ in range(int(input())):
n=int(input())
arr=list(map(int,input().split()))
if(arr[0]+arr[1]>arr[n-1]):
print("-1")
else:
print("1 2",n)
| 7 | PYTHON3 |
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=int(input())
A=[int(_) for _ in input().split()]
a,b=A[0],A[1]
for _ in range(2,n):
c=A[_]
if (a+b)>c and (b+c)>a and (a+c)>b:
continue
else:
print(1,2,_+1)
break
else:
print(-1) | 7 | PYTHON3 |
# import sys
# sys.stdin = open("input.txt", "r")
# sys.stdout = open("output.txt", "w")
t = int(input())
for _ in range(t):
n = int(input())
a = [int(i) for i in input().split()]
if(a[0] + a[1] <= a[-1]):
print("1 2", n)
else:
print("-1") | 7 | PYTHON3 |
import sys
import math
from sys import stdin, stdout
def get_ints(): return map(int, sys.stdin.readline().strip().split())
def get_list(): return list(map(int, sys.stdin.readline().strip().split()))
def get_string(): return sys.stdin.readline().strip()
def main():
for t in range(int(input())):
n=int(input())
l=get_list()
if l[0]+l[1]<=l[n-1]:
print(1,2,n)
else:
print(-1)
"""For fast input output"""
py2 = round(0.5)
if py2:
from future_builtins import ascii, filter, hex, map, oct, zip
range = xrange
import os, sys
from io import IOBase, BytesIO
BUFSIZE = 8192
class FastIO(BytesIO):
newlines = 0
def __init__(self, file):
self._file = file
self._fd = file.fileno()
self.writable = "x" in file.mode or "w" in file.mode
self.write = super(FastIO, self).write if self.writable else None
def _fill(self):
s = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
self.seek((self.tell(), self.seek(0, 2), super(FastIO, self).write(s))[0])
return s
def read(self):
while self._fill(): pass
return super(FastIO, self).read()
def readline(self):
while self.newlines == 0:
s = self._fill();
self.newlines = s.count(b"\n") + (not s)
self.newlines -= 1
return super(FastIO, self).readline()
def flush(self):
if self.writable:
os.write(self._fd, self.getvalue())
self.truncate(0), self.seek(0)
class IOWrapper(IOBase):
def __init__(self, file):
self.buffer = FastIO(file)
self.flush = self.buffer.flush
self.writable = self.buffer.writable
if py2:
self.write = self.buffer.write
self.read = self.buffer.read
self.readline = self.buffer.readline
else:
self.write = lambda s: self.buffer.write(s.encode('ascii'))
self.read = lambda: self.buffer.read().decode('ascii')
self.readline = lambda: self.buffer.readline().decode('ascii')
sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)
input = lambda: sys.stdin.readline().rstrip('\r\n')
if __name__ == '__main__':
main()
| 7 | PYTHON3 |
t = int(input())
ans = []
for i in range(t):
n = int(input())
a = list(map(int, input().split()))
if a[0] + a[1] <= a[-1]:
ans.append([0, 1, len(a)-1])
else:
ans.append(-1)
for i in range(t):
if type(ans[i]) is list:
for j in ans[i]:
print(j+1, end=' ')
print()
else:
print(ans[i]) | 7 | PYTHON3 |
for _ in range(int(input())) :
n=int(input())
ar=list(map(int,input().split()))
br=ar.copy()
ar.sort()
a=br.index(ar[0])
br[a]=10**9+52
b=br.index(ar[1])
br[b]=10*6-6
if len(ar)<3 :
print(-1)
else :
c=ar[0]+ar[1]
flag=0
ans=0
for i in range(2,len(ar)):
if ar[i]>=c :
flag=1
ans=ar[i]
break
if flag==1 :
c=br.index(ans)
print(a+1,b+1,c+1)
else :
print(-1) | 7 | PYTHON3 |
import sys
tc = int(sys.stdin.readline())
for _ in range(tc):
n = int(sys.stdin.readline())
arr = list(map(int, sys.stdin.readline().split()))
find = False
if arr[-1] >= arr[0] + arr[1]:
print(1,2,n)
else:
print(-1) | 7 | PYTHON3 |
#include <bits/stdc++.h>
using namespace std;
const long long int inf = LLONG_MAX;
const long long int mod = 1e9 + 7;
const long double pi = acos(-1);
void solution() {
long long int n;
cin >> n;
long long int a[n];
for (int i = 0; i < n; i++) cin >> a[i];
long long int ans = a[0] + a[1];
for (int i = 2; i < n; i++) {
if (a[i] >= ans) {
cout << 1 << " " << 2 << " " << i + 1;
return;
}
}
cout << "-1";
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
long long int t;
t = 1;
cin >> t;
while (t--) {
solution();
cout << "\n";
}
return 0;
}
| 7 | CPP |
# -*- coding: utf-8 -*-
"""Untitled20.ipynb
Automatically generated by Colaboratory.
Original file is located at
https://colab.research.google.com/drive/1OKbrG27mOdvGhdgzvRm1BawZ7TdpQYBR
"""
t=int(input())
while t>0:
n=int(input())
k=0
list1=list(map(int,input().split(" ")))
e=list1[0]+list1[1]
for a in range(2,n):
if e<=list1[a]:
print(""+str(1)+" "+str(2)+" "+str(a+1))
k=-1
break
if k!=-1:
print("-1")
t=t-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,end=" ")
print(2,end=" ")
print(n)
else:
print(-1)
| 7 | PYTHON3 |
t=int(input())
for tt in range(t):
n=int(input())
arr=list(map(int,input().split()))
flag=False
for i in range(n-1):
start=i+2
end=n-1
ss=arr[i]+arr[i+1]
ans=-1
while start<=end:
mid=(start+end)//2
if ss<=arr[mid]:
ans=mid
end=mid-1
# break
else:
start=mid+1
if ans!=-1:
flag=True
print(i+1,i+2,ans+1)
break
if flag==False:
print(-1) | 7 | PYTHON3 |
q = int(input())
for _ in range(q):
n = int(input())
A = list(map(int, input().split()))
ref = A[0] + A[1]
ans = 0
for i, a in enumerate(A):
if a >= ref:
ans = i
break
if ans == 0:
print(-1)
else:
print(1, 2, ans + 1) | 7 | PYTHON3 |
for _ in range(int(input())):
n = int(input())
l = list(map(int, input().split()))
min_sum = l[0] + l[1]
third_index = 0
for i in range(n):
if l [i] >= min_sum:
third_index = i + 1
break
if third_index:
print(1, 2, third_index)
else:
print(-1) | 7 | PYTHON3 |
test_cnt = int(input())
for tn in range(test_cnt):
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 |
query=int(input())
for _ in range(query):
n = int(input())
a = list(map(int, input().split()))
ma = max(a);mi = min(a)
flag=0
for i in range(1, n-1):
if a[0]+a[i]<=a[n-1]:
#As sum of two sides of a trinagle is always greater than the third
flag=1
break
if flag==1:
#Bcz of the array being sorted, if the least and other element sum becomes less than max, there will be no triangle
print(1, i+1, n)
else:
print(-1) | 7 | PYTHON3 |
t=int(input())
for i in range (t):
n=int(input())
a=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 a[k] >= a[j]+a[j+1]:
print (j+1,j+2,k+1)
flag=1
break
if a[k]< a[j]+a[j+1]:
break
if flag ==0:
print(-1)
| 7 | PYTHON3 |
#include <bits/stdc++.h>
using namespace std;
void CyBerForCe() {
long long n;
cin >> n;
vector<long long> v;
for (long long i = 0; i < n; i++) {
long long a;
cin >> a;
v.push_back(a);
}
long long a = 1, b = 2, c = 0;
for (long long i = 2; i < v.size(); i++) {
if (v[i] >= v[0] + v[1]) {
c = i + 1;
break;
}
}
if (c == 0)
cout << "-1\n";
else
cout << a << " " << b << " " << c << "\n";
}
signed main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
long long t;
cin >> t;
while (t--) CyBerForCe();
return 0;
}
| 7 | CPP |
for t in range(int(input())):
n=int(input())
l=list(map(int,input().split()))
l1=l.copy()
l.sort()
if l[0]+l[1]<=l[-1]:
a=0
if l[0]==l[1]:
a+=1
print(l1.index(l[0])+1,l1.index(l[1])+1+a,l1.index(l[-1])+1)
else:
print(-1) | 7 | PYTHON3 |
from bisect import *
for _ in range(int(input())):
n = int(input())
A = list(map(int, input().split()))
a = A[0] + A[1]
if a <= A[-1]:
print(1, 2, n)
else:
print(-1)
| 7 | PYTHON3 |
import sys
import math
import bisect
from sys import stdin, stdout
from math import gcd, floor, sqrt, log2, ceil
from collections import defaultdict as dd
from bisect import bisect_left as bl, bisect_right as br
from collections import Counter
from collections import deque
from heapq import heappush,heappop,heapify
mod = int(1e9)+7
ip = lambda : int(stdin.readline())
inp = lambda: map(int,stdin.readline().split())
ips = lambda: stdin.readline().rstrip()
# DEFAULT-DICT as DD
t = ip()
for _ in range(t):
n = ip()
arr = list(inp())
for i in range(n):
arr[i] = [arr[i],i]
arr.sort()
if arr[0][0]+arr[1][0]<=arr[-1][0]:
a,b,c = arr[0][1],arr[1][1],arr[-1][1]
a,b,c = a+1,b+1,c+1
print(a,b,c)
else:
print(-1)
| 7 | PYTHON3 |
t = int(input())
for case 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", len(a))
| 7 | PYTHON3 |
for _ in range(int(input())):
n = int(input())
a = [int(v) for v in input().split()]
if a[0] + a[1] <= a[-1]:
print(1, 2, n)
else:
print(-1) | 7 | PYTHON3 |
#include <bits/stdc++.h>
using namespace std;
int main() {
int t;
cin >> t;
while (t--) {
int n;
cin >> n;
int arr[n + 1];
for (int i = 1; i <= n; i++) {
cin >> arr[i];
}
if (arr[1] + arr[2] <= arr[n]) {
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()))
t = 0
for i in range(2, n):
if a[0] + a[1] <= a[i]:
print(1, 2, i + 1)
break
else:
t += 1
if t == n-2:
print(-1) | 7 | PYTHON3 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.