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 sys
# input = sys.stdin.readline
sys.setrecursionlimit(10 ** 9)
MOD = 10 ** 9 + 7

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

mae = [False] * N
i = 0
count = 0
while i < N and count < K:
    if S[i] == 'o':
        mae[i] = True
        count += 1
        i += C + 1
    else:
        i += 1

ushiro = [False] * N
i = N - 1
count = 0
while i >= 0 and count < K:
    if S[i] == 'o':
        ushiro[i] = True
        count += 1
        i -= (C + 1)
    else:
        i -= 1

for i in range(N):
    if mae[i] and ushiro[i]:
        print (i + 1)

Submission status: Wrong Answer

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

ok = s.count("o")

i = 0
count = 0
left = set()
while count < k:
    if s[i] == 'o':
        count += 1
        left.add(i+1)
        i += c+1
    else: i += 1


j = n-1
count = 0
right = set()
while count < k:
    if s[j] == 'o':
        count += 1
        right.add(j+1)
        j -= c+1
    else: j -= 1

ans = right & left
if ans ==set():
    print("")
else:
    for i in ans:
        print(i)

Submission status: Wrong Answer

Solution code:
from sys import stdin, stdout

N, K, C = map(int,stdin.readline().rstrip().split())
S = stdin.readline()



vec = []
rvec = []

i = 0
while i < N:
    if S[i] == 'o':
        vec.append(i)
        i += C
    i += 1

j = N - 1
while j >= 0:
    if S[j] == 'o':
        rvec.append(j)
        j -= C
    j -= 1

rvec = rvec[::-1]


ans = []
for i in range(K):
    if vec[i] == rvec[i]:
        stdout.write(str(vec[i] + 1) + '\n')
stdout.write('\n')

Submission status: Wrong Answer

Solution code:
from sys import stdin, stdout

N, K, C = map(int,stdin.readline().rstrip().split())
S = stdin.readline()



vec = []
rvec = []

i = 0
while i < N:
    if S[i] == 'o':
        vec.append(i)
        i += C
    i += 1

j = N - 1
while j >= 0:
    if S[j] == 'o':
        rvec.append(j)
        j -= C
    j -= 1

rvec = rvec[::-1]


ans = []
for i in range(K):
    if vec[i] == rvec[i]:
        stdout.write(str(vec[i] + 1) + '\n')

Submission status: Wrong Answer

Solution code:
from sys import stdin, stdout

N, K, C = map(int,stdin.readline().rstrip().split())
S = stdin.readline()

ans = []

vec = []
rvec = []

i = 0
while i < N:
    if S[i] == 'o':
        vec.append(i)
        i += C
    i += 1

j = N - 1
while j >= 0:
    if S[j] == 'o':
        rvec.append(j)
        j -= C
    j -= 1

rvec.reverse()



for i in range(K):
    if vec[i] == rvec[i]:
        ans.append(vec[i] + 1)

for x in ans:
    stdout.write(str(x) + '\n')

Submission status: Wrong Answer

Solution code:
from sys import stdin, stdout

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

ans = []

vec = []
rvec = []

i = 0
while i < N:
    if S[i] == 'o':
        vec.append(i)
        i += C
    i += 1

i = N - 1
while i >= 0:
    if S[i] == 'o':
        rvec.append(i)
        i -= C
    i -= 1

rvec.reverse()



for i in range(K):
    if vec[i] == rvec[i]:
        ans.append(vec[i] + 1)

for x in ans:
    stdout.write(str(x) + '\n')

Submission status: Wrong Answer

Solution code:
from sys import stdin, stdout

N, K, C = map(int,stdin.readline().rstrip().split())
S = stdin.readline().rstrip()

ans = []

vec = []
rvec = []

i = 0
while i < N:
    if S[i] == 'o':
        vec.append(i)
        i += C
    i += 1

i = N - 1
while i >= 0:
    if S[i] == 'o':
        rvec.append(i)
        i -= C
    i -= 1

rvec.reverse()



for i in range(K):
    if vec[i] == rvec[i]:
        ans.append(vec[i] + 1)

for x in ans:
    stdout.write(str(x) + '\n')

Submission status: Wrong Answer

Solution code:
from sys import stdin, stdout

N, K, C = map(int,stdin.readline().rstrip().split())
S = stdin.readline()

ans = []

vec = []
rvec = []

