Problem:


Score : 500 points

Problem Statement

Takahashi has decided to work on K days of his choice from the N days starting with tomorrow.

You are given an integer C and a string S. Takahashi will choose his workdays as follows:

After working for a day, he will refrain from working on the subsequent C days.

If the i-th character of S is x, he will not work on Day i, where Day 1 is tomorrow, Day 2 is the day after tomorrow, and so on.

Find all days on which Takahashi is bound to work.

Constraints

1 \leq N \leq 2 \times 10^5

1 \leq K \leq N

0 \leq C \leq N

The length of S is N.

Each character of S is o or x.

Takahashi can choose his workdays so that the conditions in Problem Statement are satisfied.

Input

Input is given from Standard Input in the following format:

N K C
S

Output

Print all days on which Takahashi is bound to work in ascending order, one per line.

Sample Input 1

11 3 2
ooxxxoxxxoo

Sample Output 1

6

Takahashi is going to work on 3 days out of the 11 days. After working for a day, he will refrain from working on the subsequent 2 days.

There are four possible choices for his workdays: Day 1,6,10, Day 1,6,11, Day 2,6,10, and Day 2,6,11.

Thus, he is bound to work on Day 6.

Sample Input 2

5 2 3
ooxoo

Sample Output 2

1
5

There is only one possible choice for his workdays: Day 1,5.

Sample Input 3

5 1 0
ooooo

Sample Output 3

There may be no days on which he is bound to work.

Sample Input 4

16 4 3
ooxxoxoxxxoxoxxo

Sample Output 4

11
16



Sample input:
11 3 2
ooxxxoxxxoo


Sample output:
6

Submission status: Wrong Answer

Solution code:
from collections import Counter
import sys
sys.setrecursionlimit(10 ** 7)

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

# 時間外

# N日中 K日間 C日おき
N, K, C = map(int, input().split())
S = list(input())

C += 1

forward = [0] * N
backward = [0] * N

prev = 0
for i in range(N - 1, -1, -1):
    s = S[i]

    # K日あとのがある
    if i + C <= N - 1:
        prev = max(prev, backward[i + C])

    if s != 'o':
        continue

    backward[i] += 1 + prev


prev = 0
for i in range(N):
    s = S[i]

    # K日前のがある
    if 0 <= i - C:
        prev = max(prev, forward[i - C])

    if s != 'o':
        continue

    forward[i] += 1 + prev

m = max(max(backward), max(forward))

if K < m:
    exit()

b = Counter(backward)
f = Counter(forward)

ans = []

for x, count in [(forward, f), (backward, b)]:
    for n, c in count.most_common()[::-1]:
        if n == 0:
            continue

        if c != 1:
            break

        ans.append(x.index(n) + 1)


ans = list(set(ans))

if not ans:
    exit()

ans.sort()
print('\n'.join(map(str, ans)))

Submission status: Wrong Answer

Solution code:
# coding: utf-8
DATA = """
16 4 3
ooxxoxoxxxoxoxxo
""".split("\n")

def get_debug_line():
	for i in DATA:
		yield i

if 1:
	get_line = input
else:
	get_line = get_debug_line().__next__
	get_line()

N, K, C = [int(i) for i in get_line().strip().split(" ")]
S = get_line()
aa = set(range(N))
def Sub(n, s, l):
	if n >= K:
		#global aa
		#aa &= set(l)
		return 

	for i in range(s, N):
		#if S[i] == "x":
		#	continue
		#l[n] = i 
		#Sub(n+1, i+C+1, l)
		#l[n] = None

		Sub(n+1, i, l)
	return

Sub(K-2, 0, [None]*K)
for a in aa:
	print (a+1)

Submission status: Wrong Answer

Solution code:
# coding: utf-8
DATA = """
16 4 3
ooxxoxoxxxoxoxxo
""".split("\n")

def get_debug_line():
	for i in DATA:
		yield i

if 1:
	get_line = input
else:
	get_line = get_debug_line().__next__
	get_line()

N, K, C = [int(i) for i in get_line().strip().split(" ")]
S = get_line()
aa = set(range(N))
def Sub(n, s, l):
	if n >= K:
		#global aa
		#aa &= set(l)
		return 

	for i in range(s, N):
		#if S[i] == "x":
		#	continue
		#l[n] = i 
		#Sub(n+1, i+C+1, l)
		#l[n] = None

		Sub(K+1, i, l)
	return

Sub(0, 0, [None]*K)
for a in aa:
	print (a+1)

Submission status: Wrong Answer

