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:
import sys
read = sys.stdin.readline
import time
import math
import itertools as it
def inpl():
    return list(map(int, input().split()))
st = time.perf_counter()
# ------------------------------

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

 
    

# -----------------------------
ed = time.perf_counter()
print('time:', ed-st, file=sys.stderr)

Submission status: Time Limit Exceeded

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

for i in range(n-k+1):
  s=a[count:k+count]
  gakki=1
  count+=1
  for w in s:
    gakki*=w
  
  
  if ans is None:
    ans=gakki
  else:
    if ans<gakki:
      print('Yes')
      ans=gakki
    else:
      print("No")
      ans=gakki

Submission status: Time Limit Exceeded

Solution code:
from collections import defaultdict,deque
import math
def gcd(a,b):
    return b if not a%b else gcd(b,a%b)
def lcm(a,b):
    return (a*b)//gcd(a,b)

def main():
    n,k=map(int, input().split())
    a=[int(i) for i in input().split()]
    tmp = 0
    res = []
    tmp = 1
    tmp2 = a[0]
    for i in range(k):
        tmp*=a[i]
    res.append(tmp)
    ind = 0
    for i in range(k,n):
        tmp/=tmp2
        tmp*=a[i]
        ind+=1
        tmp2 = a[ind]
        res.append(tmp)

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


if __name__ == '__main__':
    main()

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

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:
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log2, gcd
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left, insort, insort_left
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def TUPLE(): return tuple(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7 
#mod = 998244353
#from decimal import *
#import numpy as np
#decimal.getcontext().prec = 10

def main():
	N, K = MAP()
	A = LIST()

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

	tmp2 = tmp
	for i in range(K, N):
		tmp =  tmp // A[i-K] * A[i]
		if tmp2 < tmp:
			print("Yes")
		else:
			print("No")
		tmp2 = tmp
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]
# s = sum(a[:k])
pre = s
for i in range(1,n-k+1):
    s /= a[i-1]
    s *= a[i+k-1]
    if s > pre:
        print("Yes")
    else:
        print("No")
    pre = s

Submission status: Time Limit Exceeded

Solution code:
import numpy as np

n,k=map(int,input().split())
A=list(map(int,input().split()))
rn=np.array([1]*n)
for i in range(n):
  rn[i:min(n,i+k)]=rn[i:min(n,i+k)]*A[i]
  