i = 0
while i < N:
    if S[i] == 'o':
        vec.append(i)
        i += C
    i += 1

i = N - 1
while i >= 0:
    if S[i] == 'o':
        rvec.append(i)
        i -= C
    i -= 1

rvec.reverse()



for i in range(K):
    if vec[i] == rvec[i]:
        ans.append(vec[i] + 1)

for x in ans:
    stdout.write(str(x) + '\n')

Submission status: Wrong Answer

Solution code:
from sys import stdin, stdout

N, K, C = map(int,stdin.readline().rstrip().split())
S = stdin.readline()

ans = []

vec = []
rvec = []

i = 0
while i < N:
    if S[i] == 'o':
        vec.append(i)
        i += (C + 1)
    else: i += 1

i = N - 1
while i >= 0:
    if S[i] == 'o':
        rvec.append(i)
        i -= (C + 1)
    else: i -= 1

rvec.reverse()



for i in range(K):
    if vec[i] == rvec[i]:
        ans.append(vec[i] + 1)

for x in ans:
    stdout.write(str(x) + '\n')

Submission status: Wrong Answer

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

L = []
R = []

i = 0
while i < N:
    if S[i] == "o":
        L.append(i)
        i += C
    i += 1

j = N-1
while j >= 0:
    if S[j] == "o":
        R.append(j)
        j -= C
    j -= 1   

for i in range(K):
    if L[i] == R[K-1-i]:
        print(L[i]+1)
        exit()

Submission status: Wrong Answer

Solution code:
import sys
from collections import *
import heapq
import math
import bisect
from itertools import permutations,accumulate,combinations,product
from fractions import gcd
def input():
    return sys.stdin.readline()[:-1]
def ruiseki(lst):
    return [0]+list(accumulate(lst))
mod=pow(10,9)+7
al=[chr(ord('a') + i) for i in range(26)]

n,k,c=map(int,input().split())
s=input()
l=[]
r=[]
day=1
while day<=n:
    if s[day-1]=="x":
        day+=1
        continue
    l.append(day)
    day+=(c+1)
# print(l)
day=n
while day>0:
    if s[day-1]=="x":
        day-=1
        continue
    r.append(day)
    day-=(c+1)
# print(r)
anslst=[]
for i in range(min(len(l),len(r))):
    if l[i]==r[-1-i]:
        anslst.append(str(l[i]))
if anslst==[]:
    # print()
    pass
else:
    print("\n".join(anslst))

Submission status: Wrong Answer

Solution code:
import sys
from collections import *
import heapq
import math
import bisect
from itertools import permutations,accumulate,combinations,product
from fractions import gcd
def input():
    return sys.stdin.readline()[:-1]
def ruiseki(lst):
    return [0]+list(accumulate(lst))
mod=pow(10,9)+7
al=[chr(ord('a') + i) for i in range(26)]

n,k,c=map(int,input().split())
s=input()
l=[]
r=[]
day=1
while day<=n:
    if s[day-1]=="x":
        day+=1
        continue
    l.append(day)
    day+=(c+1)
# print(l)
day=n
while day>0:
    if s[day-1]=="x":
        day-=1
        continue
    r.append(day)
    day-=(c+1)
# print(r)
anslst=[]
for i in range(min(len(l),len(r))):
    if l[i]==r[-1-i]:
        anslst.append(str(l[i]))
if anslst==[]:
    print()
else:
    print("\n".join(anslst))

Submission status: Wrong Answer

Solution code:
import sys
from collections import *
import heapq
import math
import bisect
from itertools import permutations,accumulate,combinations,product
from fractions import gcd
def input():
    return sys.stdin.readline()[:-1]
def ruiseki(lst):
    return [0]+list(accumulate(lst))
mod=pow(10,9)+7
al=[chr(ord('a') + i) for i in range(26)]

n,k,c=map(int,input().split())
s=input()
l=[]
r=[]
day=1
while day<=n:
    if s[day-1]=="x":
        day+=1
        continue
    l.append(day)
    day+=(c+1)
# print(l)
day=n
while day>0:
    if s[day-1]=="x":
        day-=1
        continue
    r.append(day)
    day-=(c+1)
# print(r)
anslst=[]
for i in range(min(len(l),len(r))):
    if l[i]==r[-1-i]:
        anslst.append(str(l[i]))
print("\n".join(anslst))

Submission status: Wrong Answer

Solution code:
from collections import deque
import copy

N, K, C = map(int,input().split())
S = input().split()[0]
TW = 0
q = []

for s in range(len(S)):
    if S[s] == 'o':
        TW += 1
        q.append(s+1)

if TW == K:
    for i in range(len(q)):
        print(q[i])

WD = []
LD = 0

for s in q:
    if len(WD) > K:
        break
    if LD == 0:
        WD.append(s)
        LD = s
    elif s-LD <= C:
        continue
    else:
        WD.append(s)
        LD = s


WDR = []
LD = 0
q.reverse()

for s in q:
    if len(WDR) > K:
        break
    if LD == 0:
        WDR.append(s)
        LD = s
    elif LD - s <= C:
        continue
    else:
        WDR.append(s)
        LD = s


for d in range(len(WD)):
    if WD[d] == WDR[len(WD)-d-1]:
        print(WD[d])

Submission status: Wrong Answer

Solution code:
N, K, C = [int(_) for _ in input().split()]
S = input()
cand = [i + 1 for i, s in enumerate(S) if s == 'o']
F = [[cand[0]]]
for c in cand[1:]:
    if c - F[-1][0] > C:
        F += [[]]
    F[-1] += [c]
if len(F) > K:
    exit()
B = [[cand[-1]]]
for c in cand[-2::-1]:
    if B[-1][0] - c > C:
        B += [[]]
    B[-1] += [c]
B = B[::-1]
ans = []
for f, b in zip(F, B):
    if len(f) == 1:
        ans += [f[0]]
    elif len(b) == 1:
        ans += [b[0]]
print('\n'.join(map(str, ans)))

Submission status: Wrong Answer

Solution code:
N, K, C = [int(_) for _ in input().split()]
S = input()
cand = [i + 1 for i, s in enumerate(S) if s == 'o']
G = [[cand[-1]]]
for c in cand[-2::-1]:
    if G[-1][0] - c > C:
        G += [[]]
    G[-1] += [c]
if len(G) > K:
    exit()
ans = []
for H, I in zip(G, G[1:]):
    if len(H) == 1 or (len(I) == 1
                       and H[1] - I[0] <= C) or (len(I) > 1
                                                 and H[1] - I[1] <= C):
        ans += [H[0]]
if len(G[-1]) == 1:
    ans += [G[-1][0]]
print('\n'.join(map(str, ans[::-1])))

Submission status: Wrong Answer

Solution code:
def main():
    N,K,C = map(int, input().split())
    S = input()
    # N日からK日選んで働く
    # C+1日はセット
    # oの日だけ働く

    # oの日リスト
    available = [idx for idx,s in enumerate(S) if s=="o"]

    # 左詰め(幅C以上)でoを埋めていった時のoの個数を保存した配列
    count_l = 0
    c_tmp_l = C+1
    nearest_l = 0
    left_count = [0]*N
    left_nearest = [0]*N
    count_r = 0
    c_tmp_r = C+1
    nearest_r = 0
    right_count = [0]*N
    right_nearest = [0]*N
    for i,s in enumerate(S):
        # left
        if s=="o":
            if c_tmp_l>=C:
                count_l += 1
                nearest_l = i
                c_tmp_l = 0
            else:
                c_tmp_l += 1
            left_count[i] = count_l
            left_nearest[i] = nearest_l
        else:
            left_count[i] = count_l
            left_nearest[i] = nearest_l
            c_tmp_l += 1

        # right
        j = N-i-1
        if S[j]=="o":
            if c_tmp_r>=C:
                count_r += 1
                nearest_r = j
                c_tmp_r = 0
            else:
                c_tmp_r += 1
            right_count[j] = count_r
            right_nearest[j] = nearest_r
        else:
            right_count[j] = count_r
            right_nearest[j] = nearest_r
            c_tmp_r += 1
            
        i += 1

    # 全ての"o"日について、働かない場合のを想定して、絶対働くかどうか判定していく
    for idx in available:
        lc = left_count[idx-1] if idx>0 else 0
        rc = right_count[idx+1] if idx<N-1 else 0
        ln = left_nearest[idx-1] if idx>0 else 0
        rn = right_nearest[idx+1] if idx<N-1 else N-1
        # 左端
        if idx==0:
            if rc>=K:
                continue
            else:
                print(idx+1)
        # 右端
        elif idx==N-1:
            if lc>=K:
                continue
            else:
                print(idx+1)
        # lnとrnの距離がC以上の時
        elif lc+rc>=K and rn-ln>=C:
            continue
        # lnとrnの距離がC未満だが、lc+rc-1>=Kのとき
        elif lc+rc-1>=K and rn-ln<C:
            continue
        else:
            print(idx+1)



main()

Submission status: Wrong Answer

Solution code:
line1 = input().split()
n = int(line1[0])
k = int(line1[1])
c = int(line1[2])
s = list(input())
l = [s.index("o") + 1]
r = [len(s) - s[::-1].index("o")]
for i in range(1, k):
  j = l[i - 1]
  m = r[i - 1]
  while j - l[i - 1] <= c or s[j - 1] != "o":
    j += 1
  while r[i - 1] - m <= c or s[m - 1] != "o":
    m -= 1
  r.append(m)
  l.append(j)
for i in range(len(r)):
  if r[i] == l[i]:
    print(r[i])

Submission status: Wrong Answer

Solution code:
line1 = input().split()
n = int(line1[0])
k = int(line1[1])
c = int(line1[2])
s = list(input())
l = [s.index("o") + 1]
r = [len(s) - s[::-1].index("o")]
for i in range(1, k):
  j = l[i - 1]
  m = r[i - 1]
  while j - l[i - 1] <= c or s[j - 1] != "o":
    j += 1
  while r[i - 1] - m <= c or s[m - 1] != "o":
    m -= 1
  r.append(m)
  l.append(j)
for i in range(len(r)):
  if r[i] == l[i]:
    print(i)

Submission status: Wrong Answer

Solution code:
line1 = input().split()
n = int(line1[0])
k = int(line1[1])
c = int(line1[2])
s = list(input())
t = s[::-1]
l = [s.index("o") + 1]
r = [len(s) - t.index("o")]
for i in range(1, k):
  j = l[i - 1]
  m = r[i - 1]
  while j - l[i - 1] <= c or s[j - 1] != "o":
    j += 1
  while r[i - 1] - m <= c or s[m - 1] != "o":
    m -= 1
  r.append(m)
  l.append(j)
d = set(r) & set(l)
for i in d:
  print(i)

Submission status: Wrong Answer

Solution code:
import sys, bisect, math, itertools, heapq, collections
from operator import itemgetter
# a.sort(key=itemgetter(i)) # i番目要素でsort
from functools import lru_cache
# @lru_cache(maxsize=None)
sys.setrecursionlimit(10**8)
input = sys.stdin.readline
INF = float('inf')
mod = 10**9+7
eps = 10**-7
def inp():
    '''
    一つの整数
    '''
    return int(input())
def inpl():
    '''
    一行に複数の整数
    '''
    return list(map(int, input().split()))

n, k, c = inpl()
s = list(input())[:-1]
q = collections.deque()
cool = 0
left = [0] * n
right = [0] * n
val=-1
for i in range(n):
    if cool<=0 and s[i]=="o" and val<k:
        val += 1
        cool = c
    else:
        cool-=1
    left[i] = val
cool = 0
val+=1
for i in range(n-1,-1,-1):
    if cool<=0 and s[i]=="o" and val>0:
        val -= 1
        cool = c
    else:
        cool-=1
    right[i]=val
# print(left)
# print(right)
for i in range(n):
    if ((i==0 and left[i] == right[i]) or left[i] - left[i - 1] == 1) and ((i == n - 1 and left[i]==right[i]) or right[i + 1] - right[i] == 1):
        print(i + 1)

Submission status: Wrong Answer

Solution code:
import sys, bisect, math, itertools, heapq, collections
from operator import itemgetter
# a.sort(key=itemgetter(i)) # i番目要素でsort
from functools import lru_cache
# @lru_cache(maxsize=None)
sys.setrecursionlimit(10**8)
input = sys.stdin.readline
INF = float('inf')
mod = 10**9+7
eps = 10**-7
def inp():
    '''
    一つの整数
    '''
    return int(input())
def inpl():
    '''
    一行に複数の整数
    '''
    return list(map(int, input().split()))

n, k, c = inpl()
s = list(input())[:-1]
q = collections.deque()
cool = 0
left = [0] * n
right = [0] * n
val=-1
for i in range(n):
    if cool<=0 and s[i]=="o" and val<k:
        val += 1
        cool = c
    else:
        cool-=1
    left[i] = val
cool = 0
val+=1
for i in range(n-1,-1,-1):
    if cool<=0 and s[i]=="o" and val>0:
        val -= 1
        cool = c
    else:
        cool-=1
    right[i]=val
# print(left)
# print(right)
for i in range(n):
    if (i == 0 or left[i] - left[i - 1] == 1) and (i == n - 1 or right[i + 1] - right[i] == 1):
        print(i + 1)

Submission status: Wrong Answer

Solution code:
import math
import fractions
#import sys
#input = sys.stdin.readline

def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    # divisors.sort()
    return divisors

def ValueToBits(x,digit):
    res = [0 for i in range(digit)]
    now = x
    for i in range(digit):
        res[i]=now%2
        now = now >> 1
    return res

def BitsToValue(arr):
    n = len(arr)
    ans = 0
    for i in range(n):
        ans+= arr[i] * 2**i
    return ans

def ZipArray(a):
    aa = [[a[i],i]for i in range(n)]

    aa.sort(key = lambda x : x[0])
    for i in range(n):
        aa[i][0]=i+1
    aa.sort(key = lambda x : x[1])
    b=[aa[i][0] for i in range(len(a))]
    return b

def ValueToArray10(x, digit):
    ans = [0 for i in range(digit)]
    now = x
    for i in range(digit):
        ans[digit-i-1] = now%10
        now = now //10
    return ans

def Zeros(a,b):
    if(b<=-1):
        return [0 for i in range(a)]
    else:
        return [[0 for i in range(b)] for i in range(a)]

class Bit:
    def __init__(self, n):
        self.size = n
        self.tree = [0] * (n + 1)
 
    def sum(self, i):
        s = 0
        while i > 0:
            s += self.tree[i]
            i -= i & -i
        return s
 
    def add(self, i, x):
        while i <= self.size:
            self.tree[i] += x
            i += i & -i


'''
def cmb(n, r, p):
    if (r < 0) or (n < r):
        return 0
    r = min(r, n - r)
    return fact[n] * factinv[r] * factinv[n-r] % p

p = 2
N = 10 ** 6 + 2
fact = [1, 1]  # fact[n] = (n! mod p)
factinv = [1, 1]  # factinv[n] = ((n!)^(-1) mod p)
inv = [0, 1]  # factinv 計算用

for i in range(2, N + 1):
    fact.append((fact[-1] * i) % p)
    inv.append((-inv[p % i] * (p // i)) % p)
    factinv.append((factinv[-1] * inv[-1]) % p)

'''

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

#################################################
#################################################
#################################################
#################################################




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

xo = []
for i in range(n):
    xo.append(1 if s[i]=='o' else 0)

now = 0
lefts=[]
for i in range(k):
    while(True):
        if(xo[now]==1):
            lefts.append(now)
            now+=c+1
            break
        else:
            now+=1

if(sum(xo[now:])>=1):
    exit()

#print(lefts)

ans = []
xo.append(0)
for i in range(1,k):
    only = 1
    for j in range(c):
        if(xo[min(lefts[i]+j+1, n)]==1):
            only=0
    if(only==1):
        ans.append(lefts[i])

if(sum(xo[lefts[-1]+1:])==0 and len(lefts)>=2):
    ans.append(lefts[-2])
ans.sort()

for i in ans:
    print(i+1)

Submission status: Wrong Answer

Solution code:
n,k,c=map(int,input().split())
s=list(input())
i=0
l=set()
r=set()
while i<n and len(l)<=k:
  if s[i]=='o':
    l.add(i+1)
    i+=c+1
  else:
    i+=1
i=0
while i<n and len(r)<=k:
  if s[-i-1]=='o':
    r.add(n-i)
    i+=c+1
  else:
    i+=1
print(*sorted(list(l&r)),sep='\n')

Submission status: Wrong Answer

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

l = set()
r = set()
i = 0
while i < n:
    if s[i] == 'o':
        l.add(i)
        i += c
    if len(l) == k:
        break
    i+=1

i = n-1
while i >= 0:
    if s[i] == 'o':
        r.add(i)
        i -= c
    if len(r) == k:
        break
    i-=1

ans = l.intersection(r)

ans = sorted(list(ans))

for i in ans:
    print(i+1)

Submission status: Wrong Answer

Solution code:
from heapq import heappush, heappop
from bisect import bisect_left, bisect_right
from collections import deque, defaultdict
from itertools import combinations, permutations, combinations_with_replacement
from itertools import accumulate
from math import ceil, sqrt, pi

MOD = 10 ** 9 + 7
INF = 10 ** 18
#
N, K, C = map(int, input().split())
S = input()

dp1 = [0] * N
dp2 = [0] * N

i = 0
cnt = 0
while i < N:
    if S[i] == "o":
        dp1[i] = 1
        cnt += 1
        i += C + 1
    else:
        i += 1
    if cnt == K:
        break
#print(dp1)

i = 0
cnt = 0
S = S[::-1]
while i < N:
    if S[i] == "o":
        dp2[i] = 1
        i += C + 1
        cnt += 1
    else:
        i += 1
    if cnt == K:
        break
dp2 = dp2[::-1]

for i in range(N):
    if dp1[i] + dp2[i] == 2:
        print(i + 1)

Submission status: Wrong Answer

Solution code:
def f(dp):
    i = 0
    cnt = 0
    while i < N:
        if cnt == K:
            break
        if S[i] == "o":
            dp[i] = 1
            i += C + 1
            cnt += 1
            continue
        else:
            i += 1
            continue
        
    return dp

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

dp1 = [0] * N
dp2 = [0] * N

dp1 = f(dp1)
S = S[::-1]
dp2 = f(dp2)[::-1]
#print(dp2)
#print(dp1)

for i in range(N):
    if dp1[i] and dp2[i]:
        print(i + 1)

Submission status: Wrong Answer

Solution code:
def f(dp):
    i = 0
    while i < N:
        if S[i] == "o":
            dp[i] = 1
            i += C + 1
            continue
        else:
            i += 1
            continue
    return dp

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

dp1 = [0] * N
dp2 = [0] * N

dp1 = f(dp1)
S = S[::-1]
dp2 = f(dp2)[::-1]
#print(dp2)
#print(dp1)

for i in range(N):
    if dp1[i] and dp2[i]:
        print(i + 1)

Submission status: Wrong Answer

Solution code:
from sys import stdin, stdout
import math
import bisect
import re

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

arr1 = set()
arr2 = set()

rest = -1
cnt = k
for i in range(len(s)):
    if rest < 0 and s[i] == 'o':
        rest = c
        cnt -= 1
        arr1.add(i + 1)
    rest -= 1
    if cnt <= 0:
        break

rest = -1
cnt = k
for i in range(len(s)-1,-1,-1):
    if rest < 0 and s[i] == 'o':
        rest = c
        cnt -= 1
        arr2.add(i + 1)
    rest -= 1
    if cnt <= 0:
        break

ans = arr1 & arr2
ans = list(ans)
ans.sort()

for each in ans:
    stdout.writelines('%d\n' % each)

Submission status: Wrong Answer

Solution code:
n, k, c = input().split()
k = int(k)
n = int(n)
c = int(c)
s = input()
l = [i + 1 for i, x in enumerate(s) if x == 'o']

# print(l)

s = 0
n_s = 0
e_flag = True

f = []

for i in l:
    if i <= s:
        continue
    n_s += 1
    f.append(i)
    if n_s == k:
        e_flag = False
        break
    s = i + c

# print(f)

if e_flag:
    print()
    exit(0)

b = []
n_s = 0
s = 200009

for i in reversed(l):
    if i >= s:
        continue
    n_s += 1
    b.append(i)
    if n_s == k:
        break
    s = i - c

# print(b)

r = list(set(f) - (set(f) - set(b)))
if len(r) == 0:
    exit(0)
for i in sorted(r):
    print(i)

Submission status: Wrong Answer

Solution code:
n, k, c = input().split()
k = int(k)
n = int(n)
c = int(c)
s = input()
l = [i + 1 for i, x in enumerate(s) if x == 'o']

# print(l)

if c == 0:
    if n > k:
        exit(0)

s = 0
n_s = 0
e_flag = True

f = []

for i in l:
    if i <= s:
        continue
    n_s += 1
    f.append(i)
    if n_s == k:
        e_flag = False
        break
    s = i + c

# print(f)

if e_flag:
    print()
    exit(0)

b = []
n_s = 0
s = 200009

for i in reversed(l):
    if i >= s:
        continue
    n_s += 1
    b.append(i)
    if n_s == k:
        break
    s = i - c

# print(b)

r = list(set(f) - (set(f) - set(b)))
if len(r) == 0:
    exit(0)
for i in sorted(r):
    print(i)

Submission status: Wrong Answer

Solution code:
n, k, c = input().split()
k = int(k)
n = int(n)
c = int(c)
s = input()
l = [i + 1 for i, x in enumerate(s) if x == 'o']

# print(l)

s = 0
n_s = 0
e_flag = True

f = []

for i in l:
    if i <= s:
        continue
    n_s += 1
    f.append(i)
    if n_s == k:
        e_flag = False
        break
    s = i + c

# print(f)

if e_flag:
    print()
    exit(0)

b = []
n_s = 0
s = 200009

for i in reversed(l):
    if i >= s:
        continue
    n_s += 1
    b.append(i)
    if n_s == k:
        break
    s = i - c

# print(b)

r = list(set(f) - (set(f) - set(b)))
for i in sorted(r):
    print(i)

Submission status: Wrong Answer

Solution code:
n, k, c = input().split()
k = int(k)
n = int(n)
c = int(c)
s = input()
l = [i + 1 for i, x in enumerate(s) if x == 'o']

# print(l)

s = 0
n_s = 0
e_flag = True

f = []

for i in l:
    if i <= s:
        continue
    n_s += 1
    f.append(i)
    if n_s == k:
        e_flag = False
        break
    s = i + c

# print(f)

if e_flag:
    exit(0)

b = []
n_s = 0
s = 200009

for i in reversed(l):
    if i >= s:
        continue
    n_s += 1
    b.append(i)
    if n_s == k:
        break
    s = i - c

# print(b)

r = list(set(f) - (set(f) - set(b)))
for i in sorted(r):
    print(i)

Submission status: Wrong Answer

Solution code:
n, k, c = input().split()
k = int(k)
n = int(n)
c = int(c)
s = input()
l = [i + 1 for i, x in enumerate(s) if x == 'o']

# print(l)

if k == 1:
    if len(l) == 1:
        print(l[0])
    else:
        exit(0)

s = 0
n_s = 0
e_flag = True

f = []

for i in l:
    if i <= s:
        continue
    n_s += 1
    f.append(i)
    if n_s == k:
        e_flag = False
        break
    s = i + c

# print(f)

if e_flag:
    exit(0)

b = []
n_s = 0
s = 200009

for i in reversed(l):
    if i >= s:
        continue
    n_s += 1
    b.append(i)
    if n_s == k:
        break
    s = i - c

# print(b)

r = list(set(f) - (set(f) - set(b)))
for i in sorted(r):
    print(i)

Submission status: Wrong Answer

Solution code:
n, k, c = input().split()
k = int(k)
n = int(n)
c = int(c)
s = input()
l = [i + 1 for i, x in enumerate(s) if x == 'o']

# print(l)

if k == 1:
    if len(l) == 1:
        print(l[0])
    else:
        exit(0)

s = 0
n_s = 0
e_flag = True

f = []

for i in l:
    if i <= s:
        continue
    n_s += 1
    f.append(i)
    if n_s == k:
        e_flag = False
        break
    s = i + c

# print(f)

if e_flag:
    exit(0)

b = []
n_s = 0
s = 200001

for i in reversed(l):
    if i >= s:
        continue
    n_s += 1
    b.append(i)
    if n_s == k:
        break
    s = i - c

# print(b)

r = list(set(f) - (set(f) - set(b)))
for i in sorted(r):
    print(i)

Submission status: Wrong Answer

Solution code:
n, k, c = input().split()
k = int(k)
n = int(n)
c = int(c)
s = input()
l = [i + 1 for i, x in enumerate(s) if x == 'o']

# print(l)

if k == 1:
    if len(l) == 1:
        print(l[0])
    else:
        exit(0)

s = 0
n_s = 0
e_flag = True

f = []

for i in l:
    if i <= s:
        continue
    n_s += 1
    f.append(i)
    if n_s == k:
        e_flag = False
        break
    s = i + c

# print(f)

if e_flag:
    exit(0)

b = []
n_s = 0
s = 200001

for i in reversed(l):
    if i >= s:
        continue
    n_s += 1
    b.append(i)
    if n_s == k:
        break
    s = i - c

# print(b)

r = set(f) - (set(f) - set(b))
for i in r:
    print(i)

Submission status: Wrong Answer

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

import sys
from collections import deque
N, K, C = map(int, sys.stdin.readline().split())
S = list(sys.stdin.readline().rstrip())
O = [i for i, x in enumerate(S) if x == "o"]
S = deque([O[0]])
T = deque([O[-1]])
a = 0
for j in O:
    if len(S) == K:
        break
    if j > S[a] + C:
        S.append(j)
        a += 1
        

b = -1
for k in O[::-1]:
    if len(T) == K:
        break
    if k < T[b] - C:
        T.append(k)
        b -= 1
        


for m in range(K):
    if S[m] == T[-m-1]:
        print(S[m] + 1)

Submission status: Wrong Answer

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

#前から貪欲
maekara=[]
i=1
cnt=0
while i<=N and cnt<K:
    if S[i-1]!='x':
        maekara.append(i)
        i+=C+1
        cnt+=1
    else: i+=1

usirokara=[]
j=N
cnt=0
while j>=0 and cnt<K:
    if S[j-1]!='x':
        usirokara.append(j)
        j-=C+1
        cnt+=1
    else: j-=1


ans=set(maekara)&set(usirokara)
ans=sorted(list(ans))
#print(maekara,usirokara)
for i in ans: print(i)

Submission status: Wrong Answer

Solution code:
n,k,c=map(int,input().split())
s=input()
accum=[0]*n
accumrev=[0]*n
i=0
while i<n:
    if s[i]=="o":
        accum[i]=1
        i+=c+1
    else:
        i+=1
i=n-1
while i>-1:
    if s[i]=="o":
        accumrev[i]=1
        i-=c+1
    else:
        i-=1
for i in range(n-1):
    accum[i+1]+=accum[i]
    accumrev[n-i-2]+=accumrev[n-i-1]
if n==1:
    print(1)
    exit()
for i in range(n):
    if 0<i<n-1:
        if accum[i-1]>=k or accumrev[i+1]>=k:
            continue
        else:
            if accum[i]>accum[i-1] and accumrev[i]>accumrev[i+1]:
                print(i+1)
    elif i==0:
        if accumrev[i+1]<k and s[i]=="o":
            print(i+1)
    else:
        if accum[i-1]<k and s[i]=="o":
            print(i+1)
#print(accum)
#print(accumrev)

Submission status: Wrong Answer

Solution code:
n,k,c=map(int,input().split())
s=input()
accum=[0]*n
accumrev=[0]*n
i=0
while i<n:
    if s[i]=="o":
        accum[i]=1
        i+=c+1
    else:
        i+=1
i=n-1
while i>-1:
    if s[i]=="o":
        accumrev[i]=1
        i-=c+1
    else:
        i-=1
for i in range(n-1):
    accum[i+1]+=accum[i]
    accumrev[n-i-2]+=accumrev[n-i-1]
if n==1:
    print(1)
    exit()
for i in range(n):
    if 0<i<n-1:
        if accum[i-1]>=k or accumrev[i+1]>=k:
            continue
        else:
            if accum[i]>accum[i-1] and accumrev[i]>accumrev[i+1]:
                print(i+1)
    elif i==0:
        if accumrev[i+1]<k:
            print(i+1)
    else:
        if accum[i-1]<k:
            print(i+1)
#print(accum)
#print(accumrev)

Submission status: Wrong Answer

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

count = 0

l, r = [0] * n, [0] * n

for i in range(n):
    m = i + c * count
    if m >= n:
        break
    if s[m] == 'o':
        count += 1
        if count > k:
            break
        l[m] = count

count = 0

for i in range(n - 1, -1, -1):
    m = i - c * count
    if m < 0:
        break
    if s[m] == 'o':
        count += 1
        if count > k:
            break
        r[m] = count

for i in range(n):
    if l[i] > 0 and r[i] > 0:
        print(i + 1)

Submission status: Wrong Answer

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

count = 0

l, r = [0] * n, [0] * n

for i in range(n):
    m = i + c * count
    if m >= n:
        break
    if s[m] == 'o':
        count += 1
        if count > k:
            break
        l[m] = count

count = 0

for i in range(n - 1, -1, -1):
    m = i - c * count
    if m < 0:
        break
    if s[m] == 'o':
        count += 1
        if count > k:
            break
        r[m] = count

for i in range(n):
    if l[i] + r[i] > k:
        print(i + 1)