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()))

b = 1
for j in range(K):
    b *= A[j]

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

Submission status: Time Limit Exceeded

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

a = []
tmp = 1
r = 0
for l in range(n):
    tmp *= A[l]
    if l >= k - 1:
        a.append(tmp)
        tmp //= A[r]
        r += 1

for i in range(1, len(a)):
    if a[i - 1] < a[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 gakki in range(k+1,n+1):
    #pre = A[gakki-k-1:gakki-1]
    #pre_ = 1
    #for p in pre:
        #pre_ *= p

    
    #k_gakki = A[gakki-k:gakki]
    #k_gakki_ = 1
    #for ga in k_gakki:
        #k_gakki_ *= ga
    
    #if pre_ < k_gakki_:
    if sum(A[gakki-k-1:gakki-1])< sum(A[gakki-k:gakki]):
        print('Yes')
    else:
        print('No')

Submission status: Time Limit Exceeded

Solution code:
import sys
import math
from collections import defaultdict,deque
from itertools import permutations
ml=lambda:map(int,input().split())
ll=lambda:list(map(int,input().split()))
ii=lambda:int(input())
ip=lambda:list(input())
ips=lambda:input().split()
sys.setrecursionlimit(10**6)
"""========main code==============="""

t=1
for _ in range(t):
    n,k=ml()
    a=ll()
    val=1
    for i in range(k):
        val*=a[i]
    for i in range(k,n):
        tmp=val*a[i]
        tmp//=a[i-k]
        if(tmp>val):
            print("Yes")
        else:
            print("No")

Submission status: Time Limit Exceeded

Solution code:
#Problem C

N,K = map(int, input().split())
a = list(map(int,input().split()))
p = []


for i in range(N-K+1):
    p_tmp = 1
    for j in range(K):
        p_tmp *= a[i+j]
    
    p.append(p_tmp)
    
        
#print(p)
for i in range(N-K):
    if p[i+1] > p[i]:
        print("Yes")
    else:
        print("No")

Submission status: Time Limit Exceeded

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

x = 1
for i in range(k):
    x *= l[i]

xx = x
for i in range(n-k):
    xx *= l[i+k] / l[i]
    if xx > x:
        print("Yes")
    else:
        print("No")
    x = xx

Submission status: Time Limit Exceeded

Solution code:
n,k,*a=map(int,open(0).read().split())
for i in range(n-k):
    if sum(a[i+1:k+i+1])>sum(a[i:k+i]):
        print('Yes')
    else:
        print('No')

Submission status: Time Limit Exceeded

Solution code:
import sys
def IL(): return map(int,sys.stdin.readline().rstrip().split())

if __name__=='__main__':
    n,k = IL()
    a = list(IL())
    l = n-k+1
    b = [1]*(l)
    for i in range(l):
        for j in range(k):
            b[i]*=a[j+i]
    for i in range(1,l):
        if b[i-1]<b[i]:
            print('Yes')
        else:
            print('No')
    exit()

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 = tmp * A[i]
    
for i in range(K,N):
    tmp2 = tmp*A[i]//A[i-K]
    if tmp2 > tmp:
        print("Yes")
    else:
        print("No")
    tmp = tmp2

Submission status: Time Limit Exceeded

Solution code:

[N,K] = list(map(int,input().split()))
A = list(map(int,input().split()))
# print('A:',A)
hyoten=[0]*N

dammy=1
for i in range(K):
    dammy*=A[i]
# print('dammy0:', dammy)
hyoten[K-1] = dammy

for i in range(K,N):
    dammy/=A[i-K]
    dammy*=A[i]
    hyoten[i]=dammy

# print('hyoten:',hyoten)

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

Submission status: Time Limit Exceeded

Solution code:
# -*- coding: utf-8 -*-
import numpy as np
import sys
from collections import deque
from collections import defaultdict
import heapq
import collections
import itertools
import bisect
from scipy.special import comb
import copy
sys.setrecursionlimit(10**6)


def zz():
    return list(map(int, sys.stdin.readline().split()))


def z():
    return int(sys.stdin.readline())


def S():
    return sys.stdin.readline()[:-1]


def C(line):
    return [sys.stdin.readline() for _ in range(line)]


N, K = zz()
A = zz()
hyouka = [1] * (N)

for i in range(K - 1, N):
    for j in range(K):
        # print(j)
        hyouka[i] *= A[i-j]
# print(hyouka)
prev = hyouka[K-1]
for now in hyouka[K:]:
    if (prev < now):
        print('Yes')
    else:
        print('No')
    prev = now

Submission status: Time Limit Exceeded

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

mv_scores = []
for i in range(k, n+1):
    tmp_score = 1
    for s in score[i-k:i]:
        tmp_score *= s
    mv_scores.append(tmp_score)

for j in range(1, len(mv_scores)):
    if mv_scores[j] - mv_scores[j-1] > 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()))
