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(map(int, input().split()))
point = 1
for i in range(k):
  point = point*a[i]
#print(point)
t = 0
for j in range(k, n):
  point0 = point
  point = point*a[j]/a[t]
  t+=1
  if point > point0:
    print("Yes")
  else:
    print("No")

Submission status: Time Limit Exceeded

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

lss=[]
for i in ls:
    lss.append(i)

lss[k-1]=pro

for i in range(k,n):
    #print(pro , ls[i-k] , ls[i])
    pro = pro*ls[i]
    pro = pro//ls[(i-k)]
    lss[i]=pro
    #print(pro)
    
#print(*lss)
    
for i in range(k,n):
    if(lss[i]>lss[i-1]):
        print("Yes")
    else:
        print("No")

Submission status: Time Limit Exceeded

Solution code:
import queue
from math import floor
from decimal import Decimal

N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
T = [1] * N

T[0] = A[0] 
for i in range(1, N):
    T[i] = T[i-1] * A[i] 
    if i-K>=0:
        T[i] = int(T[i] / A[i-K])

if N / 2 < K:
    add = N-K+1
else:
    add = K
for i in range(add, N):
    if T[i] > T[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()))

dictS={}
dictS[0]=1

for n in range (1,N):
    if n<K:
        # S.append(A[n]*S[-1])
        dictS[n]=A[n]*dictS[n-1]
    else:
        # S.append(A[n]*S[-1]/A[n-K])
        dictS[n]=A[n]*dictS[n-1]/A[n-K]

    if n>=K:
        if dictS[n]>dictS[n-1]:
            print('Yes')
        else:
            print('No')

Submission status: Time Limit Exceeded

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

"""
#評定の計算(K to N)
for i in range(K,N+1):
    hyoutei = 1
    for j in range(i-K,i):
        hyoutei = hyoutei * scores[j]
    hyoutei_list.append(hyoutei)
"""
hyoutei = 1
for i in range(K):
    hyoutei *= scores[i]
    
hyoutei_list.append(hyoutei)

for i in range(K,N):
    hyoutei = hyoutei//scores[i-K]*scores[i]
    hyoutei_list.append(hyoutei)

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

Submission status: Time Limit Exceeded

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

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

Submission status: Time Limit Exceeded

Solution code:
n,k = map(int, input().split())
v = list(map(int,input().split()))
result = 1
for i in range(k):
  result*=v[i]
pointer = 0
temp = []
temp.append(result)
for i in range(k,n,1):
  result/=v[pointer]
  pointer+=1
  result*=v[i]
  temp.append(result)
for i in range(1,len(temp)):
  if temp[i]>temp[i-1]:
    print("Yes")
  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()]
#%%
temp1 = 1
T = A[0: K]
for i in T:
    temp1 *= i

arr = []
arr.append(temp1)

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

Submission status: Time Limit Exceeded

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

res = N - K
last = 1

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

for i in range(1, res+1):
  mul = 1
  for j in range(1, K+1):
    mul = mul * A[K+i-j]
  if mul > last:
    print("Yes")
  else:
    print("No")
  last = mul

Submission status: Time Limit Exceeded

Solution code:
N, K = list(map(int, input().split()))
scores = list(map(int, input().split()))
pre = -1
for i in range(N):
    if i < K - 1: # indexがK-1回目 かどうか
        continue
    now = sum(scores[i - (K - 1):i+1]) / K
    if pre != -1: # indexがK回目 かどうか
        print('Yes' if now > pre else 'No')
    pre = now

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):
    p_i = 1
    for j in range(k):
        p_i *= a[i - j]
    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:
import bisect,collections,copy,heapq,itertools,math,string
import sys
def S(): return sys.stdin.readline().rstrip()
def M(): return map(int,sys.stdin.readline().rstrip().split())
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def LS(): return list(sys.stdin.readline().rstrip().split())
n, k = M()
A = LI()
ans = []
for i in range(n-1, k-1, -1):
    if A[i] > A[i-k]:
        ans.insert(0, 'Yes')
    else:
        ans.insert(0, 'No')
