Diff
checker
टेक्स्ट
टेक्स्ट
छवियां
दस्तावेज़
Excel
फ़ोल्डर्स
Legal
Enterprise
डेस्कटॉप
मूल्य
साइन इन करें
Diffchecker डेस्कटॉप डाउनलोड करें
टेक्स्ट की तुलना करें
दो टेक्स्ट फ़ाइलों के बीच अंतर ढूंढें
उपकरण
इतिहास
रियल-टाइम एडिटर
अपरिवर्तित संक्षिप्त करें
लाइन रैप बंद
लेआउट
विभाजित
संयुक्त
परिवर्तन हाइलाइट करें
स्मार्ट
शब्द
अक्षर
सिंटैक्स हाइलाइटिंग
सिंटैक्स चुनें
अनदेखा करें
टेक्स्ट बदलें
पहले अंतर पर जाएँ
इनपुट संपादित करें
Diffchecker Desktop
Diffchecker चलाने का सबसे सुरक्षित तरीका। Diffchecker Desktop ऐप पाएं: आपके diffs कभी आपके कंप्यूटर से बाहर नहीं जाते!
Desktop पाएं
First and last submission
बनाया गया
4 वर्ष पहले
Diff कभी समाप्त नहीं होता
साफ़
निर्यात करें
शेयर करें
समझाएं
17 हटाए गए
लाइनें
कुल
हटाया गया
अक्षर
कुल
हटाया गया
इस सुविधा का उपयोग जारी रखने के लिए, अपग्रेड करें
Diff
checker
Pro
मूल्य देखें
69 लाइनें
सभी को कॉपी करें
8 जोड़े गए
लाइनें
कुल
जोड़ा गया
अक्षर
कुल
जोड़ा गया
इस सुविधा का उपयोग जारी रखने के लिए, अपग्रेड करें
Diff
checker
Pro
मूल्य देखें
63 लाइनें
सभी को कॉपी करें
कॉपी
कॉपी हुआ
कॉपी
कॉपी हुआ
# https://www.codechef.com/viewsolution/
60594129
# https://www.codechef.com/viewsolution/
60638735
कॉपी
कॉपी हुआ
कॉपी
कॉपी हुआ
# cook your dish here
import sys,os,io
import sys,os,io
import math
import math
from collections import defaultdict
from collections import defaultdict
कॉपी
कॉपी हुआ
कॉपी
कॉपी हुआ
def ii():
return int(input())
def li():
return list(map(int,input().split()))
if(os.path.exists('input.txt')):
sys.stdin = open("input.txt","r") ; sys.stdout = open("output.txt","w")
else:
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline
import bisect
import bisect
def lengthOfLIS(nums):
def lengthOfLIS(nums):
x = []
x = []
temp = [0]*(len(nums))
temp = [0]*(len(nums))
for i in range(len(nums)):
for i in range(len(nums)):
if not x:
if not x:
x.append(nums[i])
x.append(nums[i])
temp[i]=len(x)
temp[i]=len(x)
continue
continue
ind = bisect.bisect_left(x,nums[i])
ind = bisect.bisect_left(x,nums[i])
कॉपी
कॉपी हुआ
कॉपी
कॉपी हुआ
# replace bisect_left by bisect_right for longes non-dec subsequence
if ind==len(x):
if ind==len(x):
x.append(nums[i])
x.append(nums[i])
else:
else:
x[ind]=nums[i]
x[ind]=nums[i]
temp[i]=len(x)
temp[i]=len(x)
return temp
return temp
def lengthOfLDS(nums):
def lengthOfLDS(nums):
x = []
x = []
temp = [0]*(len(nums))
temp = [0]*(len(nums))
for i in range(len(nums)):
for i in range(len(nums)):
if not x:
if not x:
x.append(nums[i])
x.append(nums[i])
temp[i]=len(x)
temp[i]=len(x)
continue
continue
ind = bisect.bisect_left(x,nums[i])
ind = bisect.bisect_left(x,nums[i])
कॉपी
कॉपी हुआ
कॉपी
कॉपी हुआ
# replace bisect_left by bisect_right for longes non-dec subsequence
if ind==len(x):
if ind==len(x):
x.append(nums[i])
x.append(nums[i])
else:
else:
x[ind]=nums[i]
x[ind]=nums[i]
temp[i]=len(x)
temp[i]=len(x)
return temp[::-1]
return temp[::-1]
def solve():
def solve():
कॉपी
कॉपी हुआ
कॉपी
कॉपी हुआ
n =
ii(
)
n =
int(input()
)
l = li
()
l = li
st(map(int,input().split()))
a = lengthOfLIS(l)
a = lengthOfLIS(l)
for i in range(n):
for i in range(n):
l[i]=-l[i]
l[i]=-l[i]
l = l[::-1]
l = l[::-1]
b = lengthOfLDS(l)
b = lengthOfLDS(l)
ans = 0
ans = 0
for i in range(n-1):
for i in range(n-1):
ans=max(ans,a[i]+b[i+1])
ans=max(ans,a[i]+b[i+1])
print(ans)
print(ans)
कॉपी
कॉपी हुआ
कॉपी
कॉपी हुआ
t = 1
t =
ii(
)
t =
int(input()
)
for
_
in range(t):
for
i
in range(t):
solve()
solve()
कॉपी
कॉपी हुआ
कॉपी
कॉपी हुआ
सेव किए गए Diffs
ऑरिजनल टेक्स्ट
फ़ाइल खोलें
# https://www.codechef.com/viewsolution/60594129 # cook your dish here import sys,os,io import math from collections import defaultdict def ii(): return int(input()) def li(): return list(map(int,input().split())) if(os.path.exists('input.txt')): sys.stdin = open("input.txt","r") ; sys.stdout = open("output.txt","w") else: input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline import bisect def lengthOfLIS(nums): x = [] temp = [0]*(len(nums)) for i in range(len(nums)): if not x: x.append(nums[i]) temp[i]=len(x) continue ind = bisect.bisect_left(x,nums[i]) # replace bisect_left by bisect_right for longes non-dec subsequence if ind==len(x): x.append(nums[i]) else: x[ind]=nums[i] temp[i]=len(x) return temp def lengthOfLDS(nums): x = [] temp = [0]*(len(nums)) for i in range(len(nums)): if not x: x.append(nums[i]) temp[i]=len(x) continue ind = bisect.bisect_left(x,nums[i]) # replace bisect_left by bisect_right for longes non-dec subsequence if ind==len(x): x.append(nums[i]) else: x[ind]=nums[i] temp[i]=len(x) return temp[::-1] def solve(): n = ii() l = li() a = lengthOfLIS(l) for i in range(n): l[i]=-l[i] l = l[::-1] b = lengthOfLDS(l) ans = 0 for i in range(n-1): ans=max(ans,a[i]+b[i+1]) print(ans) t = 1 t = ii() for _ in range(t): solve()
परिवर्तित टेक्स्ट
फ़ाइल खोलें
# https://www.codechef.com/viewsolution/60638735 import sys,os,io import math from collections import defaultdict import bisect def lengthOfLIS(nums): x = [] temp = [0]*(len(nums)) for i in range(len(nums)): if not x: x.append(nums[i]) temp[i]=len(x) continue ind = bisect.bisect_left(x,nums[i]) if ind==len(x): x.append(nums[i]) else: x[ind]=nums[i] temp[i]=len(x) return temp def lengthOfLDS(nums): x = [] temp = [0]*(len(nums)) for i in range(len(nums)): if not x: x.append(nums[i]) temp[i]=len(x) continue ind = bisect.bisect_left(x,nums[i]) if ind==len(x): x.append(nums[i]) else: x[ind]=nums[i] temp[i]=len(x) return temp[::-1] def solve(): n = int(input()) l = list(map(int,input().split())) a = lengthOfLIS(l) for i in range(n): l[i]=-l[i] l = l[::-1] b = lengthOfLDS(l) ans = 0 for i in range(n-1): ans=max(ans,a[i]+b[i+1]) print(ans) t = int(input()) for i in range(t): solve()
अंतर खोजें