#まずk学期までの
p=1
for i in range(k):
    p*=a[i]
    p//(10**9 +7)


for i in range(n-k):
    tmp=p
    p//=a[i]
    p*=a[i+k]
    p//(10**9 +7)
    #print(p)
    if p>tmp:
        print("Yes")
    else:
        print("No")

Submission status: Time Limit Exceeded

Solution code:
import sys
sys.setrecursionlimit(10**7) #再帰関数の上限,10**5以上の場合python
import math
from copy import copy, deepcopy
from copy import deepcopy as dcp
from operator import itemgetter
from bisect import bisect_left, bisect, bisect_right#2分探索
#bisect_left(l,x), bisect(l,x)#aはソート済みである必要あり。aの中からx未満の要素数を返す。rightだと以下
from collections import deque, defaultdict
#deque(l), pop(), append(x), popleft(), appendleft(x)
#q.rotate(n)で → にn回ローテート
from collections import Counter#文字列を個数カウント辞書に、
#S=Counter(l),S.most_common(x),S.keys(),S.values(),S.items()
from itertools import accumulate,combinations,permutations,product#累積和
#list(accumulate(l))
from heapq import heapify,heappop,heappush
#heapify(q),heappush(q,a),heappop(q) #q=heapify(q)としないこと、返り値はNone
from functools import reduce,lru_cache#pypyでもうごく
#@lru_cache(maxsize = None)#maxsizeは保存するデータ数の最大値、2**nが最も高効率
from decimal import Decimal

def input(): 
    x=sys.stdin.readline()
    return x[:-1] if x[-1]=="\n" else x
def printe(*x):print("## ",*x,file=sys.stderr)
def printl(li): _=print(*li, sep="\n") if li else None
def argsort(s, return_sorted=False): 
    inds=sorted(range(len(s)), key=lambda k: s[k])
    if return_sorted: return inds, [s[i] for i in inds]
    return inds
def alp2num(c,cap=False): return ord(c)-97 if not cap else ord(c)-65
def num2alp(i,cap=False): return chr(i+97) if not cap else chr(i+65)
def matmat(A,B):
    K,N,M=len(B),len(A),len(B[0])
    return [[sum([(A[i][k]*B[k][j]) for k in range(K)]) for j in range(M)] for i in range(N)]
def matvec(M,v):
    N,size=len(v),len(M)
    return [sum([M[i][j]*v[j] for j in range(N)]) for i in range(size)]
def T(M):
    n,m=len(M),len(M[0])
    return [[M[j][i] for j in range(n)] for i in range(m)]
def binr(x): return bin(x)[2:]
def bitcount(x): #xは64bit整数
    x= x - ((x >> 1) & 0x5555555555555555)
    x= (x & 0x3333333333333333) + ((x >> 2) & 0x3333333333333333)
    x= (x + (x >> 4)) & 0x0f0f0f0f0f0f0f0f 
    x+= (x >> 8); x+= (x >> 16); x+= (x >> 32) 
    return x & 0x7f

