Problem:


Score: 300 points

Problem Statement

M-kun is a student in Aoki High School, where a year is divided into N terms.

There is an exam at the end of each term. According to the scores in those exams, a student is given a grade for each term, as follows:

For the first through (K-1)-th terms: not given.

For each of the K-th through N-th terms: the multiplication of the scores in the last K exams, including the exam in the graded term.

M-kun scored A_i in the exam at the end of the i-th term.

For each i such that K+1 \leq i \leq N, determine whether his grade for the i-th term is strictly greater than the grade for the (i-1)-th term.

Constraints

2 \leq N \leq 200000

1 \leq K \leq N-1

1 \leq A_i \leq 10^{9}

All values in input are integers.

Input

Input is given from Standard Input in the following format:

N K
A_1 A_2 A_3 \ldots A_N

Output

Print the answer in N-K lines.

The i-th line should contain Yes if the grade for the (K+i)-th term is greater than the grade for the (K+i-1)-th term, and No otherwise.

Sample Input 1

5 3
96 98 95 100 20

Sample Output 1

Yes
No

His grade for each term is computed as follows:

3-rd term: (96 \times 98 \times 95) = 893760

4-th term: (98 \times 95 \times 100) = 931000

5-th term: (95 \times 100 \times 20) = 190000

Sample Input 2

3 2
1001 869120 1001

Sample Output 2

No

Note that the output should be No if the grade for the 3-rd term is equal to the grade for the 2-nd term.

Sample Input 3

15 7
3 1 4 1 5 9 2 6 5 3 5 8 9 7 9

Sample Output 3

Yes
Yes
No
Yes
Yes
No
Yes
Yes



Sample input:
5 3
96 98 95 100 20


Sample output:
Yes
No

Submission status: Time Limit Exceeded

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

ans = []
val = 1
for i in range(K-1):
    val *= A[i]
for i in range(K-1,N):
    if i==K-1:
        val *= A[i]
        continue
    if val<((val//A[i-K])*A[i]):
        ans.append("Yes")
    else:
        ans.append("No")
    val = val//A[i-K]
    val *= A[i]

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

Submission status: Time Limit Exceeded

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

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

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

Submission status: Time Limit Exceeded

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

S=1
Q=[]
for i in range(K):
    S=S*A[i]
Q.append(S)
for i in range(N-K):
    S=S/A[i]*A[K+i]
    Q.append(S)
    
for i in range(len(Q)-1):
    if Q[i]<Q[i+1]:
        print('Yes')
    else:
        print('No')

Submission status: Time Limit Exceeded

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

termexam = []
for i in range(n):
    if k == n+1:
        break
    termexam.append(list(score_list[i:k]))
    k += 1

i = 0
while i+1 < len(termexam):
    if termexam[i][0] < termexam[i+1][-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()))
ans = []
tmp = 1
#最初のK番目まで
for i in range(k):
  tmp *= a[i]
ans.append(tmp)
for j in range(k,n):
  tmp *= a[j]
  tmp //= a[j-k]
  ans.append(tmp)
for t in range(n-k):
  if ans[t+1] > ans[t]:
    print("Yes")
  else:
    print("No")

Submission status: Time Limit Exceeded

Solution code:
N, K = map(int, input().split())
A = list(map(int, input().split()))
AA = []
for i in range(N - K + 1):
  f = 1
  for j in range(i, i + K):
    f *= A[j]
  AA.append(f)
  
for i in range(len(AA) - 1):
  if AA[i] < AA[i + 1]:
    print("Yes")
  else:
    print("No")

Submission status: Time Limit Exceeded

Solution code:
# でつoO(YOU PLAY WITH THE CARDS YOU'RE DEALT..)
import sys
def main(N, K, A):
    st = SegmentTree(f=lambda x, y: x * y, identity_factory=lambda: 1, initial_values=A)
    prev = st.query(0, K)
    for i in range(K + 1, N + 1):
        curr = st.query(i - K, i)
        print('Yes' if curr > prev else 'No')
        prev = curr

class SegmentTree:
    def __init__(self, n=None, f=max, identity_factory=int, initial_values=None):
        assert(n or initial_values)
        size = n if n else len(initial_values)
        d = [identity_factory() for _ in range(2 * size + 1)]
        self.__n, self.__d, self.__f, self.__e = size, d, f, identity_factory
        if initial_values:
            for i, v in enumerate(initial_values): d[size + i] = v
            for i in range(size - 1, 0, -1): d[i] = f(d[i << 1], d[i << 1 | 1])

    def get_val(self, index):
        return self.__d[index + self.__n]

    def set_val(self, index, new_value):
        i, d, f = index + self.__n, self.__d, self.__f
        if d[i] == new_value: return
        d[i] = new_value
        while i:
            i = i >> 1
            d[i] = f(d[i << 1], d[i << 1 | 1])

    def modify(self, index, value):
        self.set_val(index, self.__f(self.__d[index + self.__n], value))

    def query(self, from_inclusive, to_exclusive):
        ans = self.__e()
        if to_exclusive <= from_inclusive: return ans
        l, r, d, f = from_inclusive + self.__n, to_exclusive + self.__n, self.__d, self.__f
        while l < r:
            if l & 1: ans, l = f(ans, d[l]), l + 1
            if r & 1: ans, r = f(d[r - 1], ans), r - 1
            l, r = l >> 1, r >> 1
        return ans

if __name__ == '__main__':
    input = sys.stdin.readline
    N, K = map(int, input().split())
    *A, = map(int, input().split())
    main(N, K, A)

Submission status: Time Limit Exceeded

Solution code:
from sys import stdin, stdout 
n,k=map(int,input().split())
a=[int(o) for o in input().split()]
prod=1
for i in range(k):
    prod*=a[i]
for i in range(k,n):
    prev=prod
    prod//=a[i-k]
    prod*=a[i]
    if prod>prev: stdout.write("Yes\n")
    else: stdout.write("No\n")

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
#!usr/bin/env python3
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop
from itertools import permutations
import sys
import math
import bisect


def LI(): return [int(x) for x in sys.stdin.readline().split()]


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


def LS(): return [list(x) for x in sys.stdin.readline().split()]


def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res


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 LSR(n):
    return [LS() for i in range(n)]


sys.setrecursionlimit(1000000)
mod = 1000000007


def solve():
    n, k = LI()
    a = LI()
    ans = [1]*n
    for i in range(k-1, n):
        for j in range(k):
            ans[i] *= a[i-j]
        if i > k-1:
            if i == 0 or ans[i] > ans[i-1]:
                print('Yes')
            else:
                print('No')
    return


# Solve
if __name__ == "__main__":
    solve()

Submission status: Time Limit Exceeded

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

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

for i in range(K+1, N+1):
    a_latest, a_last = A[i], A[i-K]
    m_last, m_cur = m_cur, (m_cur // a_last) * a_latest
    if m_last < m_cur:
        print("Yes")
    else:
        print("No")

Submission status: Time Limit Exceeded

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

evals = []
for i in range(0, n-k+1, 1):
  for_eval = scores[i:k+i]
  eval = 1
  for j in for_eval:
    eval *= j
  evals.append(eval)

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

Submission status: Time Limit Exceeded

Solution code:
N, K = list(map(int,input().split()))
A = list(map(int,input().split()))
B = [1 for _ in range(N - K + 1)]

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

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

Submission status: Time Limit Exceeded

Solution code:
from sys import stdin, stdout
import math,sys,heapq
from itertools import permutations, combinations
from collections import defaultdict,deque,OrderedDict
from os import path
import bisect as bi
def yes():print('YES')
def no():print('NO')
if (path.exists('input.txt')): 
    #------------------Sublime--------------------------------------#
    sys.stdin=open('input.txt','r');sys.stdout=open('output.txt','w');
    def I():return (int(input()))
    def In():return(map(int,input().split()))
else:
    #------------------PYPY FAst I/o--------------------------------#
    def I():return (int(stdin.readline()))
    def In():return(map(int,stdin.readline().split()))

def dict(a):
    d={}
    for x in a:
        if d.get(x,-1)!=-1:
            d[x]+=1
        else:
            d[x]=1
    return d

def find_gt(a, x):
    'Find leftmost value greater than x'
    i = bi.bisect_right(a, x)
    if i != len(a):
        return i
    else:            
        return -1

def main():
    try:
        n,k=In()
        l=list(In())   
        ans=[]
        t=1
        last=1
        for x in range(n):
            if x<k:
                last*=l[x]
            else:
                temp=last//l[x-k]
                temp*=l[x]
                if temp>last:
                    stdout.write('Yes'+'\n')
                else:
                    stdout.write('No'+'\n')
                last=temp
        
            

    except:
        pass
        
M = 998244353
P = 1000000007
 
if __name__ == '__main__':
    #for _ in range(I()):main()
    for _ in range(1):main()

Submission status: Time Limit Exceeded

Solution code:
from sys import stdin, stdout
import math,sys,heapq
from itertools import permutations, combinations
from collections import defaultdict,deque,OrderedDict
from os import path
import bisect as bi
def yes():print('YES')
def no():print('NO')
if (path.exists('input.txt')): 
    #------------------Sublime--------------------------------------#
    sys.stdin=open('input.txt','r');sys.stdout=open('output.txt','w');
    def I():return (int(input()))
    def In():return(map(int,input().split()))
else:
    #------------------PYPY FAst I/o--------------------------------#
    def I():return (int(stdin.readline()))
    def In():return(map(int,stdin.readline().split()))

def dict(a):
    d={}
    for x in a:
        if d.get(x,-1)!=-1:
            d[x]+=1
        else:
            d[x]=1
    return d

def find_gt(a, x):
    'Find leftmost value greater than x'
    i = bi.bisect_right(a, x)
    if i != len(a):
        return i
    else:            
        return -1

def main():
    try:
        n,k=In()
        l=list(In())   
        ans=[]
        t=1
        last=1
        for x in range(n):
            if x<k:
                last*=l[x]
            else:
                temp=last//l[x-k]
                temp*=l[x]
                if temp>last:
                    ans.append('Yes')
                else:
                    ans.append('No')
                last=temp
        for x in ans:
            stdout.write(x+'\n')

    except:
        pass
        
M = 998244353
P = 1000000007
 
if __name__ == '__main__':
    #for _ in range(I()):main()
    for _ in range(1):main()

Submission status: Time Limit Exceeded

Solution code:
from sys import stdin, stdout
import math,sys,heapq
from itertools import permutations, combinations
from collections import defaultdict,deque,OrderedDict
from os import path
import bisect as bi
def yes():print('YES')
def no():print('NO')
if (path.exists('input.txt')): 
    #------------------Sublime--------------------------------------#
    sys.stdin=open('input.txt','r');sys.stdout=open('output.txt','w');
    def I():return (int(input()))
    def In():return(map(int,input().split()))
else:
    #------------------PYPY FAst I/o--------------------------------#
    def I():return (int(stdin.readline()))
    def In():return(map(int,stdin.readline().split()))

def dict(a):
    d={}
    for x in a:
        if d.get(x,-1)!=-1:
            d[x]+=1
        else:
            d[x]=1
    return d

def find_gt(a, x):
    'Find leftmost value greater than x'
    i = bi.bisect_right(a, x)
    if i != len(a):
        return i
    else:            
        return -1

def main():
    try:
        n,k=In()
        l=list(In())   
        ans=[]
        t=1
        last=1
        for x in range(n):
            if x<k:
                last*=l[x]
            else:
                temp=last//l[x-k]
                temp*=l[x]
                if temp>last:
                    ans.append('Yes')
                else:
                    ans.append('No')
                last=temp
        for x in ans:
            print(x)

    except:
        pass
        
M = 998244353
P = 1000000007
 
if __name__ == '__main__':
    #for _ in range(I()):main()
    for _ in range(1):main()

Submission status: Time Limit Exceeded

Solution code:
from sys import stdin, stdout
import math,sys,heapq
from itertools import permutations, combinations
from collections import defaultdict,deque,OrderedDict
from os import path
import bisect as bi
def yes():print('YES')
def no():print('NO')
if (path.exists('input.txt')): 
    #------------------Sublime--------------------------------------#
    sys.stdin=open('input.txt','r');sys.stdout=open('output.txt','w');
    def I():return (int(input()))
    def In():return(map(int,input().split()))
else:
    #------------------PYPY FAst I/o--------------------------------#
    def I():return (int(stdin.readline()))
    def In():return(map(int,stdin.readline().split()))

def dict(a):
    d={}
    for x in a:
        if d.get(x,-1)!=-1:
            d[x]+=1
        else:
            d[x]=1
    return d

def find_gt(a, x):
    'Find leftmost value greater than x'
    i = bi.bisect_right(a, x)
    if i != len(a):
        return i
    else:            
        return -1

def main():
    try:
        n,k=In()
        l=list(In())   
        ans=[]
        t=1
        for x in range(k):
            t*=l[x]
        last=t
        i=k
        j=0
        while i<n:
            t*=l[i]
            t//=l[j]
            if t>last:
                ans.append('Yes')
            else:
                ans.append('No')
            last=t
            i+=1
            j+=1
        for x in ans:
            print(x)

    except:
        pass
        
M = 998244353
P = 1000000007
 
if __name__ == '__main__':
    #for _ in range(I()):main()
    for _ in range(1):main()

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]

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

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):
    tmp1 = 1
    tmp2 = 1
    for j in range(i-K, i):
        tmp1 *= A[j]
        tmp2 *= A[j+1]
    if tmp1 < tmp2:
        print('Yes')
    else:
        print('No')

Submission status: Time Limit Exceeded

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

cnt = 1
result = []
AA = len(A[K-1:])

rresult = []
for i in range(AA):
    result_a = 1
    result = A[i:i+K]
    for t in result:
        result_a *= t
    rresult.append(result_a)

for t in range(len(rresult)):
    if t == 0:
        continue
    else:
        if rresult[t] > rresult[t-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()))
mult = 1
str = 'Yes'
for i in range(k):
	mult *= a[i]
for i in range(k, n):
	str = 'Yes'
	if mult>=mult*a[i]/a[i-k]:	
		str = 'No'
	print(str)

Submission status: Time Limit Exceeded

Solution code:
import math
N,K=[int(x) for x in input().split(" ")]
score=[math.log(int(x)) for x in input().split(" ")]
hyo=[]
for i in range(K,N+1):
    hyo.append(sum(score[i-K:i]))
for i in range(N-K):
    print("Yes" if hyo[i+1]>hyo[i] else "No")

Submission status: Time Limit Exceeded

Solution code:
n,k=map(int,input().split())
a=list(map(int,input().split()))
a.reverse()
s=1
for i in range(k):
    s*=a[i]
x=[s]
for i in range(k,n):
    s//=a[i-k]
    s*=a[i]
    x.append(s)
x.reverse()
for i in range(1,len(x)):
    if x[i]>x[i-1]:
        print("Yes")
    else:
        print("No")

Submission status: Time Limit Exceeded

Solution code:
def main():
	[n, k] = raw_input().split();
	n = int(n)
	k = int(k)
	l = raw_input().split();
	for i in range(len(l)):
		l[i] = int(l[i])
	grades = []
	mul = 1;
	for i in range (k):
		mul *= l[i]
	be = 0;
	grades.append(mul)
	for i in range(k, n):
		mul /= l[be]
		mul *= l[i]
		grades.append(mul)
		be += 1
	for i in range(1, len(grades)):
		if (grades[i] <= grades[i-1]):
			print "No"
		else:
			print "Yes"

if __name__ == '__main__':
	main()

Submission status: Time Limit Exceeded

Solution code:
[n, k] = raw_input().split();
n = int(n)
k = int(k)
l = raw_input().split();
for i in range(len(l)):
	l[i] = int(l[i])
grades = []
mul = 1;
for i in range (k):
	mul *= l[i]
be = 0;
grades.append(mul)
for i in range(k, n):
	mul /= l[be]
	mul *= l[i]
	grades.append(mul)
	be += 1
for i in range(1, len(grades)):
	if (grades[i] <= grades[i-1]):
		print "No"
	else:
		print "Yes"

Submission status: Time Limit Exceeded

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


b = []
i = 0
while k != n+1:
    total = 1
    for j in range(i, k):
        total *= a[j]
    b.append(total)
    i += 1
    k += 1
l = len(b)
#print(b)
for i in range(l-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()))
ans=1
for i in range(K):
  ans*=A[i]
for i in range(K,N):
  XX=ans
  ans*=A[i]
  ans//=A[i-K]
  if XX < ans:
    print("Yes")
  else:
    print("No")

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
# Problem C - Marks
# input
N, K = map(int, input().split())
a_nums = list(map(int, input().split()))

# initialization
cumulative_sum = 1
for i in range(K):
    cumulative_sum *= a_nums[i]
cumulative_list = [0] * N
cumulative_list[K-1] = cumulative_sum

# cumulative sum calc
for i in range(K, N):
    cumulative_sum = cumulative_sum // a_nums[i-K]
    cumulative_sum = cumulative_sum * a_nums[i]
    cumulative_list[i] = cumulative_sum

# check
for i in range(K, N):
    if cumulative_list[i]>cumulative_list[i-1]:
        print("Yes")
    else:
        print("No")

Submission status: Time Limit Exceeded

Solution code:
global na, n, sum, k
lsp = {}
lsn = {}
num = {}

if __name__ == '__main__':
    na = input()
    lsn = na.split(' ')
    n = int(lsn[0])
    k = int(lsn[1])
    na = input()
    lsp = na.split(' ')
    for i in range (0, n):
        num[i] = int(lsp[i])
    sum = 1
    for i in range (0, k):
        sum = sum * num[i]
    for i in range (k, n):
        ls = sum
        ls = ls * num[i]
        ls /= num[i-k]
        if sum >= ls:
            print("No")
        else:
            print("Yes")
        sum = ls

Submission status: Time Limit Exceeded

Solution code:
from operator import mul
from functools import reduce

def main():
  N, K = map(int, input().split())
  A = list(map(int, input().split()))
  c = A[0:K]
  a = reduce(mul, c)
  for i in range(N-K):
    c = A[i+1:i+K+1]
    b = reduce(mul, c)
    if a < b:
      print("Yes")
    else:
      print("No")
    a = b


if __name__ == '__main__':
    main()

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()))
b = 1
c = A[0:K]
a = reduce(mul, c)
for i in range(N-K):
  c = A[i+1:i+K+1]
  b = reduce(mul, c)
  if a < b:
    print("Yes")
  else:
    print("No")
  a = b

Submission status: Time Limit Exceeded

Solution code:
N, K = map(int, input().split())
A = list(map(int, input().split()))
a = 1
b = 1
for e in range(K):
  a = a * A[e]
for i in range(N-K):
  for j in range(K):
    b = b * A[i+j+1]
  if a < b:
    print("Yes")
  else:
    print("No")
  a = b
  b = 1

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

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

    for i in range(n - k):
        tmp = ((score // A[i]) * A[k + i])

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

        score = tmp

if __name__ == "__main__":
    main()

Submission status: Time Limit Exceeded

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

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

    for i in range(n - k):
        tmp = (score // A[i]) * A[k + i]

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

        score = tmp

if __name__ == "__main__":
    main()

Submission status: Time Limit Exceeded

Solution code:
n = list(map(int, input().split()))
times = n[0]
term = n[1]
nums = list(map(int, input().split()))
base = nums[0:term]
bScore = sum(base)

for i in range(1, times-term+1):
    compare = sum(nums[i:term+i])
    if bScore < compare:
        print('Yes')
    else:
        print('No')
    bScore = compare

Submission status: Time Limit Exceeded

Solution code:
sem, per = map(int, input().split())
scores = list(map(int, input().split()))
period_score = []

for i in range(len(scores) - (per - 1)):
    period = scores[i:per + i]
    temp = period[0]
    for j in range(1, per):
        temp *= period[j]
        
    period_score.append(temp)
    
for k in range(1, len(period_score)):
    if period_score[k - 1] < period_score[k]:
        print('Yes')
    else:
        print('No')

Submission status: Time Limit Exceeded

Solution code:
def main():
    n,k = map(int,input().split())
    a = [int(i) for i in input().split()]
    ruiseki = [1]
    for i in range(n):
        ruiseki.append(ruiseki[-1]*a[i])
    #ruiseki.pop(0)
    
    ans = [ruiseki[k]/ruiseki[0]]
    for i in range(k+1,n+1):
        tmp = ruiseki[i]/ruiseki[i-k]
        if ans[-1] >= tmp:
            print('No')
        else:
            print('Yes')
        ans.append(tmp)
    
main()

Submission status: Time Limit Exceeded

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

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

        if i >= k:
            if tmp > score:
                print("Yes")
            else:
                print("No")

        score = tmp

if __name__ == "__main__":
    main()

Submission status: Time Limit Exceeded

Solution code:
from functools import reduce
from operator import mul
from collections import deque

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

A = [int(i) for i in input().split()]

B = deque(A[:K])

C = reduce(mul,B)

for i in range(K,N):
  B.popleft()
  B.append(A[i])
  D = reduce(mul,B)
  if C < D:
    print('Yes')
  else:
    print('No')
  C = D

Submission status: Time Limit Exceeded

Solution code:
#Author: M@sud_P@rvez

n,m=list(map(int,input().split()))
a=list(map(int,input().split()))
c=1
p=[]
for i in range(0,(n-m)+1):
    c=1
    for j in range(i,m+i):
        c=c*a[j]
    p.append(c)
for k in range(1,len(p)):
    if p[k]>p[k-1]:
        print("Yes")
    else:
        print("No")

Submission status: Time Limit Exceeded

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

B = []
tmp = 1
for i in range(N):
    tmp *= A[i]
    if i < K-1:
        continue
    if i > K-1:
        tmp //= A[i-K]
    B.append(tmp)

for i in range(N-K):
    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()))
l = [0]*(n-k+1)
t = 1
for i in range(k):
    t *= a[i]
l[0] = t
for i in range(1,n-k+1):
    t = t//a[i-1]
    t = t*a[k+i-1]
    l[i] = t
for i in range(n-k):
    if l[i] < l[i+1]:
        print("Yes")
    else:
        print("No")

Submission status: Time Limit Exceeded

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

Acum = [1] * (N+1)
for i in range(N):
    Acum[i+1] = Acum[i] * A[i]

for j in range(K, N):
    now = Acum[j] // Acum[j-K]
    nxt = Acum[j+1] // Acum[j+1-K]
    if now < nxt:
        print('Yes')
    else:
        print('No')

Submission status: Time Limit Exceeded

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

diff = N-K
for i in range(N-diff, N):
    mul = 1
    if 0 in A[i-K:i]:
        print("No")
        continue
    for j in range(i-K, i):
        mul*=A[j]
    if mul<mul*A[i]/A[i-K]:
        print("Yes")
    else:
        print("No")

Submission status: Time Limit Exceeded

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

def mult(list):
  an = 1
  for i in list:
    an *= i
  return an

vor = mult(s[k-k:k])

for i in range(k, n):
  nach = mult(s[i-k+1:i+1])
  if nach > vor:
    print('Yes')
  else:
    print('No')
  vor = nach

Submission status: Time Limit Exceeded

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

def mult(list):
  an = 1
  for i in list:
    an *= i
  return an

for i in range(k, n):
  vor = mult(s[i-k:i])
  nach = mult(s[i-k+1:i+1])
#  print(s[i])
 # print(vor)
 # print(nach)
  if nach > vor:
    print('Yes')
  else:
    print('No')

# n = number of data
# k = range of evaluation

Submission status: Time Limit Exceeded

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

list = []
count = 1

for i in range(a[0]-a[1]+1):  # 始まりの位置
    for j in range(a[1]):
        count *= b[i+j]
    list.append(count)
    count = 1
for i in range(len(list)-1):
    if list[i+1] > 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()))
score_1=1
for i in range(k):
  score_1=score_1*a[i]
score_2=score_1*a[k]/a[0]
if score_1<score_2:
  print('Yes')
else:
  print('No')
for i in range(k+1,n):
  score_1=score_2
  score_2=score_2*a[i]/a[i-k]
  if score_1<score_2:
    print('Yes')
  else:
    print('No')

Submission status: Time Limit Exceeded

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


def main():
    n, k = map(int, input().split())
    A = list(map(int, input().split()))
    A = [1] + A + [1]
    tmp: int = 1
    for i in range(1, k):
        tmp *= A[i]

    prev:int = 0
    for i in range(k, n + 1):
        prev = tmp
        tmp //= A[i - k]
        tmp *= A[i]
        # print(tmp)
        if i == k:
            continue
        if tmp > prev:
            print('Yes')
        else:
            print('No')


if __name__ == "__main__":
    main()

Submission status: Time Limit Exceeded

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

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

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

Submission status: Time Limit Exceeded

Solution code:
N,K =  map(int,input().split())
l = list(map(int,input().split()))
score=[]
for i in range(K-1,N):
    tmp_score = 1
    for j in range(0,K):
        tmp_score *= l[i-j]
    score.append(tmp_score)
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:
N=list(map(int,input().split()))
A=list(map(int,input().split()))
n=N[0]
k=N[1]
aves=[]
for x in range(n-k+1):
    ave=1
    for i in range(x,k+x):
        ave=ave*A[i]
    aves.append(ave)
for y in range(len(aves)-1):
    if aves[y]<aves[y+1]:
        print("Yes")
    else:
        print("No")

Submission status: Time Limit Exceeded

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

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

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

Submission status: Time Limit Exceeded

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

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

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

Submission status: Time Limit Exceeded

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

# まずK学期の評点を求めておきます
score = 1
for i in range(k):
  score *= A[i]

for i in range(n-k):
  new_score = score // A[i] * A[i+k]
  if score < new_score:
    print("Yes")
  else:
    print("No")
  score = new_score

Submission status: Time Limit Exceeded

Solution code:
input_line = input()
input2 = input_line.rstrip().split(" ")
a,b = [int(i) for i in input2]

input_line = input()
input2 = input_line.rstrip().split(" ")
X = [int(i) for i in input2]

for i in range(a-b):
  if X[i] >= X[i+b] or 0 in X[i+1:i+b]:
    print("No")
  else:
    print("Yes")