Solution code:
# coding: utf-8
DATA = """
16 4 3
ooxxoxoxxxoxoxxo
""".split("\n")

def get_debug_line():
	for i in DATA:
		yield i

if 1:
	get_line = input
else:
	get_line = get_debug_line().__next__
	get_line()

N, K, C = [int(i) for i in get_line().strip().split(" ")]
S = get_line()
aa = set(range(N))
def Sub(n, s, l):
	if n == K:
		global aa
		aa &= set(l)

	# for i in range(s, N):
	# 	if S[i] == "x":
	# 		continue
	# 	l[n] = i 
	# 	Sub(n+1, i+C+1, l)
	# 	l[n] = None

Sub(K, 0, [None]*K)
#for a in aa:
#	print (a+1)

Submission status: Wrong Answer

Solution code:
# coding: utf-8
DATA = """
16 4 3
ooxxoxoxxxoxoxxo
""".split("\n")

def get_debug_line():
	for i in DATA:
		yield i

if 1:
	get_line = input
else:
	get_line = get_debug_line().__next__
	get_line()

N, K, C = [int(i) for i in get_line().strip().split(" ")]
S = get_line()
aa = set(range(N))
def Sub(n, s, l):
	pass
	# if n == K:
	# 	global aa
	# 	aa &= set(l)

	# for i in range(s, N):
	# 	if S[i] == "x":
	# 		continue
	# 	l[n] = i 
	# 	Sub(n+1, i+C+1, l)
	# 	l[n] = None

Sub(0, 0, [None]*K)
#for a in aa:
#	print (a+1)

Submission status: Wrong Answer

Solution code:
# coding: utf-8
DATA = """
16 4 3
ooxxoxoxxxoxoxxo
""".split("\n")

def get_debug_line():
	for i in DATA:
		yield i

if 1:
	get_line = input
else:
	get_line = get_debug_line().__next__
	get_line()

N, K, C = [int(i) for i in get_line().strip().split(" ")]
S = get_line()
aa = set(range(N))
def Sub(n, s, l):
	if n == K:
		#print (n, s, l)
		global aa
		aa &= set(l)

	for i in range(s, N):
		if S[i] == "x":
			continue
		l[n] = i 
		Sub(n+1, i+C+1, l)
		l[n] = None

#Sub(0, 0, [None]*K)
#for a in aa:
#	print (a+1)

Submission status: Wrong Answer

Solution code:
print("")

Submission status: Wrong Answer

Solution code:
import bisect
n,k,c = map(int,input().split())
s = input()

lst = []
for i in range(n):
    if s[i]=='o':
        lst.append(i+1)

x,y = [],[]
for i in range(len(lst)):
    if i==0:
        x.append(lst[i])
    else:
        if lst[i]-x[-1]>c:
            x.append(lst[i])
    if len(x)==k:
        break

for i in range(len(lst))[::-1]:
    if i==len(lst)-1:
        y.append(lst[i])
    else:
        if y[-1]-lst[i]>c:
            y.append(lst[i])
    if len(y)==k:
        break

ans = []
for i in range(k):
    if x[i]==y[i]:
        ans.append(x[i])
ans = sorted(ans)
for a in ans:
    print(a)

Submission status: Wrong Answer

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

lst = []
for i in range(n):
    if s[i]=='o':
        lst.append(i+1)

x,y = [],[]
for i in range(len(lst)):
    if i==0:
        x.append(lst[i])
    else:
        if lst[i]-x[-1]>c:
            x.append(lst[i])
    if len(x)==k:
        break

for i in range(len(lst))[::-1]:
    if i==len(lst)-1:
        y.append(lst[i])
    else:
        if y[-1]-lst[i]>c:
            y.append(lst[i])
    if len(y)==k:
        break

ans = sorted(list(set(x)&set(y)))
for a in ans:
    print(a)

Submission status: Wrong Answer

Solution code:
N, K, C = [int(input_) for input_ in input().split(" ")]
    
tick_cross = input()
    
def find_earliest_work_days(C, tick_cross):
    """
    Find the list of the earliest day in all possible days for the n-th 
    work day.
    
    Parameters:
    C (int): Minimum interval between the previous work day and the 
             next work day.
    tick_cross (str): The character string of days he can go to work.
             
    Returns:
    List[int]: The list of the earliest day in all possible days for 
               the n-th work day.
    """
    
    N = len(tick_cross)
        
    day = 0
    earliest_work_days = []
    while day <= N-1:
        if tick_cross[day] == "o":
            earliest_work_days.append(day+1)
            day += C + 1
        else:
            day += 1
            
    return earliest_work_days
    
