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:
import math
from functools import reduce
from collections import deque
import sys
sys.setrecursionlimit(10**7)

# スペース区切りの入力を読み込んで数値リストにして返します。
def get_nums_l():
    return [ int(s) for s in input().split(" ")]

# 改行区切りの入力をn行読み込んで数値リストにして返します。
def get_nums_n(n):
    return [ int(input()) for _ in range(n)]

# 改行またはスペース区切りの入力をすべて読み込んでイテレータを返します。
def get_all_int():
    return map(int, open(0).read().split())

def log(*args):
    print("DEBUG:", *args, file=sys.stderr)

n,k,c = get_nums_l()
s = input()

ox = [ c=="o" for c in s ]
work = [False] * (n)
count = 0
prev = -99999999999999
for i,o in enumerate(ox):
    if o:
        if i-prev > c:
            work[i] = True
            prev = i
            count += 1
            if count == k:
                break

# log("ox", ox)
# log("work", work)

kouho = None
last_work = 9999999999999
ans = []
for i in range(n-1, -1, -1):
    if work[i]:
        if kouho == None:
            # log(i, "req")
            ans.append(i+1)
            last_work = i
        else:
            # log(i, "change")
            last_work = kouho
            kouho = None

    if ox[i] and last_work-i>c:
        # log(i, "kouho")
        kouho = i

print("\n".join(map(str, sorted(ans))))

Submission status: Wrong Answer

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


def solve(N: int, K: int, C: int, S: str):
    # 最善だったら何ケースか
    work = 0
    rest = 0
    startWork = -1
    leftIndices = set()
    rightIndices = set()
    for i in range(N):
        if S[i] == "o" and rest <= 0:
            rest = C
            work += 1
            leftIndices.add(i)
        else:
            rest -= 1
    # if work != K:
    #     print("")
    #     exit()
    work = 0
    rest = 0
    for i in range(N-1, -1, -1):
        if S[i] == "o" and rest <= 0:
            rest = C
            work += 1
            rightIndices.add(i)
        else:
            rest -= 1
    for i in sorted(list(leftIndices.intersection(rightIndices))):
        print(i+1)
    # print(rightIndices)
    # rest = -1
    # startWork = -1
    # for i in range(N-1, -1, -1):
    #     if S[i] == "o" and rest <= 0:
    #         rest = C
    #         startWork = i
    #         girigiriIndices.append(i)
    #         print(f"i{i},{rest}")
    #     else:
    #         rest -= 1

    # if work != K:
    #     print("")
    #     # print(work)
    #     exit()
    # for i in girigiriIndices:
    #     print(i+1)
    return


# Generated by 1.1.6 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
    C = int(next(tokens))  # type: int
    S = next(tokens)  # type: str
    solve(N, K, C, S)


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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


def solve(N: int, K: int, C: int, S: str):
    # 最善だったら何ケースか
    work = 0
    rest = 0
    startWork = -1
    leftIndices = set()
    rightIndices = set()
    for i in range(N):
        if S[i] == "o" and rest <= 0:
            rest = C
            work += 1
            leftIndices.add(i)
        else:
            rest -= 1
    # if work != K:
    #     print("")
    #     exit()
    work = 0
    rest = 0
    for i in range(N-1, -1, -1):
        if S[i] == "o" and rest <= 0:
            rest = C
            work += 1
            rightIndices.add(i)
        else:
            rest -= 1
    for i in list(leftIndices.intersection(rightIndices)):
        print(i+1)
    # print(rightIndices)
    # rest = -1
    # startWork = -1
    # for i in range(N-1, -1, -1):
    #     if S[i] == "o" and rest <= 0:
    #         rest = C
    #         startWork = i
    #         girigiriIndices.append(i)
    #         print(f"i{i},{rest}")
    #     else:
    #         rest -= 1

    # if work != K:
    #     print("")
    #     # print(work)
    #     exit()
    # for i in girigiriIndices:
    #     print(i+1)
    return


# Generated by 1.1.6 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
    C = int(next(tokens))  # type: int
    S = next(tokens)  # type: str
    solve(N, K, C, S)


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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


