about summary refs log tree commit diff
path: root/codechef/depchef.py
diff options
context:
space:
mode:
authorNguyễn Gia Phong <vn.mcsinyx@gmail.com>2019-02-13 20:48:02 +0700
committerNguyễn Gia Phong <vn.mcsinyx@gmail.com>2019-02-13 20:48:28 +0700
commit477c426b55d168764a34873561f78b3c34b1f013 (patch)
tree30d0982d9b501b6c1a45ac73d9cc90bcbc750407 /codechef/depchef.py
parentce56bd193a7c8c6437443227cd3abb51134e3e7a (diff)
downloadcp-477c426b55d168764a34873561f78b3c34b1f013.tar.gz
A new project is coming
Diffstat (limited to 'codechef/depchef.py')
-rwxr-xr-xcodechef/depchef.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/codechef/depchef.py b/codechef/depchef.py
new file mode 100755
index 0000000..e4899a1
--- /dev/null
+++ b/codechef/depchef.py
@@ -0,0 +1,9 @@
+#!/usr/bin/env python3
+for _ in range(int(input())):
+    input()
+    a, d = ([int(i) for i in input().split()] for _ in range(2))
+    a.extend((a[0], a[-1]))
+    try:
+        print(max(d for i, d in enumerate(d) if d > a[i-1] + a[i+1]))
+    except ValueError:
+        print(-1)