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:
def prod(A):
    ans = 1
    for a in A:
        ans *= a
    return ans


def solve():
    N, K = [int(x) for x in input().split()]
    A = [int(x) for x in input().split()]
    for i in range(K, N):
        if i < K:
            continue
        if prod(A[i - K + 1:i + 1]) > prod(A[i - K:i]):
            print('Yes')
        else:
            print('No')


if __name__ == "__main__":
    solve()

Submission status: Time Limit Exceeded

Solution code:
import sys

input = sys.stdin.readline

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

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

for i in range(k, n):
    tmp2 = (tmp1 // a[i - k]) * a[i]
    print(["No", "Yes"][tmp1 < tmp2])
    tmp1 = tmp2

Submission status: Time Limit Exceeded

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

p = 1
conta = int(k)

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

while conta <= n-1:
  next_p = p * a[conta] // a[conta-k]
  if next_p > p:
    print('Yes')
  else:
    print('No')
  conta += 1

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:
import sys
N, K = map(int, input().split())

def input():
    return sys.stdin.readline()[:-1]
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:
import math

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

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

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


resolve()

Submission status: Time Limit Exceeded

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

n = a[0]
k = a[1]

c = []

for i in range(k-1, n):
    p = 1
    for j in reversed(range(k)):
        p *= b[i - j]
    c.append(p)
        
for l in range(1, n - k + 1):
    if c[l] > c[l - 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()))

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

pi=[0]*(n-k+1)
s=1
for i in range(n-k+1):
  for j in range(i,k+i):
    s*=a[j]
  pi[i]=s
  s=1

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

Submission status: Time Limit Exceeded

Solution code:
nk = input('')
n = int(nk.split()[0])
k = int(nk.split()[1])

alist = list(map(int,input('').split()))

pre=0
for i in range(n-k+1):
    result=1
    record=""
    for j in range(k):
        result *= alist[j+i]
        record += " " + str(alist[j+i])
#    print("[{}/{}]:{} = {}".format(i,i+k-1,result,record))
    if i>0:
        if result > pre:
            print('Yes')
        else:
            print('No')
    pre=result

Submission status: Time Limit Exceeded

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

for k in range(N-K):
    score1 = reduce(lambda x,y: x*y, A[k:K+k])
    score2 = reduce(lambda x, y: x*y, A[k+1:K+k+1])
    if score1 < score2:
        print("Yes")
    else:
        print("No")

Submission status: Time Limit Exceeded

Solution code:
def mul(A):
    s = 1
    for a in A:
        s *= a
    return s


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

ans = []

now_list = A[0:K]

for i in range(1, N - K + 1):
    if i != 1:
        now_list = next_list
    next_list = A[i:i + K]

    now_score = mul(now_list)
    next_score = mul(next_list)

    if next_score > now_score:
        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]
  out = []
  for i in range(K+1, N+1):
    temp = S[i]/S[i-K]
    if pre < temp:
      # print('Yes')
      out.append('Yes')
    else:
      # print('No')
      out.append('No')
    pre = temp

  print(*out, sep='\n')


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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

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

    array = [0]*n
    for i in range(k-1,n):
        tmp = 1
        for j in range(k):
            tmp *= A[i-j]
        array[i] = tmp

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


if __name__ == '__main__':
    main()

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
from collections import deque


def main():
    n, k = [int(x) for x in input().split()]
    scores = [int(x) for x in input().split()]
    scores_q = deque(scores)
    news = deque(scores[k:])
    former = 0
    rank = 1
    for score in scores[:k]:
        rank *= score

    for shift in range(n - k):
        former = rank
        remover = scores_q.popleft()
        new_commer = news.popleft()
        rank //= remover
        rank *= new_commer
        if former < rank:
            print('Yes')
        else:
            print('No')


if __name__ == '__main__':
    main()

Submission status: Time Limit Exceeded

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

for i in range(0,N-K + 1):
    result = 1
    for j in range(i,K + i):
        result = result * Ai[j]
    results.append(result)

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

Submission status: Time Limit Exceeded

Solution code:
# -*- coding: utf-8 -*-
N, K = map(int, input().split())
A = list(map(int, input().split()))

score = [1] * (N-K+1)
for i in range(K, N+1):
  if i == K:
    for j in range(K):
      score[0] *= A[j]
    continue
    
  score[i-K] = (score[i-K-1] // A[i-K-1]) * A[i-1]
  if score[i-K] > score[i-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()))