def solve(N: int, K: int, C: int, S: str):
    # 最善だったら何ケースか
    work = 0
    rest = 0
    startWork = -1
    leftIndices = set()
    rightIndices = set()
    for i in range(N):
        if S[i] == "o" and rest <= 0:
            rest = C
            work += 1
            leftIndices.add(i)
        else:
            rest -= 1
    if work != K:
        print("")
        exit()
    work = 0
    rest = 0
    for i in range(N-1, -1, -1):
        if S[i] == "o" and rest <= 0:
            rest = C
            work += 1
            rightIndices.add(i)
        else:
            rest -= 1
    for i in list(leftIndices.intersection(rightIndices)):
        print(i+1)
    # print(rightIndices)
    # rest = -1
    # startWork = -1
    # for i in range(N-1, -1, -1):
    #     if S[i] == "o" and rest <= 0:
    #         rest = C
    #         startWork = i
    #         girigiriIndices.append(i)
    #         print(f"i{i},{rest}")
    #     else:
    #         rest -= 1

    # if work != K:
    #     print("")
    #     # print(work)
    #     exit()
    # for i in girigiriIndices:
    #     print(i+1)
    return


# Generated by 1.1.6 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
    C = int(next(tokens))  # type: int
    S = next(tokens)  # type: str
    solve(N, K, C, S)


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
n, k, c = map(int, input().split())
S = list(input())
L = []
on = True
cnt = 0
for i, s in enumerate(S):
    if on and s == 'o':
        on = False
        cnt = 0
        L.append(i)
        if len(L) == k:
            break
    elif not on:
        cnt += 1
        if cnt == c:
            on = True
S.reverse()
R = []
on = True
cnt = 0
for i, s in enumerate(S):
    if on and s == 'o':
        on = False
        cnt = 0
        R.append(n-1-i)
        if len(R) == k:
            break
    elif not on:
        cnt += 1
        if cnt == c:
            on = True

X = set(L) & set(R)
X = sorted(list(X))
for x in X:
    print(x+1)
if X == []:
    print()

Submission status: Wrong Answer

Solution code:
n, k, c = map(int, input().split())
S = list(input())
L = []
on = True
cnt = 0
for i, s in enumerate(S):
    if on and s == 'o':
        on = False
        cnt = 0
        L.append(i)
        if len(L) == k:
            break
    elif not on:
        cnt += 1
        if cnt == c:
            on = True
S.reverse()
R = []
on = True
cnt = 0
for i, s in enumerate(S):
    if on and s == 'o':
        on = False
        cnt = 0
        R.append(n-1-i)
        if len(R) == k:
            break
    elif not on:
        cnt += 1
        if cnt == c:
            on = True

X = set(L) & set(R)
X = sorted(list(X))
for x in X:
    print(x+1)

Submission status: Wrong Answer

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

import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(2147483647)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7
inf = float('inf')
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))

n,k,c = LI()
s = input()

cnt = 0
i = n-1
d = defaultdict(int)
tmp = k
while i >= 0:
    if s[i] == 'o':
        cnt += 1
        d[i] = tmp
        tmp -= 1
        i -= c
    i -= 1
i = 0
f = defaultdict(int)
tmp = 1
while i < n:
    if s[i] == 'o':
        f[i] = tmp
        tmp += 1
        i += c
    i += 1
for i,j in d.items():
    if j == f[i]:
        print(i+1)

Submission status: Wrong Answer

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

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

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

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

Submission status: Wrong Answer

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

import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(2147483647)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7
inf = float('inf')
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))

n,k,c = LI()
s = input()

cnt = 0
i = n-1
d = defaultdict(int)
while i >= 0:
    if s[i] == 'o':
        cnt += 1
        d[i] = 1
        i -= c
    i -= 1
i = 0
f = defaultdict(int)
ttt = 0
while i < n:
    if s[i] == 'o':
        f[i] = 1
        ttt += 1
        i += c
    i += 1


if cnt > k or ttt > k:
    print()
    quit()
for i,j in f.items():
    if d[i]:
        print(i+1)

Submission status: Wrong Answer

Solution code:
n,k,c = map(int, input().split())
s = str(input())
t = [0 for i in range(n)]
u = [0 for i in range(n)]
i,x,y = 0,0,0
j = n-1
while i < n and x <= k:
    if s[i] == "o":
        t[i] = 1
        x += 1
        i += c
    i += 1

while j >= 0 and y <= k:
    if s[j] == "o":
        u[j] = 1
        y += 1
        j += -c
    j += -1

for i in range(0,n):
    if t[i] == 1 and u[i] == 1:
        print(i+1)

Submission status: Wrong Answer

Solution code:

def main():
    def greed(s):
        workday = []
        start = 0
        while start < n:
            if s[start] == 'x':
                start += 1
            else:
                workday.append(start+1)
                start += c + 1
        return workday

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

    front = greed(s)
    back = greed(s[::-1])

    if len(front) > k or len(back) > k:
        return
    for i, j in zip(front, back[::-1]):
        if i == j:
            print(i)

if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
'''
16 4 3
ooxxoxoxxxoxoxxo

output
11
16
'''

import numpy as np

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

oks = [idx for idx, i in enumerate(S) if i == 'o']
# print(oks)

temp = np.array(oks)
# 逆向きは反転させて、その向きで計算した上で日付を戻す
temp_reverse = (N - 1 - np.array(oks))[::-1]

# print(temp, temp_reverse)


def calc(temp, reverse=False):
    count_dict = {}
    cnt = 0
    while True:
        idx = temp[0]
        temp = temp[temp > idx + C]
        if cnt <= K:
            if not reverse:
                count_dict[cnt + 1] = idx + 1
            else:
                count_dict[K - cnt] = N - 1 - idx + 1
        cnt += 1
        if len(temp) == 0:
            break

    return count_dict


this = calc(temp)
reverse = calc(temp_reverse, reverse=True)

# print(this, reverse)
ans = list(set(this.values()) & set(reverse.values()))
[print(i) for i in ans]




''' TLE solution
for ok in oks:
    temp = oks.copy()
    temp.remove(ok)
    temp = np.array(temp)
    cnt = 0

    while True:
        if len(temp) == 0:
            print(ok + 1)
            break
        val = temp[0]
        temp = temp[temp > val + C]
        cnt += 1
        if cnt >= K:
            break
'''

Submission status: Wrong Answer

Solution code:
n, k, c = map(int,input().split())
s = input()
left = [0 for _ in range(n)]
right = [0 for _ in range(n)]
cnt = 0
i = 0
tf = False
while True:
    if not tf and s[i] == 'o':
        cnt += 1
        left[i] = cnt
        tf = True
        i += c
        if cnt == k:
            break
    else:
        tf = False
        i += 1
    if i > n:
        break

cnt = k+1
i = n-1
tf = False
while True:
    if not tf and s[i] == 'o':
        cnt -= 1
        right[i] = cnt
        tf = True
        i -= c
        if cnt == 0:
            break
    else:
        tf = False
        i -= 1
    if i <= 0:
        break

ans = []
for i in range(n):
    li = left[i]
    ri = right[i]
    if li > 0 and ri > 0 and li == ri:
        ans.append(i+1)
for a in ans:
    print(a)

Submission status: Wrong Answer

Solution code:
import sys

sys.setrecursionlimit(10 ** 7)
rl = sys.stdin.readline


def solve():
    N, K, C = map(int, rl().split())
    S = input()
    
    left_greedy = [False] * N
    right_greedy = [False] * N
    
    cnt = 0
    k = 0
    for i in range(N):
        if S[i] == 'o' and cnt == 0:
            left_greedy[i] = True
            cnt = C
            k += 1
            if k == K:
                break
        elif 0 < cnt:
            cnt -= 1
    
    cnt = 0
    k = 0
    for i in range(N - 1, -1, -1):
        if S[i] == 'o' and cnt == 0:
            right_greedy[i] = True
            cnt = C
            k += 1
            if k == K:
                break
        elif 0 < cnt:
            cnt -= 1
    
    for i in range(N):
        if left_greedy[i] and right_greedy[i]:
            print(i + 1)


if __name__ == '__main__':
    solve()

Submission status: Wrong Answer

Solution code:
import math
import random
import sys

sys.setrecursionlimit(10**7)
MAX_INT = 2**62-1
def input() -> str:
    return sys.stdin.readline()

def main():
    n, k, c = map(int, input().split())
    s = input().strip()
    front = set()
    start = 0
    days = k
    while start < n and days:
        if s[start] == 'x':
            start += 1
        else:
            front.add(start)
            days -= 1
            start += c + 1
    # print(front)
    # if len(front) > k:
    #     return

    back = set()
    start = n-1
    days = k
    while start >= 0 and days:
        if s[start] == 'x':
            start -= 1
        else:
            back.add(start)
            days -= 1
            start -= c + 1
    # print(back)
    for i in front & back:
        print(i+1)

if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
k,y,c = map( int, input().split(" "))
ss = input()

asc = []
dsc = []

cnt = 0
err_flg = 0
while( True ):
  if(len(ss) <= cnt):
    err_flg = 1
    break
  if( ss[cnt] == "o"):
    asc.append( cnt )
    cnt += c+1
  else:
    cnt += 1
    
  if( len(asc)==y ):
    break