for s in ans:
    print(s)

Submission status: Time Limit Exceeded

Solution code:
terms = [int(i) for i in input().split(" ")]
scores = [int(i) for i in input().split(" ")]

N = terms[0]
K = terms[1]

tempScore = []
scoreSet = []

for i in range(N-K+1):
    for j in range(K):
        tempScore.append(scores[j+i])
    scoreSet.append(tempScore)
    tempScore = []

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

Submission status: Time Limit Exceeded

Solution code:
import numpy as np
import functools
import operator

n,k= map(int,input().split())
a = list(map(int,input().split()))
target = a[0:k]
# print(target)
p = functools.reduce(operator.mul, target)
# print(p)
for i in range(n-k):
    ans = (p // a[i]) * a[i+k]
    # print(ans)
    if ans > p:
        print("Yes")
    else:
        print("No")
    p = ans

Submission status: Time Limit Exceeded

Solution code:
# coding: utf-8
# Your code here!
# 幅優先探索（行きがけ）
import collections
import sys
import copy
import re
import math


def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int, sys.stdin.readline().rstrip().split()))
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())


def main():
    N, K = LI()
    Aarray = LI()

    start = 1
    for i in range(K):
        start *= Aarray[i]

    d = collections.deque(Aarray)

    for i in range(K, N):
        a = d.popleft()
        now = start*Aarray[i]/a
        if now > start:
            print("Yes")
        else:
            print("No")
        start = now


if __name__ == '__main__':
    main()

Submission status: Time Limit Exceeded

Solution code:
# @uthor : Kaleab Asfaw
import sys

input = sys.stdin.readline

def product(lst):
    x = 1
    for i in lst:
        x *= i
    return x

def main(n, k, lst):
    prev = product(lst[:k])
    for i in range(n-k):
        curr = (prev / lst[i]) * lst[i+k]
        if curr > prev: print("Yes")
        else: print("No")
        prev = curr
    
    


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

Submission status: Time Limit Exceeded

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

def getRate(list, int1, int2):
    value = 1
    for i in range(int1, int2):
        value = value * list[i]
    return value



for i in range(N-K+1):
    A.append(getRate(a, i, K + i))

ans = []

for i in range(len(A)-1):
    if A[i] < A[i+1]:
        ans.append("Yes")
    else:
        ans.append("No")

for i in range(len(ans)):
    print(ans[i])

Submission status: Time Limit Exceeded

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

for i in range(0,N):
    tmp = S[-1] * A[i]
    S.append(tmp)

# print(S)