prev = 1
for i in range(k):
  prev *= A[k-i-1]
 
left = 0
right = k
tmp = prev
while right<n:
  tmp /= A[left]
  tmp *= A[right]
  if tmp>prev:
    print("Yes")
  else:
    print("No")
  prev = tmp
  left += 1
  right += 1

Submission status: Time Limit Exceeded

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

curr=prev=1

for i in range(k):
  curr*=a[i]
prev=curr
for i in range(k,n):
  curr*=a[i]
  curr/=a[i-k]
  if prev<curr:
    print("Yes")
  else:
    print("No")
  prev=curr

Submission status: Time Limit Exceeded

Solution code:
from operator import mul
from functools import reduce
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
    ans = reduce(mul, As[start:n])
    ans2 = ans
    if n != K:
        if ans1 < ans2:
            print("Yes")
        else:
            print("No")

Submission status: Time Limit Exceeded

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

previous_average_a = sum(a[0:k])/k

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

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]

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


if __name__ == '__main__':
    main()

Submission status: Time Limit Exceeded

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

def main():
    list = []
    for i in range(0, n-k+1):
        num = 1
        for j in range(i, i+k):
            num = num * a[j]
            
        list.append(num)
    

    for i in range(0, len(list)-1):
        if list[i] < list[i+1]:
            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()))
ans = ['No' for i in range(n - k)]

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

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

    if cur > pre:
        ans[i - 1] = 'Yes'

    pre = cur
    cur = 1


for i in ans:
    print(i)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

prev = 0
point = 1
ans = []
for i in range(N):
    if i < K:
        point *= A[i]
    else:
        prev = point
        point *= A[i]
        point /= A[i-K]
        if prev < point:
            ans.append(True)
        else:
            ans.append(False)
for i in range(N-K):
    if ans[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()))
pr=1
t=[]
for i in range(len(l)):
    if i<k:
        pr*=l[i]
    else:
        pr1=pr
        pr1*=l[i]
        pr1//=l[i-k]
        if pr<pr1:
            print("Yes")
        else:
            print("No")

Submission status: Time Limit Exceeded

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

ns = list()
c = 0

for i in range(K-1, N):
    tmp = 1
    for j in range(i-K+1, i+1):
        tmp *= scores[j]
    ns.append(tmp)
    if c >= 1 and ns[c-1] < ns[c]:
        print('Yes')
    elif c >= 1 and ns[c-1] >= ns[c]:
        print('No')
    c += 1

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):
    sum_b = sum_a
    sum_b = sum_b // A[i] * A[K + i]
    if sum_a < sum_b:
        print("Yes")
    else:
        print("No")
    sum_a = sum_b

Submission status: Time Limit Exceeded

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

hyoten_i = 1
for i, a in enumerate(A):
  hyoten_prev = hyoten_i
  hyoten_i *= a
  if i + 1 > K:
    hyoten_i = hyoten_i / A[i - K]
    print("Yes" if hyoten_i > hyoten_prev else "No")

Submission status: Time Limit Exceeded

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

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

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

Submission status: Time Limit Exceeded

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



for i in range(N-K+1):
  i = i+K
  sum_list = A_list[i-K:i]
  after = sum(sum_list)
  if(i!=K):
    if(before<after):
      print("Yes")
    else:
      print("No")
  before = after

Submission status: Time Limit Exceeded

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

YES = "Yes"
NO = "No"

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

def prod(A):
    ans = A[0]
    for i in range(1,len(A)):
        ans = ans * A[i]
    return ans

scores = [0] * K
pre = 0
for i in range(N):
    scores[i % K] = A[i]
    cur = prod(scores)

    if i >= K:
        if cur > pre:
            print(YES)
        else:
            print(NO)
    pre = cur

Submission status: Time Limit Exceeded

Solution code:
from functools import reduce

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

before = reduce(lambda x, acc: x * acc, ai[ 0 : k ], 1)

for i in range(n - k):
    after = before * ai[i + k] // ai[i]

    if before < after:
        print('Yes')

    else:
        print('No')

    before = after

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(n):
    if k > i:
        point *= a[i]
        continue
    now = point
    now //= a[i - k]
    now *= a[i]
    if now > point:
        print('Yes')
    else:
        print('No')
    point = now

Submission status: Time Limit Exceeded

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

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

ans_list = [after]
for i in range(n-k):
  ans_list.append(ans_list[i] / a[i] * a[k+i])

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