for i in range(k,n):
  if rn[i-1]<rn[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 = 1
for i in range(K):
    s *= A[i]
j = 0
for i in range(K,N):
    x = s / A[j] * A[i]
    if x > s:
        print("Yes")
    else:
        print("No")
    s = x
    j += 1

Submission status: Time Limit Exceeded

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

scores = []
p = 1
for k in range(K):
    p *= A[K-k]
scores.append(p)
for i in range(K+1,N+1):
    p *= A[i]
    p //= A[i-k-1]
    scores.append(p)

l = len(scores)-1
for i in range(l):
    print(["No","Yes"][scores[i+1]>scores[i]])

Submission status: Time Limit Exceeded

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

for i in range(K+1,N+1):
#  print(A[i-K-1:i-1],A[i-K:i])
  if sum(A[i-K-1:i-1]) < sum(A[i-K: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()))
tmp = [1 for i in range(N-K+1)]

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

for i in range(1, N-K+1):
    if tmp[i-1] < tmp[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(1,n):
    a[i] = a[i] * a[i-1]

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

Submission status: Time Limit Exceeded

Solution code:
N,K=map(int,input().split())
score=list(map(int,input().split()))
for i in range(N-K):
  pre=1
  af=1
  for t in range(K):
    pre*=score[t+i]
    af*=score[t+1+i]
  if pre<af:
    print("Yes")
  else:
    print("No")

Submission status: Time Limit Exceeded

Solution code:
#C
N, K = map(int, input().split())
A = list(map(int, input().split()))
p=[]
for i in range(N-K+1):
    ans=1
    for x in range(K):
        ans=ans*A[i+x]
    p.append(ans)

for j in range(len(p)-1):
    if p[j]<p[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()))
ans=list()
tmp=1
for i in range(K):
    tmp=tmp*A[i]
for i in range(K,N):
    tmp_old=tmp
    tmp=tmp_old*A[i]//A[i-K]
    if tmp_old<tmp:
        ans.append('Yes')
    else:
        ans.append('No')
for i in ans:
    print(i)

Submission status: Time Limit Exceeded

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


    
if '__main__' == __name__:
    resolve()

Submission status: Time Limit Exceeded

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

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

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

Submission status: Time Limit Exceeded

Solution code:
n,k=map(int,input().split())
al=list(map(int,input().split()))
b=1
for v in al[:k]:
    b*=v
for i in range(k,n):
    c=1
    for v in al[i-k+1:i+1]:
        c*=v
    print('Yes'if b<c else 'No')
    b=c

Submission status: Time Limit Exceeded

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

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

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

Submission status: Time Limit Exceeded

Solution code:
def resolve():
    '''
    code here
    '''
    N, K = [int(item) for item in input().split()]
    As = [int(item) for item in input().split()]

    all_prod_list = [As[0]]
    for i in range(1,N):
        all_prod_list.append(all_prod_list[i-1]*As[i])

    
    is_flag = False
    prev_score = all_prod_list[K-1]
    for i in range(K,N):
        if prev_score < prev_score // As[i - K] * As[i]:
            print('Yes')
        else:
            print('No')

if __name__ == "__main__":
    resolve()

Submission status: Time Limit Exceeded

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

hyouten = [0] * (N)

# 評点計算
for i in range(K-1, N):
    if i == K - 1:
        tmp = A[i]
        for j in range(1,K):
            tmp *= A[i-j]
    else:
        tmp //= A[i-K]
        tmp *= A[i]
    hyouten[i] = tmp

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

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

tmp_index = 0
for i in range(n-k):
  before = first
  after = first / a[tmp_index] * a[k+i]
  if before < after:
    print("Yes")
  else:
    print("No")
  first = after
  tmp_index += 1

Submission status: Time Limit Exceeded

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

nums = [0]*n
for i in range(n-k+1):
  nums[k+i-1] = sum(a[i:k+i])

for i in range(k,n):
  if nums[i-1] < nums[i]: 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()))

for i in range(N-K) :
    x=reduce(mul,A[i:i+K])
    y=reduce(mul,A[i+1:i+K+1])
    if x<y :
        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()))
# 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, n):
    total = pre/a[i-k]
    total *= a[i]
    # print(total)
    if total > pre:
        print("Yes")
    else:
        print("No")
    pre = total

Submission status: Time Limit Exceeded

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

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

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

    conf = tmp

Submission status: Time Limit Exceeded

Solution code:
n, k = [int(w) for w in input().split()]
la = [int(w) for w in input().split()]

mul = 1
for i in range(k-1):
    mul *= la[i]


score = [0]*(n-k+1)

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


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

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

Submission status: Time Limit Exceeded

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

    def multi(given_list):
        ans = 1
        for i in given_list:
            ans *= i
        return ans


    score_list = [multi(a[i:k+i]) for i in range(n - k + 1)]
    for i in range(len(score_list)-1):
        if score_list[i] < score_list[i+1]:
            print("Yes")
        else:
            print("No")

Submission status: Time Limit Exceeded

Solution code:
from operator import mul
from functools import reduce

if __name__ == "__main__":
    N, K = map(int, input().split())
    A = list(map(int, input().split()))

    score = reduce(mul, A[:K])
    for i in range(K, len(A)):
        if A[i-K] < A[i]:
            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 = current
  count += 1

Submission status: Time Limit Exceeded

Solution code:
n, k = map(int, input().split())
a = tuple(map(int, input().split()))
# 累積積を求める
acc = []
acc.append(a[0])
for v in a[1:]:
    acc.append(acc[-1]*v)
cand = []
cand.append(acc[k-1])
tmp = k
while tmp <= n-1:
    cand.append(acc[tmp]//acc[tmp-k])
    tmp += 1
for i in range(len(cand)-1):
    if cand[i] < cand[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()))

tmp = 1
for a in range(K):
    tmp *= A[a]