class SWAG:#funcとself.ideを設定すること
    def __init__(self,func,ide,A):#func:モノイド、ide:単位元、A:ターゲット配列
        self.A=tuple(deepcopy(A))#ターゲット配列
        self.ide=ide#単位元
        self.func=func#モノイド
        self.front=self.ide#frontスタックの総演算結果
        self.fr=0#frontスタックの右端インデックス
        self.fl=0#frontスタックの左端インデックス  
        self.back=deque()#backスタック

    def right(self,step=1):#右端をstep回すすめる
        for i in range(step):
            self.front=self.func(self.front,self.A[self.fr+i])
        self.fr+=step
    
    def left(self,step=1):#左端をstep回すすめる
        back=self.back
        func=self.func
        for _ in range(step):
            if not back:
                for i in range(self.fr-1,self.fl-1,-1):
                    x=self.A[i]
                    if back:
                        z=func(x,back[-1])
                    else:
                        z=x
                    back.append(z)
                self.fl=self.fr
                self.front=self.ide
            back.pop()

    def get(self):#区間funcの計算
        if self.back:
            return self.func(self.back[-1],self.front)
        return self.front



def main():
    mod = 1000000007
    #w.sort(key=itemgetter(1),reverse=True)  #二個目の要素で降順並び替え

    #N = int(input())
    N, K = map(int, input().split())
    A = tuple(map(int, input().split())) #1行ベクトル
    #L = tuple(int(input()) for i in range(N)) #改行ベクトル
    #S = tuple(tuple(map(int, input().split())) for i in range(N)) #改行行列
    def f(a,b):return a*b
    seg=SWAG(f,1,A)
    seg.right(K)
    pr=seg.get()
    for i in range(K,N):
        seg.right()
        seg.left()
        c=seg.get()

        if c>pr:
            print('Yes')
        else:
            print('No')
        pr=c





if __name__ == "__main__":
    main()

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]

for i in range(K, N):
    pre = p
    p = (p // A[i - K]) * A[i]

    if (pre < 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()))

count = 1
li = []

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

li.append(count)

for i in range(n - k):
    count = int(count*a[k+i]/a[i])
    li.append(count)

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
import sys
from math import ceil, floor, sqrt, sin, cos, pi
from itertools import accumulate, permutations, combinations
from fractions import gcd # 最大公約数
from collections import deque, Counter
from operator import itemgetter
from heapq import heappop,heappush
sys.setrecursionlimit(10**7)
def lcm(x, y): return ((x * y) // gcd(x, y)) # 最小公倍数
# list(map(int, input().split()))
n, k = map(int, input().split())
a = list(map(int, input().split()))
rui = [1]
t = 1
for i in range(n):
    t *= a[i]
    rui += [t]

for i in range(n+1):
    if i < k+1: continue
    # print(i, rui[i] / rui[i - k])
    # print(i-1, rui[i - 1] / rui[i - k - 1])
    if rui[i] / rui[i - k] > rui[i - 1] / rui[i - k - 1] :
        print('Yes')
    else:
        print('No')

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
import itertools
import operator

N, K = [int(x) for x in input().split(" ")]
A = [int(x) for x in input().split(" ")]

pro = [1] + list(itertools.accumulate(A, func=operator.mul))
# print(pro)
# print(pro[3] // pro[0])
# print(pro[4] // pro[1])
# print(pro[5] // pro[2])
# print(pro)
# for i in range(K + 1, N + 1):
#     if (pro[i] // pro[i - K]) > (pro[i - 1] // pro[i - K - 1]):
#         print("Yes")
#     else:
#         print("No")
for i in range(K + 1, N + 1):
    if pro[i] * pro[i - K - 1] > pro[i - K] * (pro[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()))

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

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

Submission status: Time Limit Exceeded

Solution code:
N, K  = map(int, input().split())
A_list = list(map(int, input().split()))
#print(A_list)
ans_list = [ 0 for n in range(N)]
tmp = 1
for k in range(K):
    tmp *= A_list[k]
    #print(tmp)
ans_list[K-1] = tmp
#print(ans_list)
for k in range(K, N):
    ans_list[k] = ans_list[k-1]//A_list[k-K] * A_list[k]
#print(ans_list)
for k in range(K, N):
    if ans_list[k] > ans_list[k-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()))