Submission status: Time Limit Exceeded

Solution code:
from functools import reduce
from operator import mul

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

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

Submission status: Time Limit Exceeded

Solution code:
n, k = map(int, input().split())
a = [ int(x) for x in input().split() ] # list型で代入される。
t = []

for i in range(n-k+1):
    p = 1
    for e in a[i:i+k]:
        p *= e
    t.append(p)
    if i >= 1 and t[i-1] < t[i]:
        print('Yes')
    elif i >= 1 and t[i-1] >= t[i]:
        print('No')

Submission status: Time Limit Exceeded

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

tmp = []
for i in range(k, n + 1):
    t = 0
    for j in range(k):
        if t == 0:
            t = a[i - k + j]
        else:
            t *= a[i - k + j]
    tmp.append(t)

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

Submission status: Time Limit Exceeded

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


import functools
import operator

for i in range(N-K):
  target_1 = LIST_A[i:i+K]
  target_2 = LIST_A[i+1:i+K+1]
  #print(target_1,target_2)
  result_1 = functools.reduce(operator.mul, target_1)
  result_2 = functools.reduce(operator.mul, target_2)
    
  if result_1 < result_2:
    print("Yes")
  else:
    print("No")

Submission status: Time Limit Exceeded

Solution code:
import sys
import math 
N,K = map(int,input().split())
A = list(map(int,input().split()))
p  = 0
def mul(A):
    m = 1
    for i in range(len(A)):
        m*=A[i]
    return m
    
score = []
for i in range(K-1,N):
    lst = A[i-K+1:i+1]
    p = mul(lst)
    score.append(p)

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

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=[]
    a=[1]*(n+1)
    for i in range(len(A)):
        a[i+1]=A[i]*a[i]
    # print(a)
    for i in range(0,n-k+1):
        s=1
        # for j in range(i,i+k):
        #     s=s*A[j]
        s=a[i+k]//a[i]
        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:
# -*- 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)

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

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

        pre_k_val = k_val


if __name__ == "__main__":
    main()

Submission status: Time Limit Exceeded

Solution code:
from collections import deque
from functools import reduce

N, K = [int(n) for n in input().split()]
scores = [int(n) for n in input().split()]

d = deque(maxlen=200001)
for i, score in enumerate(scores, start=1):
    if i < K:
        d.append(score)
    elif i == K:
        d.append(score)
        pre_e = reduce(lambda x, y: x*y, d)
        d.popleft()
    else:
        d.append(score)
        e = reduce(lambda x, y: x*y, d)
        if e > pre_e:
            print('Yes')
        else:
            print('No')
        pre_e = e
        d.popleft()

Submission status: Time Limit Exceeded

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

point = []

for i in range(n-k+1):
    point_new = 1
    for j in range(i,k+i):
        point_new *= li[j]
    point.append(point_new)
    
for i in range(1,len(point)):
    if point[i] > point[i-1]:
        print('Yes')
    else:
        print('No')

Submission status: Time Limit Exceeded

Solution code:
n, k = list(map(int, input().split()))
A = list(map(int, input().split()))
def kakeru(ary):
    result = 1
    for i in ary:
        result *= i
    return result

tmp =  kakeru(A[0:k])
point = tmp
for i in range(n-k):
    point = point * A[k+i] / A[i]
    if point > tmp:
        tmp = point
        print('Yes')
    else:
        tmp = point
        print('No')

Submission status: Time Limit Exceeded

Solution code:
# coding: utf-8
# Your code here!
n, k = map(int, input().split())
a = list(map(int, input().split()))
s = 1
for i in range(n):
    if i < k:
        s *= a[i]
    else:
        s2 = s/a[i-k]*a[i]
        if s < s2:
            print("Yes")
        else:
            print("No")
        s = s2

Submission status: Time Limit Exceeded

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

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

Submission status: Time Limit Exceeded

Solution code:
N, K = map(int, input().split())
l = []
Ap = 0
An = 0
As = list(map(int, input().split()))
for i in range(N):
    A = As[i]
    l.append(A)
    if i < K:
        Ap = Ap + A
    else:
        An = Ap - l.pop(0) + A
        if An > Ap:
            print("Yes")
        else:
            print("No")
        Ap = An

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 = first*a[i]
b = [first]
for i in range(n-k):
    b.append(b[i]/a[i]*a[k+i])
    if b[i] < b[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()))