for i in range(K, N):
    c = tmp
    c = c // A[i - K]
    c *= A[i]
    if c > tmp:
        print("Yes")
    else:
        print("No")
    tmp = c

Submission status: Time Limit Exceeded

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


# 入力を整数に変換して受け取る
def input_int():
    return int(input())


# マイナス1した値を返却
def int1(x):
    return int(x) - 1


# 半角スペース区切り入力をIntに変換してMapで受け取る
def input_to_int_map():
    return map(int, input().split())


# 半角スペース区切り入力をIntに変換して受け取る
def input_to_int_tuple():
    return tuple(map(int, input().split()))


# 半角スペース区切り入力をIntに変換してマイナス1した値を受け取る
def input_to_int_tuple_minus1():
    return tuple(map(int1, input().split()))


def main():
    n, k = input_to_int_map()
    a_array = input_to_int_tuple()

    temp = [1]
    val = 1
    for a in a_array:
        val *= a
        temp.append(val)

    for i in range(k + 1, n + 1):
        k_val = temp[i]
        ini_k_val = temp[i - k]
        pre_k_val = temp[i - 1]
        ini_pre_k_val = temp[i - 1 - k]
        k_val /= ini_k_val
        pre_k_val /= ini_pre_k_val

        if pre_k_val < k_val:
            print("Yes")
        else:
            print("No")


if __name__ == "__main__":
    main()

Submission status: Time Limit Exceeded

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

i = k-1
bef = 0
hyouka = 1
while i < len(listA):
    if i == k-1:
        p = 0
        while p < k:
            hyouka*=listA[p]
            p+=1
    else:
        newHyouka = hyouka*listA[i]//listA[i-k]
        if newHyouka > hyouka:
            print("Yes")
        else:
            print("No")
        hyouka = newHyouka
    i+=1

Submission status: Time Limit Exceeded

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

s = 1
d = 1
last = 0
for i in range(n):
    s *= a[i]
    if i - k >= 0:
        d*=a[i-k]
    num = s // d

    #print(f'{num} {last}')
    if i-1 >= k-1:
        if last >= num:
            print('No')
        else:
            print('Yes')
    last = num

Submission status: Time Limit Exceeded

Solution code:
# 入力
N,K = list(map(int, input().split()))
A_list = list(map(int, input().split()))

for i in range(N-K):
    score1, score2 = (1,1)
    for j in range(K):
        score1 *= A_list[i+j]
        score2 *= A_list[i+j+1]
    if((score2 - score1) > 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()))
temp_1 = 1 #今
temp_2 = 1 #昔

for i in range(N):
    if i==0:
        temp_1 *= A[i]
    elif i<=(K-1):
        temp_2 = temp_1
        temp_1 *= A[i]
    if i>(K-1):
        temp_2 = temp_1
        temp_1 /= A[i-K]
        temp_1 *= A[i]
        if temp_2<temp_1:
            print('Yes')
        else:
            print('No')

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
first = [int(x) for x in input().split()]
n = first[0]
k = first[1]

arr = [int(x) for x in input().split()]

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


for i in range(k , n):
	prev = prod
	prod = prod / arr[i - k]
	prod = prod * arr[i]
	if prod > prev:
		print("Yes")
	else:
		print("No")

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
from sys import stdin,stdout
def fn(i):
    return pro[i]//(pro[i-k] if i-k>=0 else 1)
n,k=map(int,stdin.readline().split())
a=list(map(int,stdin.readline().split()))
pro=[a[0]]
for v in a[1:]:
    pro+=[pro[-1]*v]
for i in range(k,n):
    #print(fn(i),fn(i-1))
    if fn(i)>fn(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 = [1 for _ in range(N)]
for i in range(K-1,N):
  for j in range(K):
    score[i] *= A[i-j]
  
for k in range(K-1,N-1):
  if score[k] < score[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()))

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

for j in range(n-k):
    tmp = pre//A[j]*A[j+k]
    if pre<tmp:
        print('Yes')
    else:
        print('No')
    pre=tmp

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
import sys
import copy
def S(): return sys.stdin.readline().rstrip()
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())
INF = 1000000000000

n,k = LI()
a = LI()