def find_latest_work_days(C, tick_cross): 
    """
    Find the list of the latest day in all possible days for the n-th 
    work day.
    
    Parameters:
    C (int): Minimum interval between the previous work day and the 
             next work day.
    tick_cross (str): The character string of days he can go to work.
             
    Returns:
    List[int]: The list of the latest day in all possible days for 
               the n-th work day.
    """
    
    N = len(tick_cross)
        
    day = N - 1
    latest_work_days = []
    while day >= 0:
        if tick_cross[day] == "o":
            latest_work_days.append(day+1)
            day -= C + 1
        else:
            day -= 1
            
    return sorted(latest_work_days)
                
earliest_work_days = find_earliest_work_days(C, tick_cross)
latest_work_days = find_latest_work_days(C, tick_cross)
for earliest, latest in zip(earliest_work_days, latest_work_days):
    if earliest == latest:
        print(earliest)

Submission status: Wrong Answer

Solution code:
data = input().split(" ")
N, K, C = int(data[0]), int(data[1]), int(data[2])
S = input()

point = 0
work_start = [0] * (K + 1)
for i in range(1, K + 1):
  point = S.find("o", point, N)
  work_start[i] = point + 1
  point += C

point = N
work_end = [0] * (K + 1)
for i in range(K, 0, -1):
  point = S.rfind("o", 0, point)
  work_end[i] = point + 1
  point -= C

for i in range(1, K + 1):
  if work_start[i] == work_end[i]:
    print(work_start[i])

Submission status: Wrong Answer

Solution code:
import sys
n,k,c=map(int, input().split())
s=str(input())

l=[0]*n
r=[0]*n
i=0
j=n-1
cnt=0
while i<n:
    if s[i]=='x':
        i+=1
    if s[i]=='o':
        l[i]=1
        i+=c+1
        cnt+=1
#前から働いていって、必要以上の数働ける形の場合、必須となる日はありません。
if cnt>k:
    sys.exit()
    
while j>0:
    if s[j]=='x':
        j-=1
    if s[j]=='o':
        r[j]=1
        j-=c+1
"""
ここまでで、lには「最速でその日に仕事ができる」
rには「遅くともその日までには仕事しないといけない」
というリストができます。

print(l)
print(r)
"""
for _ in range(len(l)):
    if l[_] and r[_]:
        print(_+1)

Submission status: Wrong Answer

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

l=[0]*n
r=[0]*n
i=0
j=n-1
cnt=0
while cnt<k:
    if s[i]=='x':
        i+=1
    if s[i]=='o':
        l[i]=1
        i+=c+1
        cnt+=1
cnt=0
while cnt<k:
    if s[j]=='x':
        j-=1
    if s[j]=='o':
        r[j]=1
        j-=c+1
        cnt+=1
"""
ここまでで、lには「最速でその日に仕事ができる」
rには「遅くともその日までには仕事しないといけない」
というリストができます。

print(l)
print(r)
"""
for _ in range(len(l)):
    if l[_] and r[_]:
        print(_+1)

Submission status: Wrong Answer

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

l=[0]*n
r=[0]*n
i=0
j=n-1
while i<n:
    if s[i]=='x':
        i+=1
    if s[i]=='o':
        l[i]=1
        i+=c+1
while j>=0:
    if s[j]=='x':
        j-=1
    if s[j]=='o':
        r[j]=1
        j-=c+1
"""
ここまでで、lには「最速でその日に仕事ができる」
rには「遅くともその日までには仕事しないといけない」
というリストができます。

print(l)
print(r)
"""
for _ in range(len(l)):
    if l[_] and r[_]:
        print(_+1)

Submission status: Wrong Answer

Solution code:
n,nWorks,nSp = map(int,input().split())

s = input()

leftList = [0]*n
rightList = [0]*n

num = 0
count = 0

while num < n:
    if s[num] == "o":
        leftList[num] = 1
        count +=1
        num += 1 + nSp
    else:
        num +=1

num = n-1
count = 0
while num >= 0:
    if s[num] == "o":
        rightList[num] = 1
        count +=1
        num -= (1 + nSp)
    else:
        num -=1

for kk in range(n):
    if leftList[kk] and rightList[kk]:
        print(kk+1)

Submission status: Wrong Answer

Solution code:
n,nWorks,nSp = map(int,input().split())

s = input()

leftList = [0]*n
rightList = [0]*n

num = 0
count = 0

