Problem:


Score: 300 points

Problem Statement

M-kun is a student in Aoki High School, where a year is divided into N terms.

There is an exam at the end of each term. According to the scores in those exams, a student is given a grade for each term, as follows:

For the first through (K-1)-th terms: not given.

For each of the K-th through N-th terms: the multiplication of the scores in the last K exams, including the exam in the graded term.

M-kun scored A_i in the exam at the end of the i-th term.

For each i such that K+1 \leq i \leq N, determine whether his grade for the i-th term is strictly greater than the grade for the (i-1)-th term.

Constraints

2 \leq N \leq 200000

1 \leq K \leq N-1

1 \leq A_i \leq 10^{9}

All values in input are integers.

Input

Input is given from Standard Input in the following format:

N K
A_1 A_2 A_3 \ldots A_N

Output

Print the answer in N-K lines.

The i-th line should contain Yes if the grade for the (K+i)-th term is greater than the grade for the (K+i-1)-th term, and No otherwise.

Sample Input 1

5 3
96 98 95 100 20

Sample Output 1

Yes
No

His grade for each term is computed as follows:

3-rd term: (96 \times 98 \times 95) = 893760

4-th term: (98 \times 95 \times 100) = 931000

5-th term: (95 \times 100 \times 20) = 190000

Sample Input 2

3 2
1001 869120 1001

Sample Output 2

No

Note that the output should be No if the grade for the 3-rd term is equal to the grade for the 2-nd term.

Sample Input 3

15 7
3 1 4 1 5 9 2 6 5 3 5 8 9 7 9

Sample Output 3

Yes
Yes
No
Yes
Yes
No
Yes
Yes



Sample input:
5 3
96 98 95 100 20


Sample output:
Yes
No

Submission status: Time Limit Exceeded

Solution code:
N, K = map(int, input().split())
A_list = list(map(int, input().split()))
tmp = [1] * 200010

for i in range(K, N+1):
    for j in A_list[i-K:i]:
        tmp[i] *= j

for i in range(K+1, K+1+N-K):
    if tmp[i] > tmp[i-1]:
        print('Yes')
    else:
        print('No')

Submission status: Time Limit Exceeded

Solution code:
n,k = map(int,input().split())
A = list(map(int,input().split()))
num = []
for i in range(n-k):
  An = 1
  An2 = 1
  for j in range(k):
    An = An*A[i+j]
    An2 = An2*A[i+j+1]
  if An2 > An:
    print("Yes")
  else:
    print("No")

Submission status: Time Limit Exceeded

Solution code:
N,K=map(int,input().split())
*A,=map(int,input().split())
A=[1]+A
Ps=[1]*(N+1)

Ps[1]=A[1]
for i in range(2,K+1):
  Ps[i]=Ps[i-1]*A[i]
  
for i in range(K+1,N+1):
  Ps[i] = Ps[i-1]//A[i-K]*A[i]
  if Ps[i-1]<Ps[i]:
    print('Yes')
  else:
    print('No')

Submission status: Time Limit Exceeded

Solution code:
n,k = map(int,input().split())
a = list(map(int,input().split()))
ans = [1]*n
for i in range(k):
    ans[0] *= a[i]
for i in range(n-k):
    ans[i+1] = ans[i] * a[i+k] // a[i]
    if ans[i+1] > ans[i]:
        print("Yes")
    else:
        print("No")

Submission status: Time Limit Exceeded

Solution code:
n,k=map(int,input().split())
a=list(map(int,input().split()))

for i in range(n-k):
    cntp=1
    cnt=1
    for j in range(k+1):
        if j!=k:
            cntp*=a[i+j]
        if j!=0:
            cnt*=a[i+j]
#        print(cnt,cntp)
    if cnt>cntp:
        print('Yes')
    else:
        print('No')

Submission status: Time Limit Exceeded

Solution code:

def main():
    [n, k] = [int(x) for x in input().split()]
    arr = [int(x) for x in input().split()]

    temp = 1
    for i in range(k):
        temp *= arr[i]

    t = temp
    for i in range(k, n):
        t  = (temp // arr[i-k])
        t *= arr[i]
        if t > temp:
            print('Yes')
        else:
            print('No')

        temp = t


main()

Submission status: Time Limit Exceeded

Solution code:
n,k=map(int,input().split())
a=list(map(int,input().split()))

l=[]
for i in range(n-k+1):
    total=1
    for j in range(0+i,k+i):
        total*=a[j]
    l.append(total)

for i in range(n-k):
    if l[i]<l[i+1]:
        print('Yes')
    else:
        print('No')

Submission status: Time Limit Exceeded

Solution code:
def marks_C():
    N, K = map(int, input().split())
    scores = tuple(map(int, input().split()))

    for i, k in enumerate(range(K, N)):

        total_i = 1
        for s in scores[i:k]:
            total_i *= s

        total_i2 = 1
        for s in scores[i + 1:k + 1]:
            total_i2 *= s

        if total_i2 > total_i:
            print('Yes')
        else:
            print('No')

if __name__ == '__main__':
    marks_C()

Submission status: Time Limit Exceeded

Solution code:
#!/usr/bin/env python3
# スペース区切りの整数の入力
n, k = map(int, input().split())
#配列の入力
data = list(map(int, input().split()))
score = []

temp = 1
for i in range(n):
    if i < k-1:
        temp *= data[i]
        score.append(0)
    elif i == k-1:
        temp *= data[i]
        score.append(temp)
    else:
        temp = temp // data[i-k] * data[i]
        score.append(temp)
    #print("i:{}, k:{}".format(i, k))
    #print(score)

    if i > k-1:
        if score[i] > score[i-1]:
            print("Yes")
        else:
            print("No")

Submission status: Time Limit Exceeded

Solution code:
N,K = map(int, input().split())
A = list(map(int, input().split()))

count = 0

for i in range(N - K + 1):
  kake_A = 1
  for j in range(K):
    kake_A = kake_A * A[j + i]
  count = count + 1
  if count == 1:
    kake_B = kake_A
    continue
  else:
    if kake_A > kake_B:
      print('Yes')
    else:
      print('No')
    kake_B = kake_A

Submission status: Time Limit Exceeded

Solution code:
import functools
import operator

N, K = input().split(" ")
A = list(map(int,input().split()))
N = int(N)
K = int(K)

res = N - K
last = functools.reduce(operator.mul, A[0:K])

for i in range(1, res+1):
  mul = functools.reduce(operator.mul, A[i:K+i])
  if mul > last:
    print("Yes")
  else:
    print("No")
  last = mul

Submission status: Time Limit Exceeded

Solution code:
n, k = list(map(int, input().split()))
a = list(map(int, input().split()))

# print(a[4 - k: 4])

for i in range(1, n - k + 1):
    ii = k + i
    tmp = 1
    for x in a[ii - k: ii]:
        tmp = x * tmp

    prevTmp = tmp * a[ii - k - 1] / a[ii - 1]

    if prevTmp < tmp:
        print('Yes')
    else:
        print('No')

Submission status: Time Limit Exceeded

Solution code:
n,k=map(int,input().split())
A=list(map(int,input().split()))
h=[]
for i in range(n-k+1):
    l=1
    for j in range(k):
        l*=A[k+i-1-j]
    h.append(l)
for i in range(n-k):
    if h[i]<h[i+1]:
        print("Yes")
    else:
        print("No")

Submission status: Time Limit Exceeded

Solution code:
n, k = map(int, input().split())
test = list(map(int, input().split()))

gakki = []

for i in range(n):
    if i < k-1:
        pass
    elif i >= k-1:
        kekka = []
        for j in range(k):
            kekka.append(test[i - j])
        sum = 1
        for l in kekka:
            sum = sum * l
        gakki.append(sum)

for i in range(len(gakki)):
    if i == 0:
        pass
    elif gakki[i-1] < gakki[i]:
        print("Yes")
    else:
        print("No")

Submission status: Time Limit Exceeded

Solution code:
N, K= map(int, input().split(' '))
A = list(map(int, input().split(' ')))
a = [0] * 200010

def N_score(n):
    Score = 1
    if(a[n - 1] == 0):
        # print("??")
        for i in range(n - (K - 1), n + 1):
            Score *= A[i]
        a[n] = Score
        return Score
    else:
        # print("!!")
        a[n] = a[n-1]/A[n-K]*A[n]
        return a[n]


for i in range(K, N):
    # print("i: {}".format(N_score(i)))
    if(N_score(i-1) < N_score(i)):
        print("Yes")
    else:
        print("No")

Submission status: Time Limit Exceeded

Solution code:
n,k = map(int,input().split())

a = list(map(int,input().split()))

b = []

for i in range(k-1,n):
    c = 1
    for j in range(k):
        c = c * a[i-j]
    b.append(c)

for m in range(n-k):
    if b[m+1] > b[m]:
        print('Yes')
    else:
        print('No')

Submission status: Time Limit Exceeded

Solution code:
N,K=map(int,input().split())
A=list(map(int,input().split()))
m=1
for i in A[:K]:m=m*i
p=m
for i in range(K,N):
    m=(m*A[i])//A[i-K]
    if K-1<i:print('Yes' if p<m else 'No')
    p=m

Submission status: Time Limit Exceeded

Solution code:
N,K=map(int, input().split())
A=list(map(int, input().split()))

ans=A[0]
for i in range(1,K):
   ans*=A[i]


for i in range(K,N):
    preans=ans
    ans=ans//A[i-K]*A[i]
    if ans>preans:
        print('Yes')
    else:
        print('No')

Submission status: Time Limit Exceeded

Solution code:
n,k = map(int,input().split(' '))
ar = list((map(int,input().split(' '))))
pro = 1
for i in range(k):
  pro*=ar[i]

ans = []
ans.append(pro)

for i in range(k,n):
  pro//=ar[i-k]
  pro*=ar[i]
  ans.append(pro)

for i in range(len(ans)-1):
  if ans[i] < ans[i+1]:
    print('Yes')
  else:
    print('No')

Submission status: Time Limit Exceeded

Solution code:
n,k= list(map(int,input().strip().split()))

arr1 = list(map(int,input().strip().split()))
prod=1
li=[]
li.append(1)
for i in range(len(arr1)):
  prod=prod*arr1[i]
  if(i>=k):
    prod=prod/arr1[i-k]
  li.append(prod)
for i in range(k+1,len(li)):
  if(li[i]>li[i-1]):
    print("Yes")
  else:
     print("No")

Submission status: Time Limit Exceeded

Solution code:
n,k=map(int,input().split())
A=list(map(int,input().split()))
x=1
for i in range(k):
  x*=A[i]
for j in range(n-k):
  y=x*A[j+k]/A[j]
  if y>x:
    print('Yes')
  else:
    print('No')
  x=y

Submission status: Time Limit Exceeded

Solution code:
n, k = map(int, input().split())
data = list(map(int, input().split()))

for i in range(n-k):
    if data[i:i+k][0] < data[i+1:i+k+1][-1]:
        print("Yes")
        # print( data[i:i+k] )
        # print( data[i+1:i+k+1] )
    else:
        print("No")

Submission status: Time Limit Exceeded

Solution code:
N, K = [int(i) for i in input().split()]
a = [int(i) for i in input().split()]

K_value = 1
for i in range(K):
    K_value *= a[i]
    
score_dict = {K-1:K_value}

for i in range(K, N):
    score_dict[i] = (score_dict[i-1] * a[i]) // a[i-K]
    if score_dict[i] > score_dict[i-1]:
        print('Yes')
    else:
        print('No')

Submission status: Time Limit Exceeded

Solution code:
n, k = map(int, input().split())
a = list(map(int, input().split()))
next = 0
for i in range(n-k+1):
  sum=1
  for j in range(k):
    sum = sum * a[i+j]
  if next == 0:
    pass
  elif sum<=next:
    print("No")
  elif next<sum:
    print("Yes")
  next=sum

Submission status: Time Limit Exceeded

Solution code:
#!/usr/bin/env python3

def main():
    N, K = map(int, input().split())
    A = list(map(int, input().split()))

    point = [1] * K
    point[0] = A[0]

    for i in range(1, K):
        point[i] = point[i - 1] * A[i]

    ans = ['No'] * (N - K)
    p = point[K - 1]
    for i in range(N - K):
        tmp = p * A[K + i] / A[i]
        if p < tmp:
            ans[i] = 'Yes'
        p = tmp
    print("\n".join(ans))

if __name__ == "__main__":
    main()

Submission status: Time Limit Exceeded

Solution code:
N, K = map(int, input().split())
A = list(map(int, input().split()))
seiseki = []

for i in range(N - K + 1):
  num = 1
  for j in range(K):
    num *= A[i + j]
  seiseki.append(num)
  if i > 0:
    if seiseki[-2] < seiseki[-1]:
      print("Yes")
    else:
      print("No")

Submission status: Time Limit Exceeded

Solution code:
N,K = map(int, input().split())
A = list(map(int, input().split()))
M = 1
for i in range (K):
    M *= A[i]
while True:
    A.pop(0)
    if len(A) == K - 1:
        break
    P = 1
    for i in range (K):
    	P *= A[i]
    print('Yes' if P > M else 'No')
    M = P

Submission status: Time Limit Exceeded

Solution code:
n, k = map(int, input().split())
a = list(map(int, input().split()))

score = 1
for i in range(k):
    score *= a[i]

head = a[0]
pre_score = score
for i in range(k, n):    
    score = (score / head) * a[i]
    if score > pre_score:
        print("Yes")
    else:
        print("No")
    head = a[i-k+1]
    pre_score = score

Submission status: Time Limit Exceeded

Solution code:
# import functools
# import operator
# prod = functools.partial(functools.reduce, operator.mul)

N, K = map(int, input().split())
A = list(map(int, input().split()))

score = [1 for _ in range(N)]
for i in range(K):
    for j in range(i+1):
        score[j] *= A[i]
# print(score)

# pre_score = prod(A[:K])
for i in range(K, N):
    for x in range(K):
        score[i-x] *= A[i]
    # score = prod(A[i-K+1:i+1])
    # print(score[i-K+1] , score[i-K])
    if score[i-K+1] > score[i-K]:
        print('Yes')
    else:
        print('No')
    # pre_score = score
# print(score)

Submission status: Time Limit Exceeded

Solution code:
import functools
import operator

n,k=map(int,input().split())
a=list(map(int,input().split()))

l=0
r=0
l=functools.reduce(operator.mul, a[0:k])

for i in range(1,n-k+1):
  r=l/a[i-1]*a[i-1+k]
  if l<r:
    print('Yes')
  else:
    print('No')
  l=r

Submission status: Time Limit Exceeded

Solution code:
n,k = map(int,input().split())
arr = list(map(int,input().split()))
prept = 0
pt = 0

for i in range(k-1,n):
    pt = arr[i]
    for j in range(1,k):
        pt *= arr[i-j]
    if i != k-1:
        if pt > prept:
            print("Yes")
        else:
            print("No")
        prept = pt
    else:
        prept = pt
        continue

Submission status: Time Limit Exceeded

Solution code:
from operator import mul
from functools import reduce

[n,k] = map(int, input().split(' '))
A = list(map(int, input().split(' ')))

def hyoka(j,p,b_point):
  if j < k:
    return 0
  point = reduce(mul, A[j-k:j])
  if j == k:
    return point
  if b_point < point:
    print('Yes')
  else:
    print('No')
  return point
b_point = 0
for i,p in enumerate(A):
  result = hyoka(i+1,p,b_point)
  if result > 0:
  	b_point = result

Submission status: Time Limit Exceeded

Solution code:
N, K = [int(i) for i in input().split()]
A = [int(i) for i in input().split()]
#%%
temp1 = 1
T = A[0: K]
for i in T:
    temp1 *= i

arr = []
arr.append(temp1)

for i in range(K, N):
    temp1 = arr[-1]
    temp2 = arr[-1]
    temp2 /= A[i - K]
    temp2 *= A[i]
    arr.append(temp2)
    if temp1 < temp2:
        print("Yes")
    else:
        print("No")

Submission status: Time Limit Exceeded

Solution code:
n, k = map(int, input().split())
a = list(map(int, input().split()))
ev_1 = 1
ev_2 = 1

for i in range(k):
    ev_1 *= a[i]

for j in range (n - k):
    ev_2 = ev_1 // a[j] * a[k + j]
    if ev_1 < ev_2 :
        print("Yes")
    else:
        print("No")
    ev_1 = ev_2

Submission status: Time Limit Exceeded

Solution code:
N, K = map(int, input().split())
A = [int(i) for i in input().split()]
i_list = [0] * (N+1)
cnt = 0

for k in range(K, N+1):
    A_sum = A[cnt]
    for i in range(cnt, K+cnt-1):
        A_sum = A_sum * A[i+1]
    i_list[k] = A_sum
    A_sum = 0
    cnt = cnt + 1

for k in range(K, N):
    if i_list[k] < i_list[k+1]:
        print('Yes')
    else:
        print('No')

Submission status: Time Limit Exceeded

Solution code:
l = list(map(int,input().split()))
n, k = l[0], l[1]
a = list(map(int,input().split()))

for i in range(k, n):
    bef, cur = 1, 1
    for ii in range(k):
        bef *= a[i-ii-1]
        cur *= a[i-ii]

    if cur > bef:
        print('Yes')
    else:
        print('No')

Submission status: Time Limit Exceeded

Solution code:
n, k = map(int, input().split())
data = list(map(int, input().split()))
rui = [1]
for i in range(n):
    rui.append( rui[-1] * data[i] )

for i in range(n-k):
    if data[i:i+k][0] < data[i+1:i+k+1][-1]:
        print("Yes")
        # print( data[i:i+k] )
        # print( data[i+1:i+k+1] )
    else:
        print("No")

Submission status: Time Limit Exceeded

Solution code:
nk = input().split()
n = int(nk[0])
k = int(nk[1])
a = list(map(int, input().split()))

p = []
for i in range(k - 1, n):
    if i == k - 1:
        p_i = 1
        for j in range(k):
            p_i *= a[i - j]
        p.append(p_i)
    else:
        p_i = p[-1] / a[i - k] * a[i]
        p.append(p_i)

for i in range(len(p)):
    if i == 0:
        continue
    if p[i] > p[i - 1]:
        print("Yes")
    else:
        print("No")

Submission status: Time Limit Exceeded

Solution code:
[N, K] = list(map(int, input().split()))
A = list(map(int, input().split()))
P = 1

for i in range(K):
    P = P*A[i]

st = 0
la = K

for i in range(N-K):
    P2 = (P/A[st])*A[la]
    if P2 > P:
        print('Yes')
    else:
        print('No')
    st += 1
    la += 1
    P = P2

Submission status: Time Limit Exceeded

Solution code:
n,k = map(int,input().split())
point = list(map(int,input().split()))
def seki(k,b,point):
    a = 1
    score = []
    for i in range(b,b+k):
        a = a*point[i]
    return a

for j in range(n-k):
    if seki(k,j,point)< seki(k,j+1,point):
        print('Yes')
    else:
        print('No')

Submission status: Time Limit Exceeded

Solution code:
n,k= map(int, input().split())
a=list(map(int,input().split()))

sum =[0]*n

for i in range(n):
    if i==0:
        sum[i]=a[i]
    else:
        sum[i]=sum[i-1]*a[i]

tmp=0

for i in range(k-1,n):
    if i==k-1 :
        tmp=sum[i]
    else :
        
        if tmp<sum[i]/sum[i-k]:
            print("Yes")
        else:
            print("No")          
        tmp=int(sum[i]/sum[i-k]);

Submission status: Time Limit Exceeded

Solution code:
N,K=map(int,input().split())
a=input().split()
A=[int(i) for i in a]
#print(N,K)
#print(A)

be_score=[]
for i in range(N-K+1):
  score=1
  for j in range(K):
    score*=A[i+j]
  be_score.append(score)
#print(be_score)
for i in range(N-K):

    #print(be_score,score)
  if(be_score[i]<be_score[i+1]):
    print('Yes')
  else:
    print('No')

Submission status: Time Limit Exceeded

Solution code:
def main():
	n,k = map(int,input().split())
	h = tuple(map(int,input().split()))
	
	dp = h[0]
	d = True
	i = 0
	while d:
		i += 1
		if i+1 <= k:
			dp *= h[i]
		else:
			break
	i -= 1
	# h[i] = K
	printcounter = 0
	while d:
		i += 1
		if n-k < printcounter or i >= len(h):
			break
		if dp < (dp//h[i-k])*h[i]:
			dp = (dp//h[i-k])*h[i]
			print("Yes")
			printcounter += 1
		else:
			dp = (dp//h[i-k])*h[i]
			print("No")
			printcounter += 1


if __name__ == '__main__':
	main()

Submission status: Time Limit Exceeded

Solution code:
semester, K = map(int, input().split())

score = input().split()

result1 = 1
result2 = 1

for i in range(semester - K + 1) :
    if i == 0 :
        for j in range(K) :
            result1 = result1 * int(score[K - 1 - j])
        loopCount = K
        continue
    
    result2 = result1 / int(score[K - loopCount]) * int(score[K - 1 + i])
    result2 = int(result2)
    loopCount -= 1

    if result1 < result2 :
        print("Yes")
    else :
        print("No")
    
    result1 = result2
    result2 = 1

Submission status: Time Limit Exceeded

Solution code:
n,k=[int(x) for x in input().split()]
a=[int(x) for x in input().split()]
mark=[0]*(n-k+1)
m=[1]*(k+1)
for i in range(k):
  m[i+1]=a[i]*m[i]
mark[0]=m[k]
for j in range(1,n-k+1):
  mark[j]=(mark[j-1]/a[j-1])*a[j+k-1]
  if mark[j-1]<mark[j]:
    print("Yes")
  else:
    print("No")

Submission status: Time Limit Exceeded

Solution code:
import math
from functools import reduce
from operator import mul

N, K = map(int, input().split())
A = list(map(int, input().split()))

for i in range(N-K):
    if reduce(mul,A[i:K+i]) < reduce(mul,A[i+1:K+1+i]):
        print("Yes")
    else:
        print("No")

Submission status: Time Limit Exceeded

Solution code:
n, k = map(int, input().split())
scs = list(map(int, input().split()))
#print(scs)

res = []
re = 1
pre = 0

for i in range(n - k + 1):
    for j in range(k):
        re = re * scs[i + j]
   
    if i > 0:
        if pre < re:
            print("Yes")
        else:
            print("No")
    pre = re
    re = 1

Submission status: Time Limit Exceeded

Solution code:
#!/usr/bin/env python3
# N,M = map(int,sys.stdin.readline().split())
# a = tuple(map(int,sys.stdin.readline().split())) # single line with multi param
# a = tuple(int(sys.stdin.readline()) for _ in range(N)) # multi line with single param
# a = tuple(tuple(map(int,sys.stdin.readline().rstrip().split())) for _ in range(N)) # multi line with multi param
# s = sys.stdin.readline().rstrip()
# N = int(sys.stdin.readline())
# INF = float("inf")
import sys
from functools import reduce
N,K = map(int,sys.stdin.readline().split())

A = tuple(map(int,sys.stdin.readline().split())) # single line with multi param

cum = [1]*(N+1)
for i in range(N):
    cum[i+1] = cum[i]*A[i]
    if K <= i:
        cur = cum[i+1]//cum[i-K+1]
        #print(i+1,cum[i],i-K,pre,cur)#
        if pre < cur:
            print("Yes")
        else:
            print("No")
        pre = cur
    else:
        pre = cum[i+1]#

#print(cum)
# #https://qiita.com/keymoon/items/11fac5627672a6d6a9f6
# import sys
# T = sys.stdin.readline().rstrip()
# NT = len(T)
# P = sys.stdin.readline().rstrip()
# NP = len(P)
# if NT < NP:
#     exit()
# MOD = 2**61-1 #prime
# A = [ord(c) for c in T]
# pows = [1]*(NT+1)
# shash = [0]*(NT+1)
# for i in range(NT):
#     pows[i+1] = (pows[i]*126)%MOD
#     shash[i+1] = (shash[i]*126+A[i])%MOD
# ph = 0
# for i in range(NP):
#     ph = (ph*126+ord(P[i]))%MOD
# for i in range(len(T)-NP+1):
#     if ph == (shash[i+NP]-shash[i]*pows[NP])%MOD:
#         print(i)

# pre = reduce((lambda x, y: x * y), [A[i] for i in range(K)])
# for i in range(K,N):
#     #print(i)
#     cur = (pre//A[i-K])*A[i]
#     if pre < cur:
#         print("Yes")
#     else:
#         print("No")
#     pre = cur

Submission status: Time Limit Exceeded

Solution code:
def resolve():
	N, K = map(int, input().split())
	A = [int(i) for i in input().split()]
	prd = [1]
	for i in range(N):
		prd.append(prd[-1] * A[i])
	#print(prd)
	
	l = 0
	for i in range(K, N):
		if prd[i] / prd[l] < prd[i+1] / prd[l+1]:
			print("Yes")
		else:
			print("No")
		l += 1
resolve()

Submission status: Time Limit Exceeded

Solution code:
#!/usr/bin/env python3
# スペース区切りの整数の入力
n, k = map(int, input().split())
#配列の入力
data = list(map(int, input().split()))
score = []

temp = 1
for i in range(n):
    if i < k-1:
        temp *= data[i]
        score.append(0)
    elif i == k-1:
        temp *= data[i]
        score.append(temp)
    else:
        temp = temp // data[i-k] * data[i]
        score.append(temp)
    #print("i:{}, k:{}".format(i, k))
    #print(score)

for j in range(k, n):
    if score[j] > score[j-1]:
        print("Yes")
    else:
        print("No")

Submission status: Time Limit Exceeded

Solution code:
n,k = map(int,input().split())
A = list(map(int,input().split()))
num = []
for i in range(n-k+1):
  An = 1
  for j in range(k):
    An = An*A[i+j]
  num.append(An)
  

for i in range(n-k):
  if num[i+1] > num[i]:
    print("Yes")
  else:
    print("No")

Submission status: Time Limit Exceeded

Solution code:
N, K = map(int, input().split())
A = list(map(int, input().split()))

base = 1

for ai in A[:K]:
  base *= ai

score = [0] * N
score[K-1] = base

for i in range(K, N):
  score[i] = score[i-1] // A[i-K] * A[i]
  print('Yes' if score[i] > score[i-1] else 'No')

Submission status: Time Limit Exceeded

Solution code:
n, k = map(int, input().split())
a = list(map(int, input().split()))

l = n - k + 1
lis = [0]*l
s = 1
for i in range(k):
  s = s * a[i]
lis[0] = s

for i in range(1, l):
  lis[i] = lis[i - 1] // a[i - 1] * a[i + k - 1]

for i in range(n - k):
  if lis[i] < lis[i + 1]:
    print("Yes")
  else:
    print("No")

Submission status: Time Limit Exceeded

Solution code:
n,k = map(int,input().split())
a = []
a = list(map(int,input().split()))

score = [1 for i in range(n)]
score[k-1] = 1
for i in range(k-1):
    score[k-1] *= a[i]
score[k] = score[k-1]*a[k]

for i in range(k,n):
    score[i] = score[i-1]/a[i-k]*a[i]

for i in range(k,n):
    if score[i]>score[i-1]:
        print("Yes")
    else:
        print("No")

Submission status: Time Limit Exceeded

Solution code:
import functools
import operator

n,k=map(int,input().split())
a=list(map(int,input().split()))

pi=[]
pi.append(functools.reduce(operator.mul, a[0:k]))

for i in range(1,n-k+1):
  pi.append(pi[i-1]/a[i-1]*a[i-1+k])
  if pi[i-1]<pi[i]:
    print('Yes')
  else:
    print('No')

Submission status: Time Limit Exceeded

Solution code:
#for _ in range(int(input())):
def zeroPad(numberString, zeros, left = True):
    """Return the string with zeros added to the left or right."""
    for i in range(zeros):
        if left:
            numberString = '0' + numberString
        else:
            numberString = numberString + '0'
    return numberString
def karatsubaMultiplication(x ,y):
    """Multiply two integers using Karatsuba's algorithm."""
    #convert to strings for easy access to digits
    x = str(x)
    y = str(y)
    #base case for recursion
    if len(x) == 1 and len(y) == 1:
        return int(x) * int(y)
    if len(x) < len(y):
        x = zeroPad(x, len(y) - len(x))
    elif len(y) < len(x):
        y = zeroPad(y, len(x) - len(y))
    n = len(x)
    j = n//2
    #for odd digit integers
    if (n % 2) != 0:
        j += 1    
    BZeroPadding = n - j
    AZeroPadding = BZeroPadding * 2
    a = int(x[:j])
    b = int(x[j:])
    c = int(y[:j])
    d = int(y[j:])
    #recursively calculate
    ac = karatsubaMultiplication(a, c)
    bd = karatsubaMultiplication(b, d)
    k = karatsubaMultiplication(a + b, c + d)
    A = int(zeroPad(str(ac), AZeroPadding, False))
    B = int(zeroPad(str(k - ac - bd), BZeroPadding, False))
    return A + B + bd
n,k=map(int,input().split())
x=[int(x) for x in input().split()]
ans=[1]*n
ans[0]=x[0]
for i in range(1,k):
  ans[i]=ans[i-1]*x[i]
c=0
for i in range(k,n):
  ans[i]=karatsubaMultiplication(ans[i-1],x[i])
  ans[i]=ans[i]//x[c]
  if ans[i]>ans[i-1]:
    print('Yes')
  else:print('No')
  c+=1

Submission status: Time Limit Exceeded

Solution code:
n, k = map(int, input().split())
a = list(map(int, input().split()))
A = []
for i in range(n-k+1):
    A.append(1)
    for j in range(i, k+i):
        A[i] = A[i]*a[j]
for k in range(n-k):
    if A[k+1] > A[k]:
        print('Yes')
    else:
        print('No')

Submission status: Time Limit Exceeded

Solution code:
N, K = map(int, input().split())
A = list(map(int, input().split()))

# point = [0] * (N - K + 1)
tmplist = A[0:K]
tmppoint = tmplist[0]
for j in range(1, K):
    tmppoint = tmppoint * tmplist[j]
point = tmppoint


for i in range(1, N - K + 1):
    tmplist = A[i : i + K]
    tmppoint = tmplist[0]

    for j in range(1, K):
        tmppoint = tmppoint * tmplist[j]

    if point < tmppoint:
        print("Yes")
    else:
        print("No")

    point = tmppoint

Submission status: Time Limit Exceeded

Solution code:
N,K = map(int,input().split())
A = list(map(int,input().split()))

b = 1
for i in A[0:K]:
    b *= i

for i in range(N-K):
    a = 1
    for i in A[i+1:i+K+1]:
        a *= i
    if b < a :
        print("Yes")
    else:
        print("No")
    b = a

Submission status: Time Limit Exceeded

Solution code:
def s(): return input()
def i(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def X(): return list(input())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
count = 0
ans = "No"

N,K = I()
A = l()

before = 1
for i in range(K):
    before *= A[i]

for i in range(N-K):
    after = before / A[i] * A[K+i]
    if after > before:
        print("Yes")
    else:
        print("No")
    before = after

Submission status: Time Limit Exceeded

Solution code:
from functools import reduce
from operator import mul

N, K = map(int, input().split())
test_points = list(map(int, input().split()))

before = None
for section in range(K, N + 1):
    target_test_points = test_points[section - K : section]
    point = reduce(mul, target_test_points)
    if before is None:
        before = point
        continue
    if before < point:
        print("Yes")
    else:
        print("No")
    before = point

Submission status: Time Limit Exceeded

Solution code:
n,k=map(int,input().split())
l=list(map(int, input().split()))
res=[]
a=1
for i in range(1,k+1):
    a*=l[k-i]
for j in range(k,n):
    k
    b=a*l[j]//l[j-k]
    if a<b:print("Yes")
    else:print("No")
    a=b

Submission status: Time Limit Exceeded

Solution code:
def calc(scorelist, K):
    sum = 1
    for i in range(K):
        sum *= scorelist[i]

    return sum

def main():
    N, K = map(int, input().split())
    scorelist = list(map(int, input().split()))
    
    scored = []
    pointer = K
    while(N >= pointer):
        scored.append(calc(scorelist, K))
        scorelist.pop(0)
        pointer += 1

    for j in range(N - K):
        if scored[j+1] - scored[j] > 0:
            print("Yes")
        else:
            print("No")
    
    # print(scored)
    # print(scorelist)
    


if __name__ == '__main__':
    main()

Submission status: Time Limit Exceeded

Solution code:
n, k = map(int, input().split())
a = list(map(int, input().split()))
s = 1
ans=[]
for i in range(k):
    s *= a[i]
ans.append(s)
for i in range(k, n):
    if a[i - k] < a[i]:
        print("Yes")
    else:
        print("No")

Submission status: Time Limit Exceeded

Solution code:
[N, K] = list(map(int, input().split()))
A = list(map(int, input().split()))
P = 1

for i in range(K):
    P = P*A[i]

st = 0
la = K

for i in range(N-K):
    if A[st] != 0:
        P2 = (P/A[st])*A[la]
    else:
        P2 = 1
        for j in range(K):
            P2 *= A[i-j+1]
    if P2 > P:
        print('Yes')
    else:
        print('No')
    st += 1
    la += 1
    P = P2

Submission status: Time Limit Exceeded

Solution code:
N, K = list(map(int, input().split()))
A = list(map(int, input().split()))

times = 1
for i in range(K):
    times *= A[i]
# print(times)

for i in range(K , N):
    pre_times = times
    # print(i)
    # print(i)
    # print(A[i - K])
    # print(A[i])
    times = times // A[i - K ]
    times *= A[i]
    # print(times)
    if pre_times < times:
        print("Yes")
    else:
        print("No")

Submission status: Time Limit Exceeded

Solution code:
N,K = map(int, input().split())
A = list(map(int, input().split()))

dp = [0] * (N+1)

for i in range(1,N+1):
    if i <= K - 1:
        continue

    if i == K:
        temp = 1
        for j in range(K):
            temp *= A[i-1-j]
        dp[i] = temp
        continue


    dp[i] = int(dp[i-1] / A[i-1-K] * A[i-1])

for k in range(K+1,N+1):
    if dp[k-1] < dp[k]:
        print('Yes')
    else:
        print('No')

Submission status: Time Limit Exceeded

Solution code:
n,k = map(int,input().split())
a_list = [int(i) for i in input().split()]

prev_point = 1
for i in range(k) :
    prev_point *= a_list[i]


for i in range(k+1,n+1) :
    # print(i-k,i-1)
    current_point = ((prev_point // a_list[i-k-1]) * a_list[i-1])
    # print(prev_point,current_point)
    if (prev_point < current_point) :
        print("Yes")
    else :
        print("No")
    prev_point = current_point

Submission status: Time Limit Exceeded

Solution code:
from collections import deque
N,K = map(int,input().split())
C = deque(map(int,input().split()))
D = C.copy()
#print(C)
ans = 1
for i in range(K):
  ans *= C.popleft()

for i in range(N-K):
  preans = ans
  ans *= C.popleft()
  ans /= D.popleft()
  if preans < ans:
    print("Yes")
  if preans >= ans:
    print("No")

Submission status: Time Limit Exceeded

Solution code:
n,k = map(int,input().split())
a = list(map(int,input().split()))
pre = 1
for p in range(0,k):
	pre*=a[p]
i=1
j=k+1
while(j<=n):
	curr = 1
	for k in range(i,j):
		curr*=a[k]
	if(curr>pre):
		print('Yes')
	else:
		print('No')
	j+=1
	i+=1
	pre = curr