lst=[1]*n
for i in range(n):
  if i<k-1:
    lst[i]=A[i]
  elif i==k-1:
    temp=1
    for j in range(k):
      temp*=A[j]
    lst[i]=temp
  else:
    temp=lst[i-1]//A[i-k]
    lst[i]=temp*A[i]
    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()))
ans=[0]*(n-k+1)
r=1
for i in range(k):
    r=r*a[i]
ans[0]+=r
for i in range(1,n-k+1):
    ans[i]+=(ans[i-1]*a[i+k-1])//a[i-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()))
A_max=max(A)
for i in A:
    i=i/A_max
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:
n,k=map(int,input().split())
a=list(map(int,input().split()))
j=1
for c in range(k):
    j*=a[c]
for i in range(n-k):
    if j<j/a[i]*a[i+k]:
        print('Yes')
    else:
        print('No')
    j=j/a[i]*a[i+k]

Submission status: Time Limit Exceeded

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

now = 1
i = 0
while i < k:
    now *= a[i]
    i += 1
while i < n:
    old = now
    now = (now / a[i-k]) * a[i]
    print("Yes" if now > old else "No")
    i += 1

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
import sys
input = sys.stdin.readline
# sys.setrecursionlimit(100000)

def main():
    n,k = [int(i) for i in input().strip().split()]
    A = [int(i) for i in input().strip().split()] 
    cur_mul = [1] * n
    for i in range(n):
        if i == 0:
            cur_mul[i] = A[i]
        elif i > 0 and i <= k-1:
            cur_mul[i] = A[i] * cur_mul[i - 1]
        elif i > k-1:
            cur_mul[i] = cur_mul[i - 1] * A[i] // A[i - k]
            if cur_mul[i] > cur_mul[i - 1]:
                print("Yes")
            else:
                print("No")
    return

if __name__ == "__main__":
    main()

Submission status: Time Limit Exceeded

Solution code:
from functools import  reduce
n,k=map(int,input().split())
l=list(map(int,input().split()))
x=reduce(lambda x,y: x*y,l[:k])
temp=[x]
for i in range(k,len(l)):
	x*=l[i]
	x//=l[i-k]
	temp.append(x)
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:
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')

val = 1
for a in A[:k]:
    val *= a
ans = [val]
pos = k
while pos < n:
    tmp = ans[-1]*A[pos]//A[pos-k]
    ans.append(tmp)
    pos += 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()))
X = 1
for i in range(K):
    X *= A[i]
Y = X
for i in range(K, N):
    X = X * A[i] // A[i-K]
    if Y < X:
        print("Yes")
    else:
        print("No")
    Y = X

Submission status: Time Limit Exceeded

Solution code:
N, K = map(int, input().split())
scores = list(map(int, input().split()))
grades =[]
for i in range(K+1,N+2):
    before = 1
    for j in range(K):
        before = before*scores[i-j-2]
    grades.append(before)

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

Submission status: Time Limit Exceeded

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

s = [1] * len(a)
s[0] = a[0]
for i in range(n - 1):
    s[i + 1] = s[i] * a[i + 1]
    
num = [0] * (len(a) - k + 1)
num[0] = s[k - 1]
for i in range(len(a) - k):
    num[i + 1] = s[i + k] // s[i]
    
for i in range(len(a) - k):
    if num[i] < num[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()))

for i in range(n-k):
    if reduce(mul,a[i:k+i]) < reduce(mul,a[i+1:k+i+1]):
        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]
    if i < k:
        rui += [t]
    else:
        rui += [t // rui[i - k + 1]]

#print(rui)

for i in range(n+1):
    if i < k+1: continue
    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()))
b = list()

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

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

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

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

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

Submission status: Time Limit Exceeded

Solution code:
# 2020/07/25
# M-SOLUTIONS プロコンオープン 2020 - C

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

# Calc
pt = a[0]
for i in range(1, n):
    if i <= k - 1:
        pt = pt * a[i]
    else: # i > k - 1
        bef_pt = pt
        pt = pt / a[i-k] * a[i]
        # Output
        if bef_pt < pt:
            print('Yes')
        else:
            print('No')

Submission status: Time Limit Exceeded

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

for i in range(k,n):
    before = 1
    after = 1

    if not(i-1 in memo):
        for j in range(k):
            before *= a[i-j-1]
        memo[i-1] = before
    else:
        before = memo[i-1]

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