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:
"""
AtCoder :: M-Solutions Programming Contest 2020 :: Marks
https://atcoder.jp/contests/m-solutions2020/tasks/m_solutions2020_c
"""
import sys
from functools import reduce
from operator import mul


def solve(A, K):
    """Solve puzzle."""
    solns = []
    grade = reduce(mul, A[:K])
    for i in range(K, len(A)):
        grade0 = (grade // A[i-K]) * A[i]
        if grade0 > grade:
            solns.append('Yes')
        else:
            solns.append('No')
        grade = grade0
    return(solns)


def main():
    """Main program."""
    N, K = (int(i) for i in sys.stdin.readline().split())
    A = [int(i) for i in sys.stdin.readline().split()]
    print("\n".join(solve(A, K)))


if __name__ == '__main__':
    main()

Submission status: Time Limit Exceeded

Solution code:
import sys

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

N,K = LI()
A = LI()

hyoten = [1] * (N-K+1)

for i in range(N-K+1):
    for q in range(K):
        hyoten[i] *= A[i+q]


for j in range(len(hyoten)-1):
    if (hyoten[j+1]>hyoten[j]):
        print('Yes')
    else:
        print('No')

Submission status: Time Limit Exceeded

Solution code:
N, K = list(map(int, input().split()))
scores = list(map(int, input().split()))
K_score = [0] * K
pre = -1
for i in range(N):
    for j in range(0, K - 1):
        K_score[j] = K_score[j + 1]
    K_score[-1] = scores[i]

    if 0 in K_score: # K + 1回目 かどうか
        continue
    now = sum(K_score) / K
    if pre != -1: # K + 2回目 かどうか
        print('Yes' if now > pre else 'No')
    pre = now

Submission status: Time Limit Exceeded

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

ns = list()
first = 1
for i in range(K):
    first *= scores[i]
ns.append(first)
for i in range(0, N-K):
    ns.append(ns[i] * scores[i+K] // scores[i])
    if ns[i] < ns[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()))
for i in range(K,N):
    if i==K:
        tmp=1
        for j in range(1,K):
            tmp*=A[j]
        a=tmp*A[0]
        b=tmp*A[K]
    else:
        a=b
        b=b/A[i-K]*A[i]
    if a<b: print('Yes')
    else: print('No')

Submission status: Time Limit Exceeded

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

scores=[]
for i in range(0,K):
    scores.append(A[i])

for j in range(K,N):
    if 0 in scores:
        scores.pop(0)
        scores.append(A[j])
        if 0 in scores:
            print("No")
        else:
            print("Yes")
    elif scores.pop(0)<A[j]:
        print("Yes")
        scores.append(A[j])
    else:
        print("No")
        scores.append(A[j])

Submission status: Time Limit Exceeded

Solution code:
# coding: utf-8
#import math
#import numpy
#N = int(input())
import sys
input = sys.stdin.readline
N, K = map(int,input().split())
A = list(map(int,input().split()))
#K =int(input())
ANS = []
a = 1
for i in range(K):
    a *= A[K-i-1]
ANS.append(a)
for i in range(K,N):
    a *=A[i]
    a //= A[i-K]
    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:
'''

                            Online Python Compiler.
                Code, Compile, Run and Debug python program online.
Write your code in this editor and press "Run" button to execute it.

'''

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

su=1
for i in range(k):
    su*=l[i]
sum1=su
p=0

for i in range(k,n):
    su//=l[p]
    su*=l[i]

    if su>sum1:
        print("Yes")
    else:
        print("No")
    sum1=su
    p+=1

Submission status: Time Limit Exceeded

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

n,k = map(int,input().split())
l = list(map(int,input().split()))
#print(l)
cnt = l[k-1]
p = 1
g = k-1
i = 0
while(i < k-1):
    cnt = cnt*l[g-1]
    g = g-1
    i = i+1

g = g+1
pr = l[g-1]
while(k < n):
    if l[k] > pr:
        sys.stdout.write("Yes")
        print("")

    else:
        sys.stdout.write("No")
        print("")
    g = g+1
    pr = l[g-1]
    k = k+1

Submission status: Time Limit Exceeded

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

pre=1
grade = [0]*(N+5)
for i,num in enumerate(A):
    if(i<K-1):
        pre*=num
    elif(i==K-1):
        grade[i] = pre*A[i]
    else:
        grade[i] = (grade[i-1]/A[i-K])*A[i];
        
for i in range(K,N,1):
    if(grade[i-1]<grade[i]):
        print("Yes")
    else:
        print("No")

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
def isSucess(R, G, B):
    if B > G > R:
        return True
    else:
        return False


def marks_C():
    N, K = map(int, input().split())
    scores = list(map(int, input().split()))

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

        if calc_score(scores[i + 1:k + 1]) > calc_score(scores[i:k]):
            print('Yes')
        else:
            print('No')


def calc_score(score: list):
    total = 1
    for i in score:
        total *= i
    return total


def main():
    marks_C()


if __name__ == '__main__':
    main()

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

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

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

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

Submission status: Time Limit Exceeded

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

ans = [0] * (N)
temp = [0] * (N)
temp[0] = A[0]

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

ans[0] = A[0]
for i in range(N):
  ans[i] = temp[i]
  if i >= K:
    ans[i] /= temp[i - K]

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

Submission status: Time Limit Exceeded

Solution code:
import sys
input = sys.stdin.readline
import numpy as np

n, k = map(int, input().split())
AA =[]
c =False
for a in input().strip().split():
    a = int(a)
    if not c:
        AA+= [a]
        if len(AA) == k:
            c = True
    else:
        base = AA[0]
        if a - base > 0:
            print("Yes")
        else:
            print("No")
        AA = AA[1:]+[a]

Submission status: Time Limit Exceeded

Solution code:
import sys


def input(): return sys.stdin.readline().strip()
def I(): return int(input())
def LI(): return list(map(int, input().split()))
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def S(): return input()
def LS(): return input().split()


INF = float('inf')


n, k = LI()
a = LI()
base = 1
for elem in a[:k]:
    base *= elem
for i in range(k, n):
    now = (base//a[i - k]) * a[i]
    if base < now:
        ans = 'Yes'
    else:
        ans = 'No'
    base = now
    print(ans)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
#from statistics import median
#import collections
#aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]
from fractions import gcd
from itertools import combinations,permutations,accumulate # (string,3) 3回
#from collections import deque
from collections import deque,defaultdict,Counter
import decimal
import re
#import bisect
#
#    d = m - k[i] - k[j]
#    if kk[bisect.bisect_right(kk,d) - 1] == d:
#
#
#
# pythonで無理なときは、pypyでやると正解するかも！！
#
#
# my_round_int = lambda x:np.round((x*2 + 1)//2)
# 四捨五入
import sys
sys.setrecursionlimit(10000000)
mod = 10**9 + 7
#mod = 9982443453
def readInts():
  return list(map(int,input().split()))
def I():
  return int(input())
n,k = readInts()
A = readInts()
res = [0] * (n-k+1)
pa = 1
for i in range(k):
    pa *= A[i]
res[0] = pa
for i in range(1,n-k+1):
    res[i] = res[i-1] * A[i+k-1] // A[i-1]
#print(res)
for i in range(1,n-k+1):
    if res[i-1] < res[i]:
        print('Yes')
    else:
        print('No')

Submission status: Time Limit Exceeded

Solution code:
tmp=input().split(' ')
tmp_s=input().split(' ')
score=[]
leng=int(tmp[0])-int(tmp[1])+1
for i in range(leng):
  t=1
  for j in range(int(tmp[1])):
    t=t*int(tmp_s[j+i])
  score.append(t)
for i in range(len(score)-1):
  if score[i]<score[i+1]:
    print('Yes')
  else:
    print('No')

Submission status: Time Limit Exceeded

Solution code:
from operator import mul
from functools import reduce

N,K = map(int,input().split())
A = list(map(int,input().split()))  
tempA = reduce(mul, A[0:K])

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

Submission status: Time Limit Exceeded

Solution code:
N, K = map(int, input().split())
A = list(map(int, input().split()))
DP = [1] * (2 * 10 ** 6)
DP[0] = A[0]
for i in range(1, K):
    DP[i] = DP[i - 1] * A[i]


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

Submission status: Time Limit Exceeded

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

medium = 1
for k in range(K):
    medium = medium*A[k]

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

Submission status: Time Limit Exceeded

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

res=[0]*(n-k+1)
for i in range(n-k+1):
    x = 1
    for j in A[i:k+i]:
        x *= j
    res[i]=x
for i in range(1,len(res)):
    if res[i] > res[i-1]:
        print('Yes')
    else:
        print('No')

Submission status: Time Limit Exceeded

Solution code:
def main():
    N, K = map(int, input().split())
    As = list(map(int, input().split()))
    hyouka = [0]*(N-K+1)
    
    for i in range(N-K+1):
        kekka = 1
        for j in As[i:i+K]:
            kekka *= j
            hyouka[i]=kekka
    #print(hyouka)
    for j in range(len(hyouka)):
        if j>0:
            if hyouka[j] > hyouka[j-1]:
                print('Yes')
            else:
                print("No")

if __name__ == '__main__':
    main()

Submission status: Time Limit Exceeded

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

a_lst = list(map(int, input().split(" ")))

# previousの値を取っておいて真に掛け算した評定が高かったかを判定
previous = 1
for i in range(k):
    previous *= a_lst[i]
for i in range(k, n):
    now = previous / a_lst[i - k] * a_lst[i]
    if now > previous:
        print("Yes")
    else:
        print("No")
    previous = now

Submission status: Time Limit Exceeded

Solution code:
import itertools
import operator
n,k = map(int,input().split())
a = list(map(int,input().split()))
cumpro = list(itertools.accumulate(a, func=operator.mul))
j = 0
for i in range(k,n):
    if j==0:
        last = cumpro[i-1]
        now = cumpro[i]//cumpro[j]
    else:
        now,last = cumpro[i]//cumpro[j],now
    print(['No','Yes'][last<now])
    j+=1

Submission status: Time Limit Exceeded

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

num = N-K
X = 1
for i in range(K):
    X*=A[i]
    
for i in range(num):
    y = X
    X //= A[i]
    X *= A[i+K]
    if X<y or X==y:
        
        print("No")
        
    else:
        print("Yes")

Submission status: Time Limit Exceeded

Solution code:
from collections import deque
N, K = list(map(int, input().split()))

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

score = [0]*N
dq = []

for i in range(0, K):
    dq.append(A[i])
score_now = 1
for i in range(len(dq)):
    score_now *= dq[i]

for j in range(K-1, N-1):
    score[j] = score_now

    left = dq[0]
    del dq[0]
    score_now /= left
    dq.append(A[j+1])
    score_now *= A[j+1]
score[N-1] = score_now


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

Submission status: Time Limit Exceeded

Solution code:
import sys
import math
import statistics
import heapq

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

def segfunc(x, y):
    # print("mult({}, {})".format(x, y))
    return x * y

class SegTree:
    def __init__(self, init_val, segfunc, ide_ele):
        n = len(init_val)
        self.segfunc = segfunc
        self.ide_ele = ide_ele
        self.num = 1 << (n - 1).bit_length()
        self.tree = [ide_ele] * 2 * self.num
        for i in range(n):
            self.tree[self.num + i] = init_val[i]
        for i in range(self.num - 1, 0, -1):
            self.tree[i] = self.segfunc(self.tree[2 * i], self.tree[2 * i + 1])

    def update(self, k, x):
        k += self.num
        self.tree[k] = x
        while k > 1:
            self.tree[k >> 1] = self.segfunc(self.tree[k], self.tree[k ^ 1])
            k >>= 1

    def query(self, l, r):
        res = self.ide_ele

        l += self.num
        r += self.num
        while l < r:
            if l & 1:
                res = self.segfunc(res, self.tree[l])
                l += 1
            if r & 1:
                res = self.segfunc(res, self.tree[r - 1])
            l >>= 1
            r >>= 1
        return res

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

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

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

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
n,k = 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):
        tmp = 0
        for j in range(k):
            tmp = before
            before *= a[i-j-1]
        memo[i-1] = [before,tmp]
    else:
        before = memo[i-1][0]

    after = memo[i-1][1] * a[i]

    # if not(i in memo):
    #     for j in range(k):
    #         after *= a[i-j]
    #     memo[i] = after
    # else:    
    #     print("memoあり！")
    #     after = memo[i]

    if after > before:
        print("Yes")
    else:
        print("No")

Submission status: Time Limit Exceeded

Solution code:
import sys
import itertools
sys.setrecursionlimit(1000000000)
from heapq import heapify,heappop,heappush,heappushpop
import math
import collections
import copy
import bisect

n,k = map(int,input().split())
a = list(map(int,input().split()))
d = 1
for i in range(k):
    d = d*a[i]
b = [d]
for i in range(n-k):
    c = (b[-1]*a[k+i])//a[i]
    b.append(c)
for i in range(n-k):
    if b[i+1]>b[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()))
li=[1]*(N-K+1)
for i in range(K-1,N):
    for j in range(K):
        li[i-K+1]*=A[i-j]
    if i!=K-1:
        if li[i-K+1]<=li[i-K]:
            print("No")
        else:
            print("Yes")

Submission status: Time Limit Exceeded

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

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

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 = []
bfr = 0
aft = 0
for i in range(k-1, n):
    aft = 1
    for j in reversed(range(k)):
        aft *= b[i - j]
    if bfr != 0:
        if bfr < aft:
            c.append("Yes")
        else:
            c.append("No")
    bfr = aft
            
s_n = '\n'.join(c)
print(s_n)

Submission status: Time Limit Exceeded

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


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

for i in range(k, n):
    for j in range(i-k+1, i+1):
        temp *= A[j]
    if temp > point:
        print("Yes")
        point = temp
        temp = 1
    else:
        print("No")
        point = temp
        temp = 1

Submission status: Time Limit Exceeded

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

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

count = 0
prev = -1
for i in range(K, N+1):
  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:
l = list(map(int,input().split()))
n, k = l[0], l[1]
a = list(map(int,input().split()))

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

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

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

Submission status: Time Limit Exceeded

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

    else:
        m*=l[i]
        cur=m
        dp[i]=m

Submission status: Time Limit Exceeded

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

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

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

Submission status: Time Limit Exceeded

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


for num, i in enumerate(range(k, n)):
    k_i = score * a[i] / a[num]
    if score < k_i:
        print('Yes')
    else:
        print('No')

    score = k_i

Submission status: Time Limit Exceeded

Solution code:
N, K = map(int, input().split())
l = []
Ap = 1
An = 1
i = 0
for x in input().split():
    A = int(x)
    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
    i = i + 1

Submission status: Time Limit Exceeded

Solution code:
from functools import reduce

n, k = map(int, input().split())
a = list(map(int, input().split()))
score = [0] * (n+1)

for i in range(k, n+1):
    score[i] = reduce(lambda x, y: x*y, a[i-k:i], 1)
    if i == k:
        continue
    print('Yes' if score[i-1] < score[i] else 'No')

Submission status: Time Limit Exceeded

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

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

# i=K+1の時、直近K回の期末テストの点数
# p_K = prod(A[:K])
p_K = 1
for i in range(K):
    p_K *= A[i]

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

Submission status: Time Limit Exceeded

Solution code:
# cook your dish here
n, k = list(map(int, input().split()))
l = list(map(int, input().split()))
scores = []
start = k-1
kk = k
i = k-1
while i<n:
    cnt = kk
    temp = 0
    ans = 1
    while cnt>0:
        ans = ans*l[i-temp]
        temp=temp+1
        cnt=cnt-1
    scores.append(ans)
    i=i+1
if len(scores)==1:
    print("Yes")
else:
    i = 1
    while i<len(scores):
        if scores[i]>scores[i-1]:
            print("Yes")
        else:
            print("No")
        i = i+1

Submission status: Time Limit Exceeded

Solution code:
import sys
input_ = input()
n = int(input_.split(' ')[0])
k = int(input_.split(' ')[1])
input_ = input()
a = [0] * n
for i in range(n):
  a[i] = int(input_.split(' ')[i])

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

Submission status: Time Limit Exceeded

Solution code:
import functools
import operator


def prod(arr):
    return functools.reduce(operator.mul, arr)


def main():
    N, K = (int(x) for x in input().split(" "))
    A = [int(x) for x in input().split(" ")]
    lastest_score = prod(A[0:K])
    for i in range(1, N-K+1):
        current_score = lastest_score - A[i-1] + A[i + K-1]
        if lastest_score < current_score:
            print("Yes")
        else:
            print("No")
        lastest_score = current_score


if __name__ == '__main__':
    main()

Submission status: Time Limit Exceeded

Solution code:
n,k=[int(x) for x in input().split()]
a=[int(x) for x in input().split()]
c=1
for i in range(n):
    c*=a[i]
    #規定回数+1から
    if i>=k:
        d=c//a[i-k]
        e=c//a[i]
        print('Yes' if d>e else 'No')
        c=d

Submission status: Time Limit Exceeded

Solution code:
def main(N, K, A):
    for i in range(K-1, N): # 0 から数えるから K-1
        # 総積
        this = A[i-(K-1):i+1]   # 直近3学期． i+1はスライスのときその数字は入らないから．

        # print
        if i != K-1:
            if this[-1] > before[0]:
                print('Yes')
            else:
                print('No')
        before = this


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

Submission status: Time Limit Exceeded

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

S = 1
i = 0
p = A[i]
i += 1

for s in A[:K]:
  S *= s 

for s in A[K:]:
  _S = S
  S = (S // p) * s
  p = A[i]
  i += 1
  if _S < S:
    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 = []
cnt = 0

for i in range(n - k + 1):
    wknum = 1
    point = (k + i -1)
    for j in range(k):
        wknum *= A[point - j]
    score.append(wknum)
    if cnt == 0:
        cnt += 1
        continue
    else:
        if score[i] <= score[i -1]:
            print('No')
        else:
            print('Yes')

Submission status: Time Limit Exceeded

Solution code:
N,K = [int(x) for x in input().split()]
A = [int(x) for x in input().split()]
score = 1
tmp = 0
for i in range(K):
    score *= A[i]
for j in range(N-K):
    tmp = score
    score = score * A[j+K] / A[j]
    if score > tmp:
        print("Yes")
    else:
        print("No")

Submission status: Time Limit Exceeded

Solution code:
import math
N,K=map(int,input().split())
A=list(map(int,input().split()))
count=0
before=0
now=1


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

Submission status: Time Limit Exceeded

Solution code:
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = 1
d = []
for i in range(a[0]-a[1]+1):
  for j in range(i, i+a[1]):
    c *= b[j] 
  d.append(c)
  c = 1
for k in range(a[0]-a[1]):
  if d[k] < d[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()))

mul = [1]
for i in range(n):
    mul.append(mul[i] * A[i])
#print(mul)
output = []
for i in range(k+1, n+1):
    if mul[i]/mul[i-k] > mul[i-1]/mul[(i-1)-k]: output.append("Yes")
    else: output.append("No")
print(*output, sep="\n")

Submission status: Time Limit Exceeded

Solution code:
import sys
input = sys.stdin.readline
def main():
    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(K,N):
        n = tmp * A[i] / A[i-K]
        if n > tmp:
            print('Yes')
        else:
            print('No')
        tmp = n

if __name__ == '__main__':
    main()

Submission status: Time Limit Exceeded

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

scored_list=[]
score=A[k-1]
for i in range(k-1):
    score*=A[k-i-2]
scored_list.append(score)
for i in range(n-k):
    score/=A[i]
    score*=A[k+i]
    scored_list.append(score)
for i in range(len(scored_list)-1):
    if scored_list[i]<scored_list[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()))
p = 0
if n <= 2:
    if a[0] < a[1]:
        exit(print('Yes'))
    else:
        exit(print('No'))
p = 1
for i in range(k): p *= a[i]
for i in range(k,n):
    t = (p // a[i-k]) * a[i]
    if p < t:
        p = t
        print('Yes')
    else:
        p = t
        print('No')

Submission status: Time Limit Exceeded

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

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

tempScore = 1
scoreSet = []

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

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

Submission status: Time Limit Exceeded

Solution code:
def calc(l, k):
  res = 1
  for i in range(k):
    res = res*l[i]
  return res

n, k = map(int, input().split())
a = list(map(int, input().split()))
l = []
i = 0
while i+k <= n:
  tmp = a[i:i+k]
  l.append(calc(tmp, k))
  i += 1

for i in range(1,len(l)):
  if l[i] > l[i-1]:
    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
    pre = b = 0
    for i in range(l):
        result = 1
        for rep in a[i:i+k]:
            result = result*rep
        pre = b
        b = result
        if 0<i:
            if pre<b:
                print('Yes')
            else:
                print('No')
    exit()

Submission status: Time Limit Exceeded

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

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


def solve(N: int, K: int, A: "List[int]"):
    score = 1
    for i in range(K):
        score *= A[i]

    prev_score = score
    for i in range(N-K):
        score /= A[i]
        score *= A[i+K]
        if score>prev_score:
            print(YES)
        else:
            print(NO)
        prev_score = score
    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()))

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


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

Submission status: Time Limit Exceeded

Solution code:
#!/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
i = 0
while i < K:
    scores[i] = A[i]
    i += 1

pre = prod(scores)

while i < N:
    cur = pre
    cur = cur / scores[i % K]
    scores[i % K] = A[i]
    cur = cur * A[i]

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