preval = 1
val = 1
for i in range(n):
    val = val * a[i]
    if(i >= k):
        val = val // a[i-k]
        if(preval < val):
            print('Yes')
        else:
            print('No')
    preval = val

Submission status: Time Limit Exceeded

Solution code:

t=1
for _ in range(t):
	n,k = map(int,input().split())
	arr = list(map(int, input().split()))
	ans = 1;
	for i in range(k):
		ans *= arr[i]
	ind=0
	j=k
	for i in range(n-k):
		temp = ans
		ans = ans // arr[ind]
		ans *= arr[j]
		if ans > temp:
			print("Yes")
		else:
			print("No")
		j+=1
		ind+=1

Submission status: Time Limit Exceeded

Solution code:
def solve():
    n,k=input().split()
    A=list(map(int,input().split()))
    n=int(n)
    k=int(k)
    M=[]
    for i in range(0,n-k+1):
        s=1
        for j in range(i,i+k):
            s=s*A[j]
        M.append(s)
        # print(M)
    for i in range(1,len(M)):
        if M[i]>M[i-1]:
            print("Yes")
        else:
            print("No")

solve()

Submission status: Time Limit Exceeded

Solution code:
N,K=map(int,input().split())
a=list(map(int,input().split()))
queue=[]
pre=1
for i in range(K):
    aa=a.pop(0)
    pre*=aa
    queue.append(aa)
for i in range(K,N,1):
    aq=queue.pop(0)
    aa=a.pop(0)
    queue.append(aa)
    now=pre*aa//aq
    if now>pre:
        print("Yes")
    else:
        print("No")
    pre=now

Submission status: Time Limit Exceeded

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

# prepare
mul = 1
for i in range(k):
    mul *= a[i]

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

Submission status: Time Limit Exceeded

Solution code:
#!/usr/bin python3
# -*- coding: utf-8 -*-

N, K = map(int, input().split())
A = list(map(int, input().split()))
Hk = 1
for i in range(K):
    Hk*=A[i]

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

Submission status: Time Limit Exceeded

Solution code:
def main():
    N, K = list(map(int, input().split(' ')))
    Ai = list(map(int, input().split(' ')))
    # print(Ai)
    P = []
    prev = 0
    now = 0
    for i, n in enumerate(range(K-1, N)):
        # P.append(sum(Ai[n-K+1:n+1]))
        
        if i > 0:
            # print('a', n)
            prev = now
            now = sum(Ai[n-K+1:n+1])
            # print(now, prev)
            if now > prev:
                print('Yes')
            else:
                print('No')
        else:
            # print('b', n)
            now = sum(Ai[n-K+1:n+1])
            
            
    # # print(P)
    # for i in range(len(P)-1):
    #     if P[i+1] > P[i]:
    #         print('Yes')
    #     else:
    #         print("No")
        

main()

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]

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

Submission status: Time Limit Exceeded

Solution code:
from sys import stdin
input = stdin.readline


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

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

  pre = S[K]/S[0]
  for i in range(K+1, N+1):
    temp = S[i]/S[i-K]
    if pre < S[i]/S[i-K]:
      print('Yes')
    else:
      print('No')
    pre = temp


if(__name__ == '__main__'):
  main()

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(len(A)):
    if i == 0:
        P.append(A[i])
    else:
        P.append(P[-1]*A[i])