cnt = 0
ss = ss[::-1]
while( True ):
  if(len(ss) <= cnt):
    err_flg = 1
    break
  if( ss[cnt] == "o"):
    dsc.append( cnt )
    cnt += c+1
  else:
    cnt += 1
    
  if( len(dsc)==y ):
    break
    
for i in range(len(dsc)):
  dsc[i] = len(ss) - dsc[i] - 1
  
dsc.reverse()
#print(asc)
#print(dsc)

if( err_flg == 0 ):
  for i in range(len(asc)):
    if( asc[i] == dsc[i] ):
      print(asc[i])

Submission status: Wrong Answer

Solution code:
k,y,c = map( int, input().split(" "))
ss = input()

asc = []
dsc = []

cnt = 0
err_flg = 0
while( True ):
  if(len(ss) <= cnt):
    err_flg = 1
    break
  if( ss[cnt] == "o"):
    asc.append( cnt )
    cnt += c+1
  else:
    cnt += 1
    
  if( len(asc)==y ):
    break

cnt = 0
ss = ss[::-1]
while( True ):
  if(len(ss) <= cnt):
    err_flg = 1
    break
  if( ss[cnt] == "o"):
    dsc.append( cnt )
    cnt += c+1
  else:
    cnt += 1
    
  if( len(dsc)==y ):
    break
    
for i in range(len(dsc)):
  dsc[i] = len(ss) - dsc[i] - 1
  
dsc.reverse()
print(asc)
print(dsc)

if( err_flg == 0 ):
  for i in range(len(asc)):
    if( asc[i] == dsc[i] ):
      print(asc[i])

Submission status: Wrong Answer

Solution code:
import copy
 
n,k,c = map(int,input().split())
s = list(input())
 
front = []
back = []
 
# 前から貪欲
j = copy.copy(k)
i = 0
while j > 0:
  if s[i] == "o":
    front.append(i)
    i += c+1
    j -= 1
  else:
    i += 1
 
# 後ろから貪欲
 
j = copy.copy(k)
i = n-1
while j > 0:
  if s[i] == "o":
    back.append(i)
    i -= c+1
    j -= 1
  else:
    i -= 1

back.sort()
for i in range(k):
  if front[i] == back[i]:
    print(i+1)

Submission status: Wrong Answer

Solution code:
def main():
    n, k, c = map(int, input().split())
    s = input().strip()
    front = set()
    start = 0
    while start < n:
        if s[start] == 'x':
            start += 1
        else:
            front.add(start)
            start += c + 1
    # print(front)
    if len(front) > k:
        return

    back = set()
    start = n-1
    while start >= 0:
        if s[start] == 'x':
            start -= 1
        else:
            back.add(start)
            start -= c + 1
    # print(back)
    for i in front & back:
        print(i+1)

if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
n,k,c = map(int, input().split())
s = str(input())
t = [0 for i in range(n)]
u = [0 for i in range(n)]
i,x,y = 0,0,0
j = n-1
while i < n and x < k:
    if s[i] == "o":
        t[i] = 1
        x += 1
        i += c
    i += 1

while j >= 0 and y < k:
    if s[j] == "o":
        u[j] = 1
        y += 1
        j += -c
    j += -1
    
for i in range(0,n):
    if t[i] == 1 and u[i] == 1:
        print(i+1)

Submission status: Wrong Answer

Solution code:
n,k,c=map(int,input().split())
s=input()
ne=10**6*(-1)
fow=[]
bac=[]
for i in range(n):
    if i>ne and s[i]!="x":
        ne=i+c
        fow.append(i)
    if len(fow)==k:
        break
ne=10**6
for i in range(n-1,-1,-1):
    if i<ne and s[i]!="x":
        ne=i-c
        bac.append(i)
    if len(bac)==k:
        break
bac.sort()
for i,j in zip(fow,bac):
    if i==j:
        print(i)

Submission status: Wrong Answer

Solution code:
import copy
 
n,k,c = map(int,input().split())
s = list(input())
 
front = [0]*n
back = [0]*n
 
# 前から貪欲
j = copy.copy(k)
i = 0
while j > 0:
  if s[i] == "o":
    front[i] = 1
    i += c+1
    j -= 1
  else:
    i += 1
 
# 後ろから貪欲
 
j = copy.copy(k)
i = n-1
while j > 0:
  if s[i] == "o":
    back[i] = 1
    i -= c+1
    j -= 1
  else:
    i -= 1
 