now = 1
for i in range(n):
    if i < k:
        now *= a[i]
        continue
    old = now
    now = (now / a[i-k]) * a[i]
    print("Yes" if now > old else "No")

Submission status: Time Limit Exceeded

Solution code:
N, K = map(int, input().split())
As = list(map(int, input().split()))
base = []
ans2=0
for n in range(K, N+1):
    ans1=ans2
    start = n-K
    ans = 1
    for a in As[start:n]:
        ans *= a
    ans2 = ans
    if n != K:
        if ans1 < ans2:
            print("Yes")
        else:
            print("No")

Submission status: Time Limit Exceeded

Solution code:
def main():
    N, K = list(map(int, input().split()))
    A = list(map(int, input().split()))
    temp = [0]*(len(A))
    prod = 1
    for i in range(len(A)):
        if i < K:
            prod *= A[i]
        else:
            prod = prod * A[i] // A[i - K]
        temp[i] = prod

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

if __name__ == '__main__':
    main()

Submission status: Time Limit Exceeded

Solution code:
from collections import defaultdict
from collections import deque
from collections import Counter
import itertools
import math

def readInt():
	return int(input())
def readInts():
	return list(map(int, input().split()))
def readChar():
	return input()
def readChars():
	return input().split()

n,k = readInts()
a = readInts()

base = 1
for i in range(k):
	base*=a[i]
t = base
#print(t)
base = base//a[0]

for i in range(k,n):
	base*=a[i]
	#print(base)
	if t>=base:
		print("No")
	else:
		print("Yes")
	t = base
	base=base//a[i-k+1]

Submission status: Time Limit Exceeded

Solution code:
# coding: utf-8
import math
import numpy
#N = int(input())
N, K = map(int,input().split())
A = list(map(int,input().split()))
#K =int(input())
ANS = []
for i in range(K-1, N):
    a = 1
    for j in range(i-K+1,i+1):
        a *= A[j]
    ANS.append(a)
#print(ANS)
for i in range(N-K):
    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()))
b = [0] * (n-k+1)
b0 = 1
for i in range(k):
    b0 = b0 * a[i]
b[0] = b0
for i in range(k, n):
    b[i-k+1] = b[i-k] // a[i-k] * a[i]
    if b[i-k+1] > b[i-k]:
        print('Yes')
    else:
        print('No')
#print(a, b, b0)

Submission status: Time Limit Exceeded

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

prev = -1
for i in range(K-1, N):
    prod = 1
    for k in range(K):
        prod *= A[i-k] % MOD
    if prev != -1:
        if prev < prod:
            print('Yes')
        else:
            print('No')
    prev = prod

Submission status: Time Limit Exceeded

Solution code:
import sys
from collections import deque,defaultdict

I=sys.stdin.readline

def ii():
	return int(I().strip())
def li():
	return list(map(int,I().strip().split()))

def mi():
	return map(int,I().strip().split())