if len(s) == n:
    while num < n and count <nWorks:
        if s[num] == "o":
            leftList[num] = 1
            count +=1
            num += 1 + nSp
        else:
            num +=1

    num = n-1
    count = 0
    while num >= 0 and count <nWorks:
        if s[num] == "o":
            rightList[num] = 1
            count +=1
            num -= (1 + nSp)
        else:
            num -=1

for kk in range(n):
    if leftList[kk] and rightList[kk]:
        print(kk+1)

Submission status: Wrong Answer

Solution code:
n,nWorks,nSp = map(int,input().split())

s = input()

leftList = [0]*n
rightList = [0]*n

num = 0
count = 0
while count <nWorks:
    if s[num] == "o":
        leftList[num] = 1
        count +=1
        num += 1 + nSp
    else:
        num +=1

num = n-1
count = 0
while count <nWorks:
    if s[num] == "o":
        rightList[num] = 1
        count +=1
        num -= (1 + nSp)
    else:
        num -=1

for kk in range(n):
    if leftList[kk] and rightList[kk]:
        print(kk+1)

Submission status: Wrong Answer

Solution code:
n,nWorks,nSp = map(int,input().split())

s = input()

leftList = [0]*n
rightList = [0]*n

num = 0
count = 0
while num < n:
    if s[num] == "o":
        leftList[num] = 1
        count +=1
        num += 1 + nSp
    else:
        num +=1

num = n-1
count = 0
while num >= 0:
    if s[num] == "o":
        rightList[num] = 1
        count +=1
        num -= (1 + nSp)
    else:
        num -=1

for kk in range(n):
    if leftList[kk] and rightList[kk]:
        print(kk+1)

Submission status: Wrong Answer

Solution code:
n,nWorks,nSp = map(int,input().split())

s = input()

leftList = [0]*n
rightList = [0]*n

num = 0
count = 0
while num < n and count <nWorks:
    if s[num] == "o":
        leftList[num] = 1
        count +=1
        num += 1 + nSp
    else:
        num +=1

num = n-1
count = 0
while num >= 0 and count <nWorks:
    if s[num] == "o":
        rightList[num] = 1
        count +=1
        num -= (1 + nSp)
    else:
        num -=1

for kk in range(n):
    if leftList[kk] and rightList[kk]:
        print(kk+1)

Submission status: Wrong Answer

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

def solve(List):
    ans = []
    i = 0
    while i < N:
        if List[i] == 'o':
            ans.append(i+1)
            i += C
        i += 1
    return ans

n = solve(S)

if len(n) > K:
    pass
else:
    r = solve(S[::-1])
    r = list(map(lambda x: N+1-x, r[::-1]))
    ans = list(set(n) & set(r))
    for i in ans:
        print(i)

Submission status: Wrong Answer

Solution code:
n,k,c = map(int, input().split())
s = input()
L, R = [], []
l_count = 0 
for i in range(len(s)):
    if i < l_count:
        continue
    elif len(L) >= k:
        break
    elif s[i] == "o" and i >= l_count:
        L.append(i+1)
        l_count = i
        l_count += c+1

r_count = 0
t = s[::-1]
for i in range(len(t)):
    if i < r_count:
        continue
    elif len(R) >= k:
        break
    elif t[i] == "o" and i >= r_count:
        R.append(len(t)-i)
        r_count = i
        r_count += c+1
    
ans = sorted(set(L)&set(R))
for i in ans:
    print(i)

Submission status: Wrong Answer

Solution code:
n,k,c = map(int, input().split())
s = input()
L, R = [], []
l_count = 0 
for i in range(len(s)):
    if s[i] == "o" and i >= l_count:
        L.append(i+1)
        l_count = i
        l_count += c+1
    if len(L) >= k:
        break
    if i < l_count:
        continue

r_count = 0
t = s[::-1]
for i in range(len(t)):
    if t[i] == "o" and i >= r_count:
        R.append(len(t)-i)
        r_count = i
        r_count += c+1
    if len(R) >= k:
        break
    if i < r_count:
        continue
    
ans = sorted(set(L)&set(R))
for i in ans:
    print(i)

Submission status: Wrong Answer

Solution code:
n,k,c = map(int, input().split())
s = input()
L, R = [], []
l_count = 0 
for i in range(len(s)):
    if s[i] == "o" and i >= l_count:
        L.append(i+1)
        l_count = i
        l_count += c+1
    if i < l_count:
        continue