B = []
for i in range(K,N+1):
    B.append(S[i]//S[i-K])

for i in range(1,len(B)):
    if(B[i]>B[i-1]):
        print('Yes')
    else:
        print('No')

Submission status: Time Limit Exceeded

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

t = 1
for i in range(k):
    t *= lis[i]

for i in range(k, n):
    a = 1
    for j in range(i-k+1, i+1):
        a *= lis[j]
    
    if a > t:
        print('Yes')
    else:
        print('No')
    
    t = a
    a = 1

Submission status: Time Limit Exceeded

Solution code:
N, K = map(int, input().split())
A = [int(x) for x in input().split()]

A_past = 1
for Ai in A[:K]:
  A_past *= Ai

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

Submission status: Time Limit Exceeded

Solution code:
from functools import reduce

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


res = [0] * (n-k+1)
res[0] = reduce(lambda x, y: x*y , A[0:k+1])

for i in range(1, n-k+1):
    res[i] = res[i-1]//A[i-1]*A[i+k-1]

for j in range(n-k):
    ans = 'Yes' if res[j] < res[j+1] else 'No'
    print(ans)

Submission status: Time Limit Exceeded

Solution code:
import functools
import operator

N,K = map(int,input().split())
A = list(map(int,input().split()))
R = []
for i in range(N-K+1):
  X = functools.reduce(operator.mul,A[i:i+K])
  R.append(X)
  if i ==0:
    continue
  else:
    if X > R[i-1]:
      print("Yes")
    else:
      print("No")

Submission status: Time Limit Exceeded

Solution code:

n, k = (int(x) for x in input().split())
a_list = list(map(int, input().split()))

for i in range(k, n):

    # p =  a_list[i - 2] * a_list[i - 1] * a_list[i]
    # former_p = a_list[i - 3] * a_list[i - 2] * a_list[i - 1]

    p = 1
    former_p = 1

    for j in range(i - k, i) :
        p = p * a_list[j + 1]
        former_p = former_p * a_list[j]

    # for j in range(i - k, i) :
    #     p = p * a_list[j]

    # for l in range(i - k, i) :
    #     former_p = former_p * a_list[l - 1]

    # print("p : {0}".format(p))
    # print("former_p : {0}".format(former_p))

    if former_p < p : 
        print('Yes')
    else :
        print('No')

Submission status: Time Limit Exceeded

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

tmp = 1
for i in range(k):
    tmp *= A[i]

output = []
count = 0
for i in range(k, n):
    if tmp < int(tmp * A[i] / A[count]):
        output.append("Yes")
    else:
        output.append("No")
    tmp = int(tmp * A[i] / A[count])
    count += 1
    
print(*output, sep="\n")

Submission status: Time Limit Exceeded

Solution code:
N, K = list(map(int, input().split()))
A = [int(i) for i in input().split()]
 
before_score = 1
for i in range(K):
    before_score *= A[K-1-i]
 
# print(before_score)
 
this_term_score = 1
for i in range(N-K):
    this_term_score = before_score / A[K+i-K] * A[K+i]
    if this_term_score > before_score:
        print("Yes")
        # print("this_term_score",this_term_score)
        # print("before_score",before_score)
        # print("\n")
    else:
        print("No")
        # print("this_term_score",this_term_score)
        # print("before_score",before_score)
        # print("\n")
    before_score = this_term_score

Submission status: Time Limit Exceeded

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

scores = []

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

scores.append(score)

for j in range(k, n):
    scores.append(scores[-1] * a[j] / a[j-k])
    if scores[-1] > scores[-2]:
        print('Yes')
    else:
        print('No')

Submission status: Time Limit Exceeded

Solution code:
# [] = list(map(int, input().split()))
# = map(int, input().split())

[n, k] = list(map(int, input().split()))
aList = list(map(int, input().split()))
aList_kai = []
for i in range(n-k+1):
    pointer = 0
    theSum = 1
    for j in range(k):
        theSum *= aList[i+pointer]
        pointer += 1
    aList_kai.append(theSum)
ptr = 0
# for i in range(1, n-k+1):
#     answer = True
#     while True:
#         try:
#             if aList_kai[ptr+i] <= aList_kai[ptr+i-1]:
#                 answer = False
#                 break
#             else:
#                 ptr += i
#         except IndexError:
#             break
#     if answer:
#         print("Yes")
#     else:
#         print("No")
for i in range(1, n-k+1):
    if aList_kai[i] > aList_kai[i-1]:
        print("Yes")
    else:
        print("No")

Submission status: Time Limit Exceeded

Solution code:
import copy

n, k = map(int, input().split())
l = [int(x) for x in input().split()]

x = 1
ll = []
for i in l:
    x *= i
    ll.append(x)

lll = [copy.deepcopy(ll[k-1])]
for i in range(n-k):
    lll.append(int(ll[i+k]/ll[i]))

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

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()))  
tempA = reduce(mul, A[0:K])

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
import sys
import numpy as np
N, K = list(map(int, input().split()))
A = list(map(int, input().split()))

B = 0
for i in range(N-K+1):
    s = 1
    for j in range(K):
        s *= A[i+j]
    if B != 0 and B < s:
        print('Yes')
    elif B != 0 and B >= s:
        print('No')
    B = s

Submission status: Time Limit Exceeded

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