def main():
	n,k=mi()
	arr=li()
	k_mul=1
	for i in range(k):
		k_mul*=arr[i]
	x=0
	for i in range(n-k):
		tmp=(k_mul//arr[x])*arr[k+i]
		if tmp>k_mul:
			print("Yes")
		else:
			print("No")
		k_mul=tmp
		x+=1








		


		










		






if __name__ == '__main__':
	main()

Submission status: Time Limit Exceeded

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

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

Submission status: Time Limit Exceeded

Solution code:
n,k = map(int, input().split())
a = list(map(int, input().split()))
t=1
for i in a[:k]:
  t *= i
temp = [t]

for index, i in enumerate(a[k:]):
  temp.append(temp[-1] * i // a[index])
  
for i,j in zip(temp, temp[1:]):
  if i < j:
    print("Yes")
  else:
    print("No")

Submission status: Time Limit Exceeded

Solution code:
def main():
    N, K = tuple(int(c) for c in input().split(' '))
    A = [1] + list(int(c) for c in input().split(' '))

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


if __name__ == "__main__":
    main()

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
import sys
sys.setrecursionlimit(10**6)

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

ans = [0]*n

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

ans = ans[k-1:]

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 = map(int, input().split())
A = list(map(int, input().split()))

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

for j in range(K, N):
    H_next = H_now * A[j] / A[j-K]
    if H_next > H_now:
        print('Yes')
    else:
        print('No')

Submission status: Time Limit Exceeded

Solution code:
from itertools import accumulate
N, K = map(int, input().split())
A = list(map(int, input().split()))
N = len(A)

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

count = 0
prev = -1
for i in range(K, len(S)):
  current = S[i]//S[count]
  if prev != -1:
    if current > prev:
      print("Yes")
    else:
      print("No")
  prev = S[i]//S[count]
  count += 1

Submission status: Time Limit Exceeded

Solution code:
from sys import stdin, stdout
input = stdin.readline
print = stdout.write
from functools import reduce
n, k = map(int,input().split())
a = list(map(int,input().split()))
prod = reduce(lambda x,y: x*y ,a[:k])
ans = []
for i in range(k,n):
    prodt = (prod/a[i-k])*a[i]
    if prodt>prod:
        ans.append('Yes')
    else:
        ans.append('No')
    prod = prodt
ans = '\n'.join(ans)
print(ans)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

que = deque(l[:k])
for i in range(n-k):
    previous = product
    product //= que.popleft()
    product *= l[k+i]
    if product <= previous:
        print('No')
    else:
        print('Yes')
    que.append(l[k+i])

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]

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

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):
    s = s * a[i] // a[i - k]
    ans.append(s)
    # print(ans)

for i in range(1, n - k + 1):
    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()))

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


for i in range(n-k):
    tmp=p
    p//=a[i]
    p*=a[i+k]
    p//(10**9 +7)

    if p>tmp:
        print("Yes")
    else:
        print("No")

Submission status: Time Limit Exceeded

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

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

Submission status: Time Limit Exceeded

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

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

for i in range(K, N):
    heru = A[i-K]
    hueru = A[i]
    if heru<hueru:
        print('Yes')
    else:
        print('No')

Submission status: Time Limit Exceeded

Solution code:
from collections import deque

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

# まずスタートの点数
p_pre = 1
for item in a[:k]:
    p_pre *= item

# n-k回やる
for i in range(n-k):
    # iこ目をなくしてk+iこめをふやす
    p_next = ((p_pre / a[i]) * a[k+i])
    if p_next > p_pre:
        print("Yes")
    else:
        print("No")

    p_pre = p_next

Submission status: Time Limit Exceeded

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

for i in range(0,N-K):
    Ai_pre = 1
    Ai_cur = 1

    for j in range(0,K):
        Ai_pre = Ai_pre * Ai[i + j]

    for j in range(1,K + 1):
        Ai_cur = Ai_cur * Ai[i + j]

    if Ai_cur > Ai_pre:
        print("Yes")
    else:
        print("No")

Submission status: Time Limit Exceeded

Solution code:
N,K=map(int,input().strip().split())
A=list(map(int,input().strip().split()))
p=1
for k in range(K):
    p*=A[k]
for k in range(K,N):
    p_new=p*A[k]//A[k-K]
    if p_new>p:
        print("Yes")
    else:
        print("No")
    p=p_new

Submission status: Time Limit Exceeded

Solution code:
n,k=map(int,input().split())
a=list(map(int,input().split()))
ans=1
ANS=1
for i in range(n-k+1):
    ANS=ans
    ans=1
    for j in range(k):
        ans*=a[i+j]
    if i>0:
        if ANS<ans:
            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):
    j1=1
    j2=1
    for c in range(k):
        j1*=a[i+c]
        j2*=a[i+c+1]
    if j1<j2:
        print('Yes')
    else:
        print('No')

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]
ans = [score]

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