r_count = 0
t = s[::-1]
for i in range(len(t)):
    if t[i] == "o" and i >= r_count:
        R.append(len(t)-i)
        r_count = i
        r_count += c+1
    if i < r_count:
        continue
ans = sorted(set(L)&set(R))
for i in ans:
    print(i)

Submission status: Wrong Answer

Solution code:
import sys
def yutori():
    N, K, C = map(int,sys.stdin.readline().split())
    S = [i for i in sys.stdin.readline()]
    l = [i+1 for i in range(N) if S[i] == 'o']
    Left = []
    Right = []
    for u in l:
        if Left == []:
            Left.append(u)
        if u > Left[-1] + C:
            Left.append(u)
        continue
    if len(Left) <K:
        exit()

    for u in l[::-1]:
        if Right== []:
            Right.append(u)
        if u < Right[-1] - C:
            Right.append(u)
        continue
    
    if len(Right) <K:
            exit()
    
    for i in range(K):
        if Left[i] == Right[-i-1]:
            print(Left[i])

yutori()

Submission status: Wrong Answer

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

rl = list()
ll = list()

for i in range(a):
    if mb[i] == "x":continue
    if len(rl) == 0:
        rl.append(i + 1)
    else:
        if rl[-1] + c + 1 <= i + 1:
            rl.append(i + 1)
            if len(rl) == b:break

for i in range(a-1,-1,-1):
    if mb[i] == "x":continue
    if len(ll) == 0:
        ll.append(i + 1)
    else:
        d1 = ll[-1] - c - 1
        d2 = i + 1
        if  d1 >= d2:
            ll.append(i + 1)
            if len(ll) == b:break

ans=list()
for i,k in zip(rl,reversed(ll)):
    if b == 1 or b==0:break
    if i == k:
        ans.append(i)

[print(i) for i in ans]

Submission status: Wrong Answer

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

rl = list()
ll = list()

for i in range(a):
    if mb[i] == "x":continue
    if len(rl) == 0:
        rl.append(i + 1)
    else:
        if rl[-1] + c + 1 <= i + 1:
            rl.append(i + 1)
            if len(rl) == b:break

for i in range(a-1,-1,-1):
    if mb[i] == "x":continue
    if len(ll) == 0:
        ll.append(i + 1)
    else:
        d1 = ll[-1] - c - 1
        d2 = i + 1
        if  d1 >= d2:
            ll.append(i + 1)
            if len(ll) == b:break

ans=list()
for i,k in zip(rl,reversed(ll)):
    if b == 1 or b == 0:break
    if i == k:
        ans.append(i)

[print(i) for i in ans]

Submission status: Wrong Answer

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

rl = list()
ll = list()

for i in range(a):
    if mb[i] == "x":continue
    if len(rl) == 0:
        rl.append(i + 1)
    else:
        if rl[-1] + c + 1 <= i + 1:
            rl.append(i + 1)
            if len(rl) == b:break

for i in range(a-1,-1,-1):
    if mb[i] == "x":continue
    if len(ll) == 0:
        ll.append(i + 1)
    else:
        d1 = ll[-1] - c - 1
        d2 = i + 1
        if  d1 >= d2:
            ll.append(i + 1)
            if len(ll) == b:break

ans=list()
for i,k in zip(rl,reversed(ll)):
    if b == 1 and b == 0:break
    if i == k:
        ans.append(i)

[print(i) for i in ans]

Submission status: Wrong Answer

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

rl = list()
ll = list()

for i in range(a):
    if mb[i] == "x":continue
    if len(rl) == 0:
        rl.append(i + 1)
    else:
        if rl[-1] + c + 1 <= i + 1:
            rl.append(i + 1)
            if len(rl) == b:break

for i in range(a-1,-1,-1):
    if mb[i] == "x":continue
    if len(ll) == 0:
        ll.append(i + 1)
    else:
        d1 = ll[-1] - c - 1
        d2 = i + 1
        if  d1 >= d2:
            ll.append(i + 1)
            if len(ll) == b:break

ans=list()
for i,k in zip(rl,reversed(ll)):
    if b == 1:break
    if i == k:
        ans.append(i)

[print(i) for i in ans]

Submission status: Wrong Answer

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

rl = list()
ll = list()

for i in range(a):
    if mb[i] == "x":continue
    if len(rl) == 0:
        rl.append(i + 1)
    else:
        if rl[-1] + c + 1 <= i + 1:
            rl.append(i + 1)
            #if len(rl) <= b:break