L = []
for i in range(K,N+1):
    L.append(P[i]//P[i-K])


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

Submission status: Time Limit Exceeded

Solution code:
import sys
n,k = map(int, sys.stdin.readline().rstrip("\n").split())
a = [int(s) for s in sys.stdin.readline().rstrip("\n").split()]
kmt = []
p = 1
for i in range(k):
    p *= a[i]
kmt.append(p)
for i in range(k,n):
    p = p * a[i] // a[i-k]
    kmt.append(p)
i = 0
while i+1< len(kmt):
    if kmt[i] < kmt[i+1]:
        print('Yes')
    else:
        print('No')
    i += 1

Submission status: Time Limit Exceeded

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


for i in range(k,n+1):
    for j in range(k):
        score*=a[i-k+j]
    s.append(score)
    score=1
#print(s)

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

Submission status: Time Limit Exceeded

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

value = 1
for i in range(k):
    value = value * alis[i]

vlis = [value]

for i in range(k,n):
    vlis.append(vlis[i-k]*alis[i]/alis[i-k])

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

Submission status: Time Limit Exceeded

Solution code:
# import sys
# import math #sqrt,gcd,pi
# import decimal
# import queue # queue
# import bisect
# import heapq # priolity-queue
# import time
# from itertools import product,permutations,\
    # combinations,combinations_with_replacement
# 重複あり順列、順列、組み合わせ、重複あり組み合わせ
# import collections # deque
# from operator import itemgetter,mul
# from fractions import Fraction
# from functools import reduce

mod = int(1e9+7)
# mod = 998244353
INF = 1<<50

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

def main():
    n,k = readInt()
    a = readInt()
    ans = []
    res = 1
    for i in range(n):
        x = res
        if i<k:
            res *= a[i]
        else:
            res //= a[i-k]
            res *= a[i]
            if res>x:
                ans.append("Yes")
            else:
                ans.append("No")
    print("\n".join(ans))
    return

if __name__=='__main__':
    main()

Submission status: Time Limit Exceeded

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

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

Submission status: Time Limit Exceeded

Solution code:
N, K = map(int, input().split())
list_A = list(map(int, input().split()))
results = []
for i in range(N - K + 1):
    result = 1
    for j in range(K):
        result *= list_A[j + i]
    results.append(result)

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

Submission status: Time Limit Exceeded

Solution code:
#!/usr/bin/env python3
import sys
from collections import deque

YES = "Yes"  # type: str
NO = "No"  # type: str


def solve(N: int, K: int, A: "List[int]"):

    A = deque(A)
    a = deque()

    p = 1
    for i in range(K):
        t=A.popleft()
        p*=t
        a.append(t)
    
    for i in range(K, N):
        t = A.popleft()
        c = a.popleft()
        if t > c: print(YES)
        else: print(NO)
        a.append(t)

    return


# Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    K = int(next(tokens))  # type: int
    A = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    solve(N, K, A)

if __name__ == '__main__':
    main()

Submission status: Time Limit Exceeded

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

sum=1

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

hoge=[0 for i in range(n)]

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

for i in range(k,n):
    #print(hoge[i-1],hoge[i],end=" ")
    if hoge[i-1]<hoge[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=[0]*(N-K)

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

Submission status: Time Limit Exceeded

Solution code:
def main():
    n,k = map(int, input().split())
    a = list(map(int, input().split()))
    a2 = [1] * (n-k+1)
    for i in range(n-k+1):
        for j in range(i,i+k):
            a2[i] *= a[j]
    #print(a2)
    for i in range(len(a2)-1):
        if a2[i] < a2[i+1]:
            print("Yes")
        else:
            print("No")

if __name__ == '__main__':
    main()

Submission status: Time Limit Exceeded

Solution code:
def prod(x):
    c = 1
    for i in x:
        c *= i
    return c
        
n,k = map(int,input().split())
a = list(map(int,input().split()))
for i in range(0,n-k):
    if prod(a[i:k+i]) < prod(a[i+1:k+i+1]):
        print('Yes')
    else:
        print('No')

Submission status: Time Limit Exceeded

Solution code:
# coding: utf-8

import itertools
from functools import reduce
from collections import deque

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

seiseki = deque([])
seiseki2 = []
for i in range(N):
    seiseki.append(A[i])
    if len(seiseki) == K:
        seiseki2.append(reduce(lambda a, b: a * b, seiseki, 1))
        seiseki.popleft()

zenkai = seiseki2[0]
for i in range(1, len(seiseki2)):
    if seiseki2[i] > zenkai:
        print("Yes")
    else:
        print("No")
    zenkai = seiseki2[i]

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

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

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

Submission status: Time Limit Exceeded

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

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

s = 0

for i in range(k, n):
  tmp = score * arr[i] / arr[s]
  if tmp > score:
    print("Yes")
  else:
    print("No")
  score = tmp
  s += 1

Submission status: Time Limit Exceeded

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

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