n = 1
c = 0

for i in range(N):
    if i <= K-1:
        n *= A[i]

    else:
        tmp = n
        tmp /= A[c]
        tmp *= A[i]

        if tmp > n:
            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()))
ans = [0]*(n+1)
ans[0] = 1
p = 1
for i in range(n):
    ans[i+1] = ans[i]*a[i]
#print(ans)
for j in range(n-k):
    #print(ans[k]//ans[j],ans[k+1]//ans[j+1])
    if ans[k+j]//ans[j] < ans[k+j+1]//ans[j+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=[]
s=1
s=functools.reduce(operator.mul, a[0:k])
pi.append(s)

for i in range(1,n-k+1):
  pi.append(int((s/a[i-1])*a[i-1+k]))
  s=pi[i]
  if pi[i-1]<pi[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 = []
c = 1
for i in range(0,k):
  c *= a[i]
b.append(c)
for i in range(0, n-k):
  b.append(b[i]*a[i+k]//a[i])
for j in range(1, len(b)):
  if b[j-1] < b[j]:
    print('Yes')
  else:
    print('No')

Submission status: Time Limit Exceeded

Solution code:
# -*- coding: utf-8 -*-

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

s_k = 1
for j in range(k):
    s_k *= scores[j]

for i in range(k + 1, n + 1):
    _s_k = s_k
    remove = scores[i - k - 1]
    add    = scores[i - 1]

    if remove < add:
        print('Yes')
    else:
        print('No')

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])
        continue
    
    for l in range(K) :
        result2 = result2 * int(score[K - l - 1 + i])
    
    if result1 < result2 :
        print("Yes")
    else :
        print("No")
 
    result1 = result2
    result2 = 1

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* (1/h[i-k]))*h[i]:
			dp = (dp* (1/h[i-k]))*h[i]
			print("Yes")
			printcounter += 1
		else:
			dp = (dp* (1/h[i-k]))*h[i]
			print("No")
			printcounter += 1


if __name__ == '__main__':
	main()

Submission status: Time Limit Exceeded

Solution code:
import sys
sys.setrecursionlimit(4100000)
import math
import itertools
INF = float('inf')
from heapq import heapify, heappop, heappush

def main():
    n,k = map(int, input().split())
    A = list(map(int, input().split()))

    before = 1
    for i in range(k):
        before *= A[k-1-i]
    for i in range(k,n):
        after = (before//A[i-k])*A[i]
        if before < after:
            print('Yes')
        else:
            print('No')
        before = after


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
for i in range(k):
    s *= a[i]
last = s
for i in range(k, n):
    s = s * a[i] // a[i-k]
    if last >= s:
        print('No')
    else:
        print('Yes')
    last = s

Submission status: Time Limit Exceeded

Solution code:
n,k=map(int,input().split())
A=list(map(int,input().split()))
lst=[1]*(n-k+1)
for i in range(n-k+1):
  if i==0:
    temp=1
    for j in range(k):
      temp*=A[j]
    lst[i]=temp
  else:
    lst[i]=lst[i-1]*A[i+k-1]//A[i-1]
    print("Yes" if lst[i]>lst[i-1] else "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,n+1):
  c = a[i-k:i+1]
  d = 1
  for j in range(k):
    d *= c[j]
  b.append(d)
for i in range(len(b)-1):
  if b[i+1]-b[i] > 0:
    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
count=0
su =[]
for i in range(n-k+1):
    p = a[i:i+k]
    #print(p)
    for r in p:
        ans *= r
        count +=1
        #print(ans)
        if count % k==0:
            su.append(ans)
            ans =1
#print(su)
for y in range(0,len(su)-1) :
    if su[y] < su[y +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()))

def sp(i, k):
  s = 1
  for j in range(k):
    s *= a[i-j]
  return s

for i in range(k, n):
  if sp(i-1, k) < sp(i, k):
    print("Yes")
  else:
    print("No")

Submission status: Time Limit Exceeded

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

pre = 1
for i in range(k):
    pre *= A[i]

for i in range(k,n):
    now = pre//A[i-k] *A[i]
    if pre < now:
        print('Yes')
    else:
        print('No')
    pre = now

Submission status: Time Limit Exceeded

Solution code:
n,k = map(int,input().split())
a = list(input().split())
count = 0
tmp = 1
check = []
for _ in range(n - k + 1):
    for i in range(k):
        tmp *= int(a[i + count])
    check.append(tmp)
    tmp = 1
    count += 1

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

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]
for j in range(n-k):
  if mark[j]<mark[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()))
B = []

def product(array):
  a = 1
  for k in array:
    a *= k
  return a

for i in range(N-K+1):
  B.append(product(A[i:i+K]))
  
count = 0
for b in B:
  if count == 0:
    b_old = b
  else:
    if b > b_old:
      print('Yes')
    else:
      print('No')
  b_old = b
  count += 1

Submission status: Time Limit Exceeded

Solution code:
from math import floor,ceil,sqrt,factorial,log
from collections import Counter, deque
from functools import reduce
import numpy as np
import itertools
def S(): return input()
def I(): return int(input())
def MS(): return map(str,input().split())
def MI(): return map(int,input().split())
def FLI(): return [int(i) for i in input().split()]
def LS(): return list(MS())
def LI(): return list(MI())
def LLS(): return [list(map(str, l.split() )) for l in input()]
def LLI(): return [list(map(int, l.split() )) for l in input()]
def LLSN(n: int): return [LS() for _ in range(n)]
def LLIN(n: int): return [LI() for _ in range(n)]

N,K = MI()

A = LI()

multi = {}
for j in range(K, N+1):
    target = A[j-K:j]
    ans = 1
    for t in target:
        ans = ans * t
    multi[j] = ans

for i in range(K, N+1):
    if i-1 in multi:
        if multi[i] > multi[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()))

g = 1
grade = []
for i in range(n):
    g *= a[i]
    if i+1 > k:
        g /= a[i-k]
    grade.append(int(g))

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

Submission status: Time Limit Exceeded

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

prev = prod
idx = 0
for i in range(k,n):
    new_prod = prev/l[idx]
    new_prod *= l[i]
    idx+=1
    if(new_prod>prev):
        print('Yes')
    else:
        print('No')
    prev = new_prod

Submission status: Time Limit Exceeded

Solution code:
import operator
import functools

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

    for i in range(K-1,N):
        lst= A[i-K+1:i+1]
        p = sum(lst)
        #p = mul(lst)
        #p = functools.reduce(operator.mul,lst)
        if i != K-1:
            if p <= prev:
                print('No')
            else:
                print('Yes')
        prev = p
    
if __name__ == "__main__":
    main()

Submission status: Time Limit Exceeded

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

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

Submission status: Time Limit Exceeded

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

def N_score(n):
    Score = 1
    for i in range(n - (K - 1), n + 1):
        Score *= A[i]
    return Score

for i in range(K, N):
    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()))
s,e = 1,k+1
temp = sum(a[:k])
for i in range(n-k):
    score = sum(a[s:e])
    print("Yes" if score>temp else "No")
    temp = score
    s+=1
    e+=1

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):
    be = A[i:i+K]
    af = A[i+1:i+K+1]
    b = 1
    a = 1
    for i in be:
        b *= i
    for i in af:
        a *= i
    if b < a :
        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 = [0] * (n - k + 1)
b[0]+=a[0]
for i in range(k-1):
    b[0] *= a[i + 1]

for j in range(len(b) - 1):
    b[j + 1] = (b[j + 1] + b[j]) // a[j] * a[j + k]

for l in range(len(b)-1):
    if b[l] < b[l + 1]:
        print("Yes")
    else:
        print("No")

Submission status: Time Limit Exceeded

Solution code:
import sys
def input():
    return sys.stdin.readline()[:-1]

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

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


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


if __name__ == '__main__':
    main()

Submission status: Time Limit Exceeded

Solution code:
data = input().split(" ")
N = int(data[0])
K = int(data[1])
score = input().split(" ")

num = N-K+1
ten = [1]*(num)
for i in range(num):
  for j in range(K):
    ten[i] = ten[i]*int(score[K+i-1-j])

for i in range(N-K):
  if ten[i] >= ten[i+1]:
    print("No")
  else:
    print("Yes")

Submission status: Time Limit Exceeded

Solution code:

def ruisekiseki(l):
    #関数バージョン
    lst = [1]
    s = 1
    for i,v in enumerate(l):
        lst.append(s * v)
        s *= v
    return lst


def main():
    n,k = map(int,input().split())
    test_scores = list(map(int,input().split()))
    r = ruisekiseki(test_scores)
    pre_score = r[k] // r[0]
    for i in range(k+1,n+1):
        #print(r[i] // r[i-k])
        if r[i] // r[i-k] > pre_score:
            print("Yes")
        else:
            print("No")
        pre_score = r[i] // r[i-k]





if __name__ == '__main__':
    main()

Submission status: Time Limit Exceeded

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

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

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

Submission status: Time Limit Exceeded

Solution code:
n,k=map(int,input().split( ))
m=0
a=list(map(int ,input().split( )))
num1=1
b=[]
for i in range(m,k):
    num1*=a[i]
b.append(num1)
while(k<n):
    
    num1=num1*a[k]
    num1=num1/a[m]
    b.append(int(num1))
    m+=1
    if(k<n):
        k+=1
    else:
        break
#print(b)
for i in range(len(b)-1):
    if(b[i]<b[i+1]):
        print("Yes")
    else:
        print("No")

Submission status: Time Limit Exceeded

Solution code:
import operator
from functools import reduce

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

x = []

for i in range(N - K + 1):
    hoge = reduce(operator.mul, A[i:i + K])
    
    x.append(hoge)

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

Submission status: Time Limit Exceeded

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

class SegTree:
    def __init__(self, init_val, f=lambda x,y : x*y, default=1):
        size = len(init_val)
        self.size = 2**(size-1).bit_length()
        self.default = default
        self.dat = [default]*(self.size*2)
        self.f = f

        for i in range(size):
            self.dat[self.size + i] = init_val[i]
        for i in range(self.size- 1, 0, -1):
            self.dat[i] = self.f(self.dat[2 * i], self.dat[2 * i + 1])

    def update(self, i, x):
        i += self.size
        self.dat[i] = x
        while i > 0:
            i >>= 1
            self.dat[i] = self.f(self.dat[i*2], self.dat[i*2+1])

    def query(self, l, r):
        l += self.size
        r += self.size
        lres, rres = self.default, self.default
        while l < r:
            if l & 1:
                lres = self.f(lres, self.dat[l])
                l += 1

            if r & 1:
                r -= 1
                rres = self.f(self.dat[r], rres)
            l >>= 1
            r >>= 1
        res = self.f(lres, rres)
        return res

seg = SegTree(Ai)
# print(seg.query(0, 1))

def score(i):
    return seg.query(i - K, i)

for i in range(K + 1, N + 1):
    sp = score(i - 1)
    s = score(i)

    if sp < s:
        print("Yes")
    else:
        print("No")

Submission status: Time Limit Exceeded

Solution code:
import sys
n, k = map(int,input().split())
As = list(map(int, input().split()))
ans = 1
tmp = -1
for i in range(n-k+1):
    for j in range(k):
        ans= ans*As[k+i-j-1]
    if not tmp==-1:
        if tmp<ans:
            print('Yes')
        else:
            print('No')
    tmp = ans
    ans = 1

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 = [base]

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

prev = 0
now = 1
for i in range(n - (k - 1)):
#    print(i)#
    for j in a[i: k + i]:
#        print(j)#
        now *= j
    if i >= 1:
#        print(prev,now)#
        if prev >= now:
            print("No")
        else:
            print("Yes")
    prev = now
    now = 1