for i in range(n):
  if front[i] == 1 and back[i] == 1:
    print(i+1)

Submission status: Wrong Answer

Solution code:
N,K,C = map(int,input().split())
S = input()
T = [s=="o" for s in S]

dpR = [0]*N
dpR[-1] = int(T[-1])
for i in range(1,N):
    i = N-1-i
    t = T[i]
    dpR[i] = dpR[i+1]
    if not t: continue
    if i+C+1 < N:
        dpR[i] = max(dpR[i],dpR[i+C+1]+1)

dpL = [(0,-N*2)]*N
dpL[0] = int(T[0])
for i,t in enumerate(T[1:],1):
    dpL[i] = dpL[i-1]
    if not t: continue
    if i-C-1 >= 0:
        dpL[i] = max(dpL[i],dpL[i-C-1]+1)
dpL = [0] + dpL + [0]
dpR = [0] + dpR + [0]
for i in range(1,N+1):
    if dpL[i] > dpL[i-1] and dpR[i] > dpR[i+1]:
        print(i)

Submission status: Wrong Answer

Solution code:
from collections import defaultdict

N, K, C = map(int, input().split())
s = list(input())
llst = []
rlst = []

index = 0
lcnt = 0
while index < N:
    if s[index] == 'o':
        llst.append(index)
        index += C + 1
        lcnt += 1
        if lcnt == K:
            break
    else:
        index += 1
index = N - 1
rcnt = 0
while index >= 0:
    if s[index] == 'o':
        rlst.append(index)
        index -= (C + 1)
        rcnt += 1
        if rcnt == K:
            break
    else:
        index -= 1
d = defaultdict(int)
for i in llst:
    d[i] += 1

for i in rlst:
    d[i] += 1

for v, c in d.items():
    if c == 2:
        print(v + 1)

Submission status: Wrong Answer

Solution code:
import copy

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

front = [0]*n
back = [0]*n

# 前から貪欲
j = copy.copy(k)
i = 0
while j > 0:
  if s[i] == "o":
    front[i] = 1
    i += c+1
    j -= 1
  else:
    i += 1

# 後ろから貪欲

j = copy.copy(k)
i = n-1
while j > 0:
  if s[i] == "o":
    back[i] = 1
    i -= c+1
    j -= 1
  else:
    i -= 1

for i in range(n):
  if front[i] == 1 and back[i] == 1:
    print(i+1)

Submission status: Wrong Answer

Solution code:
import copy

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

front = [0]*n
back = [0]*n

# 前から貪欲
j = copy.copy(k)
i = 0
while j > 0:
  if s[i] == "o":
    front[i] = 1
    i += c+1
    j -= 1
  else:
    i += 1

# 後ろから貪欲

j = copy.copy(k)
i = n-1
while j > 0:
  if s[i] == "o":
    back[i] = 1
    i -= c+1
    j -= 1
  else:
    i -= 1

  
print(front)
print(back)
for i in range(n):
  if front[i] == 1 and back[i] == 1:
    print(i+1)

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
'''
11 3 2
ooxxxoxxxoo
'''

import numpy as np

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

oks = [idx for idx, i in enumerate(S) if i == 'o']
print(oks)

for ok in oks:
    temp = oks.copy()
    temp.remove(ok)
    temp = np.array(temp)
    cnt = 0

    while True:
        if len(temp) == 0:
            print(ok + 1)
            break
        val = temp[0]
        temp = temp[temp > val + C]
        # print(temp)
        cnt += 1
        if cnt >= K:
            break

Submission status: Wrong Answer

Solution code:
n,k,c=map(int,input().split())
s=input()
l=len(s)
cand=[]
for i in range(l):
  if s[i]=='o':
    cand.append(i+1)
cnt1=[0]*(n+2)
cnt2=[0]*(n+2)
prev=0
cnt=0
for i in range(l):
  if s[i]=='o' and i>prev+c:
    cnt+=1
    cnt1[i+1]=cnt
    prev=i
  else:
    cnt1[i+1]=cnt
prev=l
cnt=0
for i in range(l-1,-1,-1):
  if s[i]=='o' and i<prev-c:
    cnt+=1
    cnt2[i+1]=cnt
    prev=i
  else:
    cnt2[i+1]=cnt
ans=[]
for i in range(len(cand)):
  tmp=cand[i]
  if cnt1[tmp-1]+cnt2[tmp+1]<k:
    ans.append(tmp)
for val in ans:
  print(val)

Submission status: Wrong Answer

Solution code:
n,k,c=map(int,input().split())
s=input()
l=len(s)
cand=[]
for i in range(l):
  if s[i]=='o':
    cand.append(i+1)
cnt1=[0]*(n+2)
cnt2=[0]*(n+2)
prev=0
cnt=0
for i in range(l):
  if s[i]=='o' and i>=prev:
    cnt+=1
    cnt1[i+1]=cnt
    prev=i+(c+1)
  else:
    cnt1[i+1]=cnt
prev=l
cnt=0
for i in range(l-1,-1,-1):
  if s[i]=='o' and i<=prev:
    cnt+=1
    cnt2[i+1]=cnt
    prev=i-(c+1)
  else:
    cnt2[i+1]=cnt
ans=[]
for i in range(len(cand)):
  tmp=cand[i]
  if cnt1[tmp-1]+cnt2[tmp+1]<k:
    ans.append(tmp)
print(ans)

Submission status: Wrong Answer

Solution code:
def main():
    from itertools import groupby
    n, k, c = map(int, input().split())
    s = list(input())

    if c == 0:
        if s.count('o') == k:
            ans = '\n'.join(map(str,range(1,n+1)))
            print(ans)
        else:
            print()
        exit()

    check_f = []
    x = 0
    for i, j in enumerate(s, 1):
        if x:
            x -= 1
            continue
        if j == 'o':
            x = c
            check_f.append(i)
        if len(check_f) == k:
            break

    check_b = []
    x = 0
    for i, j in enumerate(s[::-1]):
        if x:
            x -= 1
            continue
        if j == 'o':
            x = c
            check_b.append(n - i)
        if len(check_b) == k:
            break

    ans = list(set(check_f) & set(check_b))
    ans.sort()
    ans = '\n'.join(map(str,ans))
    print(ans)

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
# coding: utf-8


def solve(*args: str) -> str:
    n, k, c = map(int, args[0].split())
    S = args[1]

    work = [s == 'o' for s in S]
    L = []
    R = []

    day = 0
    i = 0
    while i < n and day < k:
        if work[i]:
            L.append(i+1)
            i += c+1
        else:
            i += 1

    day = k-1
    i = n-1
    while 0 <= i and 0 < day:
        if work[i]:
            R.append(i+1)
            i -= c+1
        else:
            i -= 1

    return '\n'.join(str(l) for l, r in zip(L, R[::-1]) if l == r)


if __name__ == "__main__":
    print(solve(*(open(0).read().splitlines())))

Submission status: Wrong Answer

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

ls = []
nex = -1
for i in range(N):
    if S[i] == "o" and i > nex:
        ls.append(i + 1)
        nex = i + C
        
    if len(ls) == K:
        break

rs = []
nex = N
for i in reversed(range(N)):
    if S[i] == "o" and i < nex:
        rs.append(i + 1)
        nex = i - C
        
    if len(rs) == K:
        break
        
print(*sorted(set(ls) & set(rs)), sep="\n")

Submission status: Wrong Answer

Solution code:
def main():
    from itertools import groupby
    n, k, c = map(int, input().split())
    s = list(input())

    if c == 0:
        if s.count('o') == k:
            ans = '\n'.join(map(str,range(1,n+1)))
            print(ans)
        return

    check_f = []
    x = 0
    for i, j in enumerate(s, 1):
        if x:
            x -= 1
            continue
        if j == 'o':
            x = c
            check_f.append(i)
        if len(check_f) == k:
            break

    check_b = []
    x = 0
    for i, j in enumerate(s[::-1]):
        if x:
            x -= 1
            continue
        if j == 'o':
            x = c
            check_b.append(n - i)
        if len(check_b) == k:
            break

    ans = list(set(check_f) & set(check_b))
    ans.sort()
    ans = '\n'.join(map(str,ans))
    print(ans)

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(2147483647)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7
inf = float('inf')
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))

n,k,c = LI()
s = input()

cnt = 0
i = n-1
d = defaultdict(int)
tmp = k
while i >= 0:
    if s[i] == 'o':
        cnt += 1
        d[i] = tmp
        tmp -= 1
        i -= c
    i -= 1
i = 0
f = defaultdict(int)
tmp = 1
while i < n:
    if s[i] == 'o':
        f[i] = tmp
        tmp += 1
        i += c
    i += 1
for i,j in f.items():
    if j == d[i]:
        print(i+1)