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:
n, k, c = map(int, input().split())
c += 1
s = list(input())
a = []
i = 0
while i < len(s):
    if s[i] == 'x':
        i += 1
        continue
    a.append(i)
    i += c
b = []
j = len(s)-1
while j > -1:
    if s[j] == 'x':
        j -= 1
        continue
    b.append(j)
    j -= c
ans = set(a) & set(b)
if len(ans) > k:
    pass
else:
    for n in ans:
        print(n+1)

Submission status: Wrong Answer

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

L, R = [], []
i = 0
while len(L) < K and i < N:
	if S[i] == 'x':
		i += 1
		continue
	L.append(i)
	i += C + 1

i = 0
while len(R) < K and i < N:
	if S[-(i + 1)] == 'x':
		i += 1
		continue
	R.append(-(i + 1) + N)
	i += C + 1

[print(x + 1) for x in set(L) & set(R)]

Submission status: Wrong Answer

Solution code:
n, k, c = map(int, input().split())
s = input()
l = len(s) - 1
i = 0
lb = []
le = []
while i < len(s) and len(lb) < k:
    # print(i)
    if s[i] == 'o':
        lb.append(i)
        i += c + 1
        continue
    i += 1

while l > -1 and len(le) < k:
    if s[l] == 'o':
        le.append(l)
        l -= (c + 1)
        continue
    l -= 1

se = set(le)
for j in range(0, len(lb)):
    if lb[j] in se:
        print(lb[j]+1)

Submission status: Wrong Answer

Solution code:
def main():
    N,K,C = map(int,input().split())
    S = input()
    #後ろと前からで貪欲法
    tmp = [i for i in range(N) if S[i] == "o"]
    date_fs = [tmp[0]]
    fs = 1
    for i in range(1,len(tmp)):
        #if fs == K:
        #    break
        if tmp[i] > C + date_fs[-1]:
            fs += 1
            date_fs.append(tmp[i])
        else:
            continue

    date_ls = [tmp[-1]]
    ls = 1
    for i in range(len(tmp)-1,-1,-1):
        #if ls == K:
        #    break
        if tmp[i] < date_ls[-1] - C:
            ls += 1
            date_ls.append(tmp[i])
        else:
            continue

    #https://note.nkmk.me/python-list-common/
    fl = set(date_fs) & set(date_ls)
    fl_list = sorted(list(fl))
    for d in fl_list:
        print(d+1)

Submission status: Wrong Answer

Solution code:
def main():
    N,K,C = map(int,input().split())
    S = input()
    #後ろと前からで貪欲法
    tmp = [i for i in range(N) if S[i] == "o"]
    date_fs = [tmp[0]]
    fs = 1
    for i in range(1,len(tmp)):
        if fs == K:
            break
        if tmp[i] > C + date_fs[-1]:
            fs += 1
            date_fs.append(tmp[i])
        else:
            continue

    date_ls = [tmp[-1]]
    ls = 1
    for i in range(len(tmp)-1,-1,-1):
        if ls == K:
            break
        if tmp[i] < date_ls[-1] - C:
            ls += 1
            date_ls.append(tmp[i])
        else:
            continue

    #https://note.nkmk.me/python-list-common/
    fl = set(date_fs) & set(date_ls)
    fl_list = sorted(list(fl))
    for d in fl_list:
        print(d+1)

Submission status: Wrong Answer

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

L = []
R = []
tmp = -1
tmp2 = N

for i in range(N):
    if S[i] == 'o' and i > tmp:
        L.append(i + 1)
        tmp = i + C

    if S[N - 1 - i] == 'o' and N - 1 - i < tmp2:
        R.append(N - i)
        tmp2 = (N - 1 - i) - C

com = list(set(L[:K]) & set(R[:K]))
com.sort()
for c in com:
    print(c)

Submission status: Wrong Answer

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

L = []
R = []
tmp = -1
tmp2 = N

for i in range(N):
    if S[i] == 'o' and i > tmp:
        L.append(i + 1)
        tmp = i + C

    if S[N - 1 - i] == 'o' and N - 1 - i < tmp2:
        R.append(N - i)
        tmp2 = (N - 1 - i) - C

com = list(set(L) & set(R))
com.sort()
for c in com:
    print(c)

Submission status: Wrong Answer

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

L = []
R = []
tmp = -1
tmp2 = N

for i in range(N):
    if S[i] == 'o' and i > tmp:
        L.append(i + 1)
        tmp = i + C

    if S[N - 1 - i] == 'o' and N - 1 - i < tmp2:
        R.append(N - i)
        tmp2 = (N - 1 - i) - C

for l in L:
    if l in R:
        print(l)

Submission status: Wrong Answer

Solution code:
n, k, c = map(int, input().split())
s = input()
l = [-1] * n
r = [-1] * n
pre = -n
cnt = 0
for i in range(0, n):
    if s[i] == 'x':
        continue
    if i - pre - 1 >= c:
        l[cnt] = i + 1
        cnt += 1
        pre = i
cnt = 0
pre = 2 * n
for i in range(n - 1, -1, -1):
    if s[i] == 'x':
        continue
    if pre - i - 1 >= c:
        
        r[k - cnt - 1] = i + 1
        cnt += 1
        pre = i
ans = []
for i in range(0, k):
    if l[i] == r[i] and l[i] != -1:
        ans.append(l[i])
for x in ans:
    print(x)

Submission status: Wrong Answer

Solution code:
n,k,c = map(int,raw_input().split())
s = raw_input()
most = [0]*(n+1)
i = n
days = 0
while i > 0:
    if s[i-1] == 'o':
        days += 1
        for j in xrange(min(max(1,c),i-1)):
            #print days
            most[i-j-1] = days
        i -= (c+1)
    else:
        i -= 1
    if i<n-1:
        most[i] = most[i+1]

remain = k
i = 1
while i<=n:
    if s[i-1] == 'o':
        if most[i] < remain:
            print i
        remain -= 1
        i += c+1
    else:
        i += 1

Submission status: Wrong Answer

Solution code:
n,k,c = map(int,raw_input().split())
s = raw_input()
most = [0]*(n+1)
i = n
days = 0
while i > 0:
    if s[i-1] == 'o':
        days += 1
        for j in xrange(min(max(1,c),i)):
            #print days
            most[i-j-1] = days
        i -= (c+1)
    else:
        i -= 1
    if i<n-1:
        most[i] = most[i+1]

remain = k
i = 1
while i<=n:
    if s[i-1] == 'o':
        if most[i] < remain:
            print i
        remain -= 1
        i += c+1
    else:
        i += 1

Submission status: Wrong Answer

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

def func(s,k,c):
  i = 0
  res = []
  while 1:
    if s[i] == 'o':
      res.append(i)
      if len(res)== k:
        break
      i += c
    i+= 1
  return res
ans1 = set(func(s,k,c))
ans2 = set(func(s[::-1],k,c))
ans2 = [n-a-1 for a in ans2]


ans = list(ans1.intersection(ans2))
for a in ans:
  print(a+1)

Submission status: Wrong Answer

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

def func(s,k,c):
  i = 0
  res = []
  while 1:
    if s[i] == 'o':
      res.append(i)
      if len(res)== k:
        break
      i += c
    i+= 1
  return res
ans1 = set(func(s,k,c))
ans2 = set(func(s[::-1],k,c))

ans = list(ans1.intersection(ans2))
for a in ans:
  print(a+1)

Submission status: Wrong Answer

Solution code:
import sys
sys.setrecursionlimit(300000)

def I(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LMI(): return list(map(int, sys.stdin.readline().split()))
MOD = 10 ** 9 + 7
INF = float('inf')

N, K, C = MI()
S = input()

L = set()
i = 0
while i < N:
    if len(L) >= K:
        break
    elif S[i] == 'o':
        L.add(i)
        i += C + 1
    else:
        i += 1

R = set()
i = N - 1
while i >= 0:
    if len(R) >= K:
        break
    elif S[i] == 'o':
        R.add(i)
        i -= C + 1
    else:
        i -= 1

days = L.intersection(R)
days = list(days)
days.sort()
for day in days:
    print(day + 1)

Submission status: Wrong Answer

Solution code:
#入力受け取り
N, K, C=map(int, input().split())
S='x'+input() #インデックスと日数を合わせるために先頭に'x'を追加

#前詰めな働き方の場合で働く日を求める
A=[] #前詰めで働く場合の働く日リスト
i=1 #1日目から判定スタート
while len(A)<K:
  if S[i]=='o':
    #i日目に働けるなら、リストにiを追加し、iをC+1だけ進める
    A.append(i+1)
    i+=(C+1)
  else:
    #i日目に働けないならその日は働けないので(小泉構文)、iに1足すのみ
    i+=1
    
#後ろ詰めな働き方の場合で働く日を求める
B=[]
i=N #N日目から判定スタート
while len(B)<K:
  if S[i]=='o':
    #i日目に働けるなら、リストにiを追加し、iをC+1だけ戻す
    B.append(i)
    i-=(C+1)
  else:
    #i日目に働けないならその日は働けないので(小泉構文)、iから1引くのみ
    i-=1
    
B=B[::-1] #Bは降順に追加されているので、昇順にする
for i in range(K):
  #i番目に働くのが前詰めと後ろ詰めで同じ日であれば出力
  if A[i]==B[i]:
    print(A[i])

Submission status: Wrong Answer

Solution code:
n,k,c=map(int,input().split())
s=input()
l=[0]*n
r=[0]*n
mini=0
maxi=n-1
numl=1
numr=k
for i in range(n):
  if s[i]!='x' and i>=mini:
    l[i]=numl
    numl+=1
    mini+=i+(c+1)
for i in reversed(range(n)):
  if s[i]!='x' and i<=maxi:
    r[i]=numr
    numr-=1
    maxi=i-(c+1)
for i in range(n):
  if l[i]!=0 and l[i]==r[i]:
    print(i+1)

Submission status: Wrong Answer

Solution code:
n,k,c=map(int,input().split())
s=input()
def greedy_work(days,rest,plan):
  day_count=0
  go=[0]*n
  while day_count < days:
    if plan[day_count]=='o':
      go[day_count]=1
      day_count += rest+1
    else:
      day_count += 1
  return(go)
front = greedy_work(n,c,s)
back = greedy_work(n,c,s[::-1])
back = back[::-1]
for i in range(n):
  if front[i]==1 and back[i]==1:
    print(i+1)

Submission status: Wrong Answer

Solution code:
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
from bisect import bisect_right, bisect_left
import random
from itertools import permutations, accumulate, combinations, product
import sys
import string
from bisect import bisect_left, bisect_right
from math import factorial, ceil, floor, gamma, log
from operator import mul
from functools import reduce
from copy import deepcopy

sys.setrecursionlimit(2147483647)
INF = 10 ** 20
def LI(): return list(map(int, sys.stdin.buffer.readline().split()))
def I(): return int(sys.stdin.buffer.readline())
def LS(): return sys.stdin.buffer.readline().rstrip().decode('utf-8').split()
def S(): return sys.stdin.buffer.readline().rstrip().decode('utf-8')
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)]
def SRL(n): return [list(S()) for i in range(n)]
def MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]
mod = 10 ** 9 + 7

n, k, c = LI()
s = S()
l = [0] * n
r = [0] * n
a = c
x = 0
for i in range(n):
    a += 1
    if s[i] == 'o' and a >= c:
        x += 1
        a = 0
    l[i] = x

l = [0] + l
a = c
x = 0
for j in range(n - 1, -1, -1):
    a += 1
    if s[j] == 'o' and a > c:
        x += 1
        a = 0
    r[j] = x

r = r + [0]
for m in range(n):
    if l[m] + r[m + 1] == k - 1:
        print(m + 1)

Submission status: Wrong Answer

Solution code:
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
from bisect import bisect_right, bisect_left
import random
from itertools import permutations, accumulate, combinations, product
import sys
import string
from bisect import bisect_left, bisect_right
from math import factorial, ceil, floor, gamma, log
from operator import mul
from functools import reduce
from copy import deepcopy

sys.setrecursionlimit(2147483647)
INF = 10 ** 20
def LI(): return list(map(int, sys.stdin.buffer.readline().split()))
def I(): return int(sys.stdin.buffer.readline())
def LS(): return sys.stdin.buffer.readline().rstrip().decode('utf-8').split()
def S(): return sys.stdin.buffer.readline().rstrip().decode('utf-8')
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)]
def SRL(n): return [list(S()) for i in range(n)]
def MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]
mod = 10 ** 9 + 7

n, k, c = LI()
s = S()
l = [0] * n
r = [0] * n
a = c
x = 0
for i in range(n):
    a += 1
    if s[i] == 'o' and a >= c:
        x += 1
        a = 0
    l[i] = x

l = [0] + l
a = c
x = 0
for j in range(n - 1, -1, -1):
    a += 1
    if s[j] == 'o' and a > c:
        x += 1
        a = 0
    r[j] = x

r = r + [0]
print(l)
print(r)
for m in range(n):
    if l[m] + r[m + 1] == k - 1:
        print(m + 1)

Submission status: Wrong Answer

Solution code:
N, K, C = map(int, input().split())
S = list(input())
#left_greedy
count = 0
switch = 0
left_greedy = [0]*len(S)
right_greedy=[0]*len(S)
clist = [0]*len(S)
for l in range(len(S)):
    i = S[l]
    if switch ==1:
        if i == 'o':
            if count >= C:
                left_greedy[l]=1
                clist[l] = count
                count = 0
            else:
                count+=1
                clist[l] = count
        else:
            count+=1
            clist[l] = count
    else:
        if i == 'o':
            left_greedy[l]=1
            switch+=1
#left_greedy
switch = 0
for r in range(len(S)-1, 0, -1):
    i = S[r]
    if switch ==1:
        if i == 'o':
            if count >= C:
                right_greedy[r]=1
                clist[r] = count
                count = 0
            else:
                count+=1
                clist[l] = count
        else:
            count+=1
            clist[l] = count
    else:
        if i == 'o':
            right_greedy[r]=1
            switch+=1

if  left_greedy.count(1)== K:
    for n in range(len(S)):
        if left_greedy[n] == right_greedy[n]==1:
            print(n+1)

Submission status: Wrong Answer

Solution code:
N, K, C = map(int, input().split())
S = list(input())
#left_greedy
countr = 0
countl = 0
switchr = 0
switchl = 0
left_greedy = [0]*len(S)
right_greedy=[0]*len(S)
leng = len(S)
#left
for l in range(leng):
    i = S[l]
    if switchl ==1:
        if i == 'o':
            if countl >= C:
                left_greedy[l]=1
                
                countl = 0
            else:
                countl+=1
                
        else:
            countl+=1
    else:
        if i == 'o':
            left_greedy[l]=1
            switchl+=1
#right_greedy
    r = leng-l-1
    i = S[r]
    if switchr ==1:
        if i == 'o':
            if countr >= C:
                right_greedy[r]=1
                
                countr = 0
            else:
                countr+=1
        else:
            countr+=1
            
    else:
        if i == 'o':
            right_greedy[r]=1
            switchr+=1
for n in range(leng):
    if left_greedy[n] == right_greedy[n]==1:
        print(n+1)

Submission status: Wrong Answer

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

l = []
r = []

res = []

def fun(string, pos):
    counter = 0
    consec_counter = c+1
    res = []
    while pos < n:
        # print(pos)
        if counter == k:
            break
        if consec_counter >= c and string[pos] == 'o':
            counter += 1
            consec_counter = 0
            res.append(pos)
        else:
            consec_counter += 1
        pos += 1;
    # print(res)
    return res

def invfun(string, pos):
    counter = 0
    consec_counter = c+1
    res = []
    while pos >= 0:
        if counter == k:
            break
        # print(pos)
        if consec_counter >= c and string[pos] == 'o':
            counter += 1
            consec_counter = 0
            res.append(pos)
        else:
            consec_counter += 1
        pos -= 1;
    # print(res)
    return res



little_res = fun(s, 0)
lres = []
if len(little_res) == k:
    lres = little_res
else:
    exit()


little_res = invfun(s, n - 1)
rres = []
if len(little_res) == k:
    rres = little_res
else:
    exit()

inters = set(lres).intersection(rres)
for inter in inters:
    print(inter + 1)

Submission status: Wrong Answer

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

l = []
r = []

res = []

def fun(string, pos):
    counter = 0
    consec_counter = c+1
    res = []
    while pos < n:
        # print(pos)
        if counter == k:
            break
        if consec_counter >= c and string[pos] == 'o':
            counter += 1
            consec_counter = 0
            res.append(pos)
        else:
            consec_counter += 1
        pos += 1;
    # print(res)
    return res

def invfun(string, pos):
    counter = 0
    consec_counter = c+1
    res = []
    while pos >= 0:
        if counter == k:
            break
        # print(pos)
        if consec_counter >= c and string[pos] == 'o':
            counter += 1
            consec_counter = 0
            res.append(pos)
        else:
            consec_counter += 1
        pos -= 1;
    # print(res)
    return res


for i in range(n):
    little_res = fun(s, i)
    lres = []
    if len(little_res) == k:
        lres = little_res
        break

for i in range(n):
    little_res = invfun(s, n - i - 1)
    rres = []
    if len(little_res) == k:
        rres = little_res
        break

inters = set(lres).intersection(rres)
for inter in inters:
    print(inter + 1)

Submission status: Wrong Answer

Solution code:
from collections import deque
def main():
    N, K, C = map(int, input().split())
    S = input()
    l = [0] * N
    j = 0
    d = {}
    t = None
    for ii, v in enumerate(reversed(S)):
        i = N - ii
        if v == 'x':
            continue
        if t is None or t - C > i:
            j += 1
            d[j] = deque([i])
            t = i
        else:
            d[j].append(i)
    if j > K:
        return
    for i in d:
        if i < j:
            while True:
                t = d[i][-1]
                if t <= d[i+1][-1] + C:
                    d[i].pop()
                else:
                    break
        if i > 1:
            while True:
                t = d[i][0]
                if d[i-1][0] <= t + C:
                    d[i].popleft()
                else:
                    break
    r = []
    for i in d:
        if len(d[i]) == 1:
            r.append(d[i][0])
    r = sorted(list(set(r)))
    for i in r:
        print(i)
main()

Submission status: Wrong Answer

Solution code:
def main():
    N, K, C = map(int, input().split())
    S = input()
    l = [0] * N
    j = 0
    d = {}
    t = None
    for ii, v in enumerate(reversed(S)):
        i = N - ii
        if v == 'x':
            continue
        if t is None or t - C > i:
            j += 1
            d[j] = [i]
            t = i
        else:
            d[j].append(i)
    if j > K:
        return
    r = []
    for i in d:
        if len(d[i]) == 1:
            r.append(d[i][0])
        elif i == j:
            if d[i][-2] + C >= d[i-1][0]:
                r.append(d[i][-1])
        elif i == 1:
            if d[i][1] <= d[i+1][-1] + C:
                r.append(d[i][0])
        else:
            c = 0
            t = None
            for k in d[i]:
                if k + C < d[i-1][0] and d[i+1][-1] + C < k:
                    c += 1
                    t = k
            if c == 1:
                r.append(t)
    r = sorted(list(set(r)))
    for i in r:
        print(i)
main()

Submission status: Wrong Answer

Solution code:
def main():
    N, K, C = map(int, input().split())
    S = input()
    l = [0] * N
    j = 0
    d = {}
    t = None
    for ii, v in enumerate(reversed(S)):
        i = N - ii
        if v == 'x':
            continue
        if t is None or t - C > i:
            j += 1
            d[j] = [i]
            t = i
        else:
            d[j].append(i)
    if j > K:
        return
    r = []
    for i in d:
        if len(d[i]) == 1:
            r.append(d[i][0])
        elif i < j and d[i][1] <= d[i+1][-1] + C:
                r.append(d[i][0])
        elif i > 1 and d[i][-2] + C >= d[i-1][0]:
                r.append(d[i][-1])
    r = sorted(list(set(r)))
    for i in r:
        print(i)
main()

Submission status: Wrong Answer

Solution code:
def solve():
  N, K, C = map(int, input().split())
  workable = [i for i, s in enumerate(input(), 1) if s=="o"]
  if len(workable) == K:
    yield from workable
    
  latest = set()
  prev = workable[-1]+C+1
  for x in reversed(workable):
    if prev - x > C:
      latest.add(x)
      prev = x
  
  if len(latest) > K:
    return
  
  prev = -C-1
  for x in workable:
    if x - prev > C:
      if x in latest:
        yield x
      prev = x

print("\n".join(map(str, solve())))

Submission status: Wrong Answer

Solution code:
def main():
    N, K, C = map(int, input().split())
    S = input()
    l = [0] * N
    j = 0
    d = {}
    t = None
    for ii, v in enumerate(reversed(S)):
        i = N - ii
        if v == 'x':
            continue
        if t is None or t - C > i:
            j += 1
            d[j] = [i]
            t = i
        else:
            d[j].append(i)
    if j > K:
        return
    r = []
    for i in d:
        if len(d[i]) == 1:
            r.append(d[i][0])
        elif i < j and d[i][1] <= d[i+1][-1] + C:
                r.append(d[i][0])
    r.sort()
    for i in r:
        print(i)
main()

Submission status: Wrong Answer

Solution code:
def solve():
  N, K, C = map(int, input().split())
  workable = [i for i, s in enumerate(input()) if s=="o"]
  if len(workable) == K:
    return workable
    
  latest = set()
  prev = workable[-1]+C+1
  for x in reversed(workable):
    if prev - x > C:
      latest.add(x)
      prev = x
      if len(latest) > K:
        return []
  must = []
  prev = -C-1
  for x in workable:
    if x - prev > C:
      if x in latest:
        must.append(x+1)
      prev = x
  return must

print("\n".join(map(str, solve())))

Submission status: Wrong Answer

Solution code:
def solve():
  N, K, C = map(int, input().split())
  workable = [i for i, s in enumerate(input()) if s=="o"]
  if len(workable) == K:
    return workable
    
  latest = set()
  prev = workable[-1]+C+1
  for x in reversed(workable):
    if prev - x > C:
      latest.add(x)
      prev = x
      if len(latest) > K:
        return []
  must = []
  prev = -C-1
  for x in workable:
    if x - prev > C:
      if x in latest:
        must.append(x)
      prev = x
  return must

print("\n".join(map(str, solve())))

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
import sys
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permutations
from operator import add, mul, sub

sys.setrecursionlimit(1000000)
input = sys.stdin.readline
INF = 2**62-1

def read_int():
    return int(input())


def read_int_n():
    return list(map(int, input().split()))


def read_float():
    return float(input())


def read_float_n():
    return list(map(float, input().split()))


def read_str():
    return input().strip()


def read_str_n():
    return list(map(str, input().split()))


def error_print(*args):
    print(*args, file=sys.stderr)


def mt(f):
    import time

    def wrap(*args, **kwargs):
        s = time.time()
        ret = f(*args, **kwargs)
        e = time.time()

        error_print(e - s, 'sec')
        return ret

    return wrap


@mt
def slv(N, K, C, S):
    def f(S):
        r = 0
        w = []
        c = 0
        for s in S:
            if c == K:
                w.append(0)
            elif r == 0 and s == 'o':
                w.append(1)
                r = C
                c += 1
            else:
                w.append(0)
                r = max(0, r-1)

        return w
    lw = f(S)
    rw = list(reversed(f(reversed(S))))
    if sum(lw) != K:
        return
    for i, (l, r) in enumerate(zip(lw, rw)):
        if l == r == 1:
            print(i+1)


def main():
    N, K, C = read_int_n()
    S = read_str()
    (slv(N, K, C, S))


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
import sys
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permutations
from operator import add, mul, sub

sys.setrecursionlimit(1000000)
input = sys.stdin.readline
INF = 2**62-1

def read_int():
    return int(input())


def read_int_n():
    return list(map(int, input().split()))


def read_float():
    return float(input())


def read_float_n():
    return list(map(float, input().split()))


def read_str():
    return input().strip()


def read_str_n():
    return list(map(str, input().split()))


def error_print(*args):
    print(*args, file=sys.stderr)


def mt(f):
    import time

    def wrap(*args, **kwargs):
        s = time.time()
        ret = f(*args, **kwargs)
        e = time.time()

        error_print(e - s, 'sec')
        return ret

    return wrap


@mt
def slv(N, K, C, S):
    def f(S):
        r = 0
        w = []
        c = 0
        for s in S:
            if c == K:
                w.append(0)
            elif r == 0 and s == 'o':
                w.append(1)
                r = C
                c += 1
            else:
                w.append(0)
                r = max(0, r-1)

        return w
    lw = f(S)
    rw = list(reversed(f(reversed(S))))
    for i, (l, r) in enumerate(zip(lw, rw)):
        if l == r == 1:
            print(i+1)


def main():
    N, K, C = read_int_n()
    S = read_str()
    (slv(N, K, C, S))


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
import itertools
nkc=input().split()
K=int(nkc[1])
C=int(nkc[2])
s=input()
workday_list=[]
for i,youso in enumerate(s) :
  if youso=='o' :
    workday_list.append(i+1)
    
work_candidate=itertools.combinations(workday_list,K)
work_candidate1=[]
for item_list in work_candidate:
  flag=True
  for i in range(len(item_list)-1) :
    if abs(item_list[i]-item_list[i+1])<=C :
      flag=False
      break
  if flag==True :
  	work_candidate1.append(item_list)
list1=set(work_candidate1[0])
 
print(work_candidate1)

Submission status: Wrong Answer

Solution code:
N, K, C = map(int, input().split())
S = input().strip()
dp1 = [0]*(N+2)
dp2 = [0]*(N+2)
c = 10*18
cc = 0
for i in range(N):
    if S[i] == "o" and c >= C:
        cc += 1
        c = 0
    else:
        c += 1
    dp1[i+1] = cc
c = 10*18
cc = 0
for i in range(N-1, -1, -1):
    if S[i] == "o" and c >= C:
        cc += 1
        c = 0
    else:
        c += 1
    dp2[i+1] = cc
rs = []
for i in range(N):
    if S[i] == "o" and dp1[i] + dp2[i+2] == K-1 and dp1[i+1] + dp2[i+2] == K:
        rs.append(i+1)

#print(dp1, dp2)
for r in rs:
    print(r)

Submission status: Wrong Answer

Solution code:
N, K, C = map(int, input().split())
S = input().strip()
dp1 = [0]*(N+2)
dp2 = [0]*(N+2)
c = 10*18
cc = 0
for i in range(N):
    if S[i] == "o" and c >= C:
        cc += 1
        c = 0
    else:
        c += 1
    dp1[i+1] = cc
c = 10*18
cc = 0
for i in range(N-1, -1, -1):
    if S[i] == "o" and c >= C:
        cc += 1
        c = 0
    else:
        c += 1
    dp2[i+1] = cc
rs = []
for i in range(N):
    if S[i] == "o" and dp1[i] + dp2[i+2] == K-1:
        rs.append(i+1)

#print(dp1, dp2)
for r in rs:
    print(r)

Submission status: Wrong Answer

Solution code:
N, K, C = map(int, input().split())
S = input().strip()
dp1 = [0]*(N+2)
dp2 = [0]*(N+2)
c = 10*18
cc = 0
for i in range(N):
    if S[i] == "o" and c >= C:
        cc += 1
        c = 0
    else:
        c += 1
    dp1[i+1] = cc
c = 10*18
cc = 0
for i in range(N-1, -1, -1):
    if S[i] == "o" and c >= C:
        cc += 1
        c = 0
    else:
        c += 1
    dp2[i+1] = cc
rs = []
for i in range(N):
    if dp1[i] + dp2[i+2] == K-1:
        rs.append(i+1)

for r in rs:
    print(r)

Submission status: Wrong Answer

Solution code:
N,K,C= map(int, input().split())
S=input()
A=[]
for i in range(N):
  if S[i]=='o':
    A.append(i)
M=[]
d=0
for i in A:
  if d<=i:
    M.append(i)
    d=i+C+1
  if len(M)==K:
    break

U=[]
d=N-1
for i in A[::-1]:
  if i<=d:
    U.append(i)
    d=i-C-1
  if len(U)==K:
    break
    
D=set(M)&set(U)
D=sorted(D)
for i in D:
  print(i+1)

Submission status: Wrong Answer

Solution code:
N,K,C= map(int, input().split())
S=input()
A=[]
for i in range(N):
  if S[i]=='o':
    A.append(i)
M=[]
d=0
for i in A:
  if d<=i:
    M.append(i)
    d=i+C+1
  if len(M)==K:
    break

U=[]
d=N
for i in A[::-1]:
  if i<=d:
    U.append(i)
    d=i-C-1
  if len(U)==K:
    break
    
D=set(M)&set(U)
D=sorted(D)
for i in D:
  print(i+1)

Submission status: Wrong Answer

Solution code:
n,k,c=map(int,input().split())
s=input()
l=[0]*k
r=[0]*k
ld=0
rd=n-1
for i in range(k):
  j=k-1-i
  while s[ld]=='x':
    ld+=1
  while s[rd]=='x':
    rd-=1
  l[i]=ld
  ld=1+c
  r[j]=rd
  rd-=1+c
for i in range(k):
  if l[i]==r[i]:
    print(l[i]+1)

Submission status: Wrong Answer

Solution code:
#!python3

iim = lambda: map(int, input().rstrip().split())
from collections import defaultdict

def resolve():
    N, K, C = iim()
    S = input()

    C1 = C + 1
    i, ax = N-1, set()
    while i >= 0:
        if S[i] != "o":
            i -= 1
        else:
            ax.add(i)
            i -= C1
            if len(ax) == K:
                break

    #print(N, K, C, S)
    #print(ax)
    ans, ri, cnt, i  = [], len(ax)-1, 0, 0
    while i < N:
        if S[i] != "o":
            i += 1
        else:
            #print(i, ri, ax[ri])
            if i in ax:
                ans.append(i+1)
            i += C1
            cnt += 1
            if cnt == K:
                break
    print(*ans, sep="\n")

if __name__ == "__main__":
    resolve()