for i in range(n-k):
    if ans[i] < ans[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()))
res=[]
for i in range(k-1,n):
    ans=1
    for x in range(k):
        ans*=a[i-x]
    res+=[ans]
for j in range(1,len(res)):
    print("Yes" if res[j]>res[j-1] else "No")

Submission status: Time Limit Exceeded

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

for i in range(K+1,N+1):
    before = 1
    after = 1
    for j in range(K):
        before = before*scores[i-j-2]
    for k in range(K):
        after = after*scores[i-k-1]
    if before>=after:
        print("No")
    else:
        print("Yes")

Submission status: Time Limit Exceeded

Solution code:
import os
import heapq
import sys
import math
import operator
from collections import defaultdict
from io import BytesIO, IOBase


"""def gcd(a,b):
    if b==0:
        return a
    else:
        return gcd(b,a%b)"""

"""def pw(a,b):
    result=1
    while(b>0):
        if(b%2==1): result*=a
        a*=a
        b//=2
    return result"""



def inpt():
    return [int(k) for k in input().split()]


def main():
    n,k=map(int,input().split())
    ar=inpt()
    s=1
    for i in range(1,k):
        s*=ar[i]
    prev=s
    j=0
    for i in range(k,n):
        if(ar[j]<ar[i]):
            print('Yes')
        else:
            print('No')
        j+=1


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")

if __name__ == "__main__":
    main()

Submission status: Time Limit Exceeded

Solution code:
n, k = list(map(int, input().split()))
a = list(map(int, input().split()))
# data = [list(map(int, input().split())) for i in range(n)]
#k = int(input())
#a = list(map(int, input().split()))
# b = list(map(int, input().split()))
# ab_sorted = sorted(ab, key=lambda x: x[0])
#x = [list(map(int, input().split())) for i in range(n)]
# print(min(15*n, 100*(n//10+1), 100*(n//10)+15*(n % 10)))
# for i in range(1, int(n**0.5)+1):

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

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

Submission status: Time Limit Exceeded

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

st = 1 #k楽器
for i in range(k):
    st *= a[i]

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

Submission status: Time Limit Exceeded

Solution code:
n, k = map(int, input().split())
points = [int(i) for i in input().split()]
scores = [0] * n
scores[0] = points[0]

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

Submission status: Time Limit Exceeded

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


cur=1
for i in range(0,k) :
    cur = cur * l[i]
for i in range(k,n) : 
    pre = cur
    cur = cur * l[i]
    cur /= l[i-k]
    if(pre < cur) :
        print("Yes")
    else  :
        print("No")

Submission status: Time Limit Exceeded

Solution code:
n, k = map(int, input().split())
a = list(map(int, input().split()))
rui = []
su = 1
for i in range(k):
    su *= a[i]
rui.append(su)
for i in range(k, n):
    rui.append(rui[-1]*a[i]//a[i-k])
for i in range(1, len(rui)):
    if rui[i] > rui[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()))

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

Submission status: Time Limit Exceeded

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

ans = sum(a[0:k])
for i in range(1, n-k+1):
    nxt = sum(a[i:i+k])
    if ans < nxt:
        print('Yes')
    else:
        print('No')
    ans = nxt

Submission status: Time Limit Exceeded

Solution code:
from functools import reduce
N, K = map(int, input().split())

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

before = reduce(lambda a, b: a * b, A[:K])
for i in range(0, N - K):
    temp = before // A[i] * A[K + i]
    if temp > before:
        print("Yes")
    else:
        print("No")
    before = temp

Submission status: Time Limit Exceeded

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

p = 1
for i in arr[:k]: p *= i
j = 0
for i in arr[k:]:
	s = (p // arr[j]) * i
	if s > p:print('Yes')
	else:print('No')
	p = s
	j += 1