for i in range(a-1,-1,-1):
    if mb[i] == "x":continue
    if len(ll) == 0:
        ll.append(i + 1)
    else:
        d1 = ll[-1] - c - 1
        d2 = i + 1
        if  d1 >= d2:
            ll.append(i + 1)
            #if len(ll) <= b:break

ans=list()
for i,k in zip(rl,reversed(ll)):
    if b == 1:break
    if i == k:
        ans.append(i)

[print(i) for i in ans]

Submission status: Wrong Answer

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

rl = list()
ll = list()

for i in range(a):
    if mb[i] == "x":continue
    if len(rl) == 0:
        rl.append(i + 1)
    else:
        if rl[-1] + c + 1 <= i + 1:
            rl.append(i + 1)
            #if len(rl) <= b:break

for i in range(a-1,-1,-1):
    if mb[i] == "x":continue
    if len(ll) == 0:
        ll.append(i + 1)
    else:
        d1 = ll[-1] - c - 1
        d2 = i + 1
        if  d1 >= d2:
            ll.append(i + 1)
            #if len(ll) <= b:break

ans=list()
for i,k in zip(rl,reversed(ll)):
    if b == 1:break
    if i == k:
        ans.append(i)

print([i for i in ans])

Submission status: Wrong Answer

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

rl = list()
ll = list()

for i in range(a):
    if mb[i] == "x":continue
    if len(rl) == 0:
        rl.append(i + 1)
    else:
        if rl[-1] + c + 1 <= i + 1:
            rl.append(i + 1)
            #if len(rl) <= b:break

for i in range(a-1,-1,-1):
    if mb[i] == "x":continue
    if len(ll) == 0:
        ll.append(i + 1)
    else:
        d1 = ll[-1] - c - 1
        d2 = i + 1
        if  d1 >= d2:
            ll.append(i + 1)
            #if len(ll) <= b:break

ans=list()
for i,k in zip(rl,reversed(ll)):
    if b == 1:break
    if i == k:
        ans.append(i)

print(ans)

Submission status: Wrong Answer

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

set1 = set()
set2 = set()
index = 0
cnt = 0
while index < n and cnt < k - 1:
    if s[index] == 'o':
        set1.add(index + 1)
        index += c
        cnt += 1
    index += 1

index = n - 1
cnt = 0
while index < n and cnt < k - 1:
    if s[index] == 'o':
        set2.add(index + 1)
        index -= c
        cnt += 1
    index -= 1

res_set = set1 & set2
for i in sorted(res_set):
    print(i)

Submission status: Wrong Answer

Solution code:
import copy

n,k,c = map(int, input().split())
s = input()

ls = []
for i in range(n) :
    if s[i] == 'o' :
        ls.append([i])
subLs = []
while(len(ls) > 0) :
    newLs = ls.pop()
    if len(newLs) >= k :
        subLs.append(newLs)
    else :
        last = newLs.pop()
        canTo = []
        for i in range(last+c,n) :
            if s[i] == 'o' :
                canTo.append (i)
        while len(canTo) > 0 :
            tmpLs = newLs.copy()
            tmpLs.append(last)
            tmpLs.append(canTo.pop())
            ls.append(tmpLs)
checkLs = sum(subLs,[])
dupLs = list(set(checkLs))
mx = 0
ans = 0
for i in dupLs :
    cnt = checkLs.count(i)
    if mx < cnt :
        mx = cnt
        ans = i
print(ans+1)

Submission status: Wrong Answer

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

n = len(s)

set1 = set()
set2 = set()
index = 0
cnt = 0
while index < n and cnt < k:
    if s[index] == 'o':
        set1.add(index + 1)
        index += c
        cnt += 1
    index += 1

index = n - 1
cnt = 0
while index < n and cnt < k:
    if s[index] == 'o':
        set2.add(index + 1)
        index -= c
        cnt += 1
    index -= 1

res_set = set1 & set2
for i in sorted(res_set):
    print(i)

Submission status: Wrong Answer

Solution code:
n,k,c=[int(x) for x in input().split()]
s=list(input())

L=[]
R=[]

i=0
while i < n:  
    if s[i]=="o":
        L.append(i)
        i+=c
    i+=1

i=0
while i < n:
    if s[n-i-1]=="o":
        R.append(n-i-1)
        i+=c
    i+=1
print(L,R)

days=[]
for i in range(k):
    if L[i]==R[i]:
        days.append(L[i])


for i in range(len(days)):
    print(days[i]+1)

Submission status: Wrong Answer

Solution code:
N ,K , C = map(int, input().split())
S = input()
S =''.join(S[:N])
L = []
# Make L list
i = 0
while i < len(S) and len(L) < K:
    if S[i] == 'o' :
        L.append(i+1) 
        i += C+1
    else:
        i +=1
# Make R list
R = []
S = ''.join(list(reversed(S)))
i = 0
while i < len(S) and len(R) < K:
    if S[i] == 'o' :
        R.append(N-i) 
        i += C+1
    else:
        i +=1
correct = set(L) & set(R)
for i in sorted( correct):
    print(i)

Submission status: Wrong Answer

Solution code:
def main():
    n, k, c = map(int, input().split())
    s = input()

    def f(r):
        count = 0
        for i in r:
            if count > 0:
                count -= 1
                continue
            if s[i] == 'o':
                yield i 
                count = c

    for i, j in zip(f(range(0, n)), reversed(list(f(range(n-1, -1, -1))))):
        if i == j:
            yield i+1


print(*main(), sep="\n")

Submission status: Wrong Answer

Solution code:
N, K, C = map(int, input().split())
S = input()
L = [-1] * K
R = [-1] * K
L_index = 0
L_count = 0
R_index = N - 1
R_count = K - 1

while L_index < N and L_count < K:
    if S[L_index] == "o":
        L[L_count] = L_index
        L_index += (C + 1)
        L_count += 1
    else:
        L_index += 1
while R_index >= 0 and R_count >= 0:
    if S[R_index] == "o":
        R[R_count] = R_index
        R_index -= (C + 1)
        R_count -= 1
    else:
        R_index -= 1

if L.count(-1) != 0 or R.count(-1) != 0:
    exit()

work_day = set(L) & set(R)
for w_day in work_day:
    print(w_day + 1)

Submission status: Wrong Answer

Solution code:
N, K, C = map(int, input().split())
S = input()
L = [-1] * K
R = [-2] * K
L_index = 0
L_count = 0
R_index = N - 1
R_count = K - 1

while L_index < N and L_count < K:
    if S[L_index] == "o":
        L[L_count] = L_index
        L_index += (C + 1)
        L_count += 1
    else:
        L_index += 1
while R_index >= 0 and R_count >= 0:
    if S[R_index] == "o":
        R[R_count] = R_index
        R_index -= (C + 1)
        R_count -= 1
    else:
        R_index -= 1
work_day = set(L) & set(R)
for w_day in work_day:
    print(w_day + 1)

Submission status: Wrong Answer

Solution code:
N, K, C = map(int, input().split())
S = input()
L = [-1] * K
R = [-1] * K
L_index = 0
L_count = 0
R_index = N - 1
R_count = K - 1

while L_index < N and L_count < K:
    if S[L_index] == "o":
        L[L_count] = L_index
        L_index += (C + 1)
        L_count += 1
    else:
        L_index += 1
while R_index > 0 and R_count > 0:
    if S[R_index] == "o":
        R[R_count] = R_index
        R_index -= (C + 1)
        R_count -= 1
    else:
        R_index -= 1
work_day = set(L) & set(R)
for w_day in work_day:
    print(w_day + 1)

Submission status: Wrong Answer

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

set1 = set()
set2 = set()
index = 0
cnt = 0
while index <= n and cnt < k:
    if s[index] == 'o':
        set1.add(index + 1)
        index += c
        cnt += 1
    index += 1

index = n - 1
cnt = 0
while index < ~ n and cnt < k:
    if s[index] == 'o':
        set2.add(index + 1)
        index -= c
        cnt += 1
    index -= 1

res_set = set1 & set2
for i in sorted(res_set):
    print(i)

Submission status: Wrong Answer

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

set1 = set()
set2 = set()
index = 0
cnt = 0
while index < n and cnt < k:
    if s[index] == 'o':
        set1.add(index + 1)
        index += c
        cnt += 1
    index += 1

index = n - 1
cnt = 0
while index < n and cnt < k:
    if s[index] == 'o':
        set2.add(index + 1)
        index -= c
        cnt += 1
    index -= 1

res_set = set1 & set2
for i in sorted(res_set):
    print(i)

Submission status: Wrong Answer

Solution code:
n, k, c = map(int, input().split())
s = input()
l = [-1] * k
r = [-1] * k
nowl = 0
indl = 0
while nowl < n and indl < k:
    for i in range(nowl, n):
        if s[i] == "o":
            l[indl] = i
            nowl = i + c + 1
            indl += 1
            break
nowr = n - 1
indr = k - 1
while nowr >= 0 and indr >= 0:
    for i in range(nowr, -1, -1):
        if s[i] == "o":
            r[indr] = i
            nowr = i - c - 1
            indr -= 1
            break
print(l)
print(r)
for i in range(k):
    if l[i] == r[i]:
        print(l[i] + 1)

Submission status: Wrong Answer

Solution code:
N, K, C = map(int, input().split())
S = input()
L = [-1] * K
R = [-1] * K
L_index = 0
L_count = 0
R_index = N - 1
R_count = K - 1

while L_index < N and L_count < K:
    if S[L_index] == "o":
        L[L_count] = L_index
        L_index += (C + 1)
        L_count += 1
    else:
        L_index += 1
while R_index >= 0 and R_count >= 0:
    if S[R_index] == "o":
        R[R_count] = R_index
        R_index -= (C + 1)
        R_count -= 1
    else:
        R_index -= 1
work_day = set(L) & set(R)
for w_day in work_day:
    print(w_day + 1)

Submission status: Wrong Answer

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

set1 = set()
set2 = set()
index = 0
cnt = 0
while index < n and cnt < k:
    if s[index] == 'o':
        set1.add(index + 1)
        index += c
        cnt += 1
        continue
    index += 1

index = n - 1
cnt = 0
while index < n and cnt < k:
    if s[index] == 'o':
        set2.add(index + 1)
        index -= c
        cnt += 1
        continue
    index -= 1

res_set = set1 & set2
for i in sorted(res_set):
    print(i)

Submission status: Wrong Answer

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

forward = []
backward = []

rep = list(range(n))
# forward
l = 0
kf = k
kb = k
while 1:
  if s[l] == 'x':
    l += 1
  else:
    forward.append(l+1)
    kf -= 1
    l += c+1
  if (l > n-1) | (kf == 0):
    break
rep.reverse()
# backward
l = n-1
while 1:
  if s[l] == 'x':
    l -= 1
  else:
    backward.append(l+1)
    kb -= 1
    l -= c+1
  if (l < 0) | (kb == 0):
    break
#judgement
ret = set(forward) & set(backward)

ret = sorted(ret)
ret.reverse()
for l in range(len(ret)):
  print(ret.pop())

Submission status: Wrong Answer

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

set1 = set()
set2 = set()
index = 0
cnt = 0
while index < c and cnt < c:
    if s[index] == 'o':
        set1.add(index + 1)
        index += c + 1
        cnt += 1
        continue
    index += 1

index = n - 1
cnt = 0
while index < c and cnt < c:
    if s[index] == 'o':
        set2.add(index + 1)
        index -= c + 1
        cnt += 1
        continue
    index -= 1

res_set = set1 & set2
for i in sorted(res_set):
    print(i)

Submission status: Wrong Answer

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

set1 = set()
set2 = set()
index = 0
cnt = 0
while index < c and cnt < c:
    if s[index] == 'o':
        set1.add(index + 1)
        index += c + 1
        cnt += 1
        continue
    index += 1

index = n - 1
cnt = 0
while index < c and cnt < c:
    if s[index] == 'o':
        set2.add(index + 1)
        index -= c + 1
        cnt += 1
        continue
    index -= 1

res_set = set1 & set2
for i in sorted(res_set):
    print(i)

Submission status: Wrong Answer

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

forward = []
backward = []

rep = list(range(n))
# forward
l = 0
while 1:
  if s[l] == 'x':
    l += 1
  else:
    forward.append(l+1)
    k -= 1
    l += c+1
  if (l > n-1) | (k == 0):
    break
rep.reverse()
# backward
l = n-1
while 1:
  if s[l] == 'x':
    l -= 1
  else:
    backward.append(l+1)
    k -= 1
    l -= c+1
  if (l < 0) | (k == 0):
    break
#judgement
ret = set(forward) & set(backward)

ret = sorted(ret)
ret.reverse()
for l in range(len(ret)):
  print(ret.pop())

Submission status: Wrong Answer

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

forward = []
backward = []

rep = list(range(n))
# forward
l = 0
while 1:
  if s[l] == 'x':
    l += 1
  else:
    forward.append(l+1)
    k -= 1
    l += c+1
  if (l > n-1) | (k == 0):
    break
rep.reverse()
# backward
l = n-1
while 1:
  if s[l] == 'x':
    l -= 1
  else:
    backward.append(l+1)
    k -= 1
    l -= c+1
  if (l < 0) | (k == 0):
    break
#judgement
ret = set(forward) & set(backward)

for l in range(len(ret)):
  print(ret.pop())