Problem:


Score : 200 points

Problem Statement

There are N participants in the CODE FESTIVAL 2016 Qualification contests. The participants are either students in Japan, students from overseas, or neither of these.

Only Japanese students or overseas students can pass the Qualification contests. The students pass when they satisfy the conditions listed below, from the top rank down. Participants who are not students cannot pass the Qualification contests.

A Japanese student passes the Qualification contests if the number of the participants who have already definitively passed is currently fewer than A+B.

An overseas student passes the Qualification contests if the number of the participants who have already definitively passed is currently fewer than A+B and the student ranks B-th or above among all overseas students.

A string S is assigned indicating attributes of all participants. If the i-th character of string S is a, this means the participant ranked i-th in the Qualification contests is a Japanese student; b means the participant ranked i-th is an overseas student; and c means the participant ranked i-th is neither of these.

Write a program that outputs for all the participants in descending rank either Yes if they passed the Qualification contests or No if they did not pass.

Constraints

1≦N,A,B≦100000

A+B≦N

S is N characters long.

S consists only of the letters a, b and c.

Input

Inputs are provided from Standard Input in the following form.

N A B
S

Output

Output N lines. On the i-th line, output Yes if the i-th participant passed the Qualification contests or No if that participant did not pass.

Sample Input 1

10 2 3
abccabaabb

Sample Output 1

Yes
Yes
No
No
Yes
Yes
Yes
No
No
No

The first, second, fifth, sixth, and seventh participants pass the Qualification contests.

Sample Input 2

12 5 2
cabbabaacaba

Sample Output 2

No
Yes
Yes
Yes
Yes
No
Yes
Yes
No
Yes
No
No

The sixth participant is third among overseas students and thus does not pass the Qualification contests.

Sample Input 3

5 2 2
ccccc

Sample Output 3

No
No
No
No
No



Sample input:
10 2 3
abccabaabb


Sample output:
Yes
Yes
No
No
Yes
Yes
Yes
No
No
No

Submission status: Wrong Answer

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

A_sum = 0
B_sum = 0

for i in S:
        if i == 'a':
                if A_sum + B_sum < A + B:
                        A_sum += 1
                        print('YES')
                else:
                        print('NO')
        elif i == 'b':
                if A_sum + B_sum < A + B and B_sum < B:
                        B_sum += 1
                        print('YES')
                else:
                        print('NO')
        else:
                print('NO')

Submission status: Wrong Answer

Solution code:
inputs = input().split()

N = int(inputs[0]) # number of participants
A = int(inputs[1])
B = int(inputs[2])

S = input()

# a = Japanese student
# b = overseas student
# c = other (not eligible)


num_passes = 0
num_jap_students = 0
num_overseas_students = 0

for rank in range(N):
    curr = S[rank]
    if curr == 'c':
        print('No')
        continue
    if curr == 'a':
        if num_passes < A + B:
            print('Yes')
            num_passes += 1
        else:
            print('No')
        num_jap_students += 1
    elif curr == 'b':
        
        if num_passes < A + B and rank - num_jap_students <= B:
            print('Yes')
            num_passes += 1
        else:
            print('No')
        num_overseas_students += 1

Submission status: Wrong Answer

Solution code:
n, a, b = map(int ,raw_input().split())
s = raw_input()

kaigai = 0
for i in range(len(s)):
    if s[i] == 'a':
        if i <= a+b:
            print "Yes"
        else:
            print "No"
    elif s[i] == 'b':
        kaigai+= 1
        if i <= a+b and kaigai<=b:
            print "Yes"
        else:
            print "No"
    else:
        print "No"

Submission status: Wrong Answer

Solution code:
N, A, B = map(int, input().split())
S = input()
passed = []

for i in range(N):
  if S[i] == 'c':
    print('No')
  elif S[i] == 'a':
    if len(passed) <= A+B:
      print('Yes')
      passed.append('a')
    else: print('No')
  else:
    if len(passed) <= A+B and passed.count('b') <= B:
      print('Yes')
      passed.append('b')
    else: print('No')

Submission status: Wrong Answer

Solution code:
n, a, b = map(int, raw_input().split())
s = raw_input()
ac = 0
bc = 0
for v in s:
    if v == 'a' and ac + bc < a + b:
        ac += 1
        print "YES"
    elif v == 'b' and ac + bc < a + b and bc < b:
        bc += 1
        print "YES"
    else:
        print "NO"

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
# !/usr/bin/env python
# vim: set fileencoding=utf-8 :

"""
#
# Author:   Noname
# URL:      https://github.com/pettan0818
# License:  MIT License
# Created:  2016-10-10
#

# Usage
#
"""

def read_value():
    first_line = input()
    status = first_line.split(" ")

    num_of_contestant = int(status[0])
    basis = int(status[1])
    oversea_limit = int(status[2])

    second_line = input()
    rank_str = second_line

    return [num_of_contestant, basis, oversea_limit, rank_str]


def check_japan(rank, basis, oversea_limit):
    if rank < basis + oversea_limit:
        return "Yes"
    else:
        return "No"

def check_overseas(rank, oversea_rank, basis, oversea_limit):
    if rank < basis + oversea_limit and oversea_rank < oversea_limit:
        return "Yes"
    else:
        return "No"


if __name__ == "__main__":
    input_items = read_value()

    basis = input_items[1]
    oversea_limit = input_items[2]
    rank_str = input_items[3]

    oversea_rank = 0

    for rank, type in enumerate(rank_str):
        if type == "a":
            print(check_japan(rank, basis, oversea_limit))

        if type == "b":
            oversea_rank += 1
            print(check_overseas(rank, oversea_rank, basis, oversea_limit))

        if type == "c":
            print("No")

Submission status: Wrong Answer

Solution code:
data=map(int,raw_input().split())
l=raw_input()
rank=0
for i in range(len(l)):
    if(l[i]=="a" and i<data[1]+data[2]):
        print "Yes"
    elif(l[i]=="b" and i<data[1]+data[2] and rank<data[2]):
        print "Yes"
        data[2]+=1
    else:
        print "No"

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python
# encoding: utf-8

N, A, B = map(int, raw_input().split())

s = raw_input()

over = 0
cnt = 0
for i in xrange(N):
    if s[i] == 'c':
        print 'No'
    elif s[i] == 'a':
        if cnt < A + B:
            print 'Yes'
            cnt += 1
        else:
            print 'No'
    else:
        over += 1
        if i <= A + B and over <= B:
            print 'Yes'
            cnt += 1
        else:
            print 'No'

Submission status: Wrong Answer

Solution code:
I = [int(e) for e in raw_input().split(' ')]
N = I[0]
A = I[1]
B = I[2]
S = raw_input()

a = 0
b = 0
for i in range(N):
    if S[i] == 'a':
        if a+b < A+B:
            print 'Yes'
        else:
            print 'No'
        a+=1
    elif S[i] == 'b':
        if a+b < A+B and b < B:
            print 'Yes'
        else:
            print 'No'
        b+=1
    else:
        print 'No'

Submission status: Wrong Answer

Solution code:
n, a, b = map(int, raw_input().split())
s = raw_input()

bs = 0
passed = 0
for i in range(len(s)):
	if s[i] == 'a':
		print 'Yes' if passed < a+b else 'No'
		passed += 1
	if s[i] == 'b':
		print 'Yes' if passed < a+b and bs < b else 'No'
		bs += 1
		passed += 1
	if s[i] == 'c':
		print 'No'

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python
# encoding: utf-8

N, A, B = map(int, raw_input().split())

s = raw_input()

over = 0
cnt = 0
for i in xrange(N):
    if s[i] == 'c':
        print 'No'
    elif s[i] == 'a':
        if cnt < A + B:
            print 'Yes'
            cnt += 1
        else:
            print 'No'
    else:
        if i <= A + B and over < B:
            print 'Yes'
            over += 1
            cnt += 1
        else:
            print 'No'

Submission status: Wrong Answer

Solution code:
n,a,b = map(int,raw_input().split())
s = raw_input()

aa = 0
bb = 0
ans = []
for i in range(len(s)):
  if s[i] != "c":
    if s[i] == "a":
      if aa+bb < a+b:
        aa += 1
        ans.append("Yes")
      else:
        ans.append("No")

    if s[i] == "b":
      if aa+bb < a+b and bb < b:
        bb += 1
        ans.append("Yes")
      else:
        ans.append("No")
  else:
    ans.append("No")
for i in ans:
  print ans

Submission status: Wrong Answer

Solution code:
N,A,B=map(int,raw_input().split())
S = raw_input()
for cha	in S:
    if cha == 'a' and (A+B) > 0:
	A = A-1
	print 'Yes'
        pass
    elif cha == 'b' and B > 0:
        B = B-1
	print 'Yes'
        pass
    elif cha == 'c':
	print 'No'
        pass
    else:
	print 'No'
        pass

Submission status: Wrong Answer

Solution code:
n,a,b=map(int,raw_input().split())
s=raw_input()
for i in xrange(len(s)):
    if s[i]=="a":
        if i>a+b:
            print('No')
        else:
            print('Yes')
    elif s[i]=="b":
        if i>b:
            print('No')
        else:
            print('Yes')
    else:
        print('No')

Submission status: Wrong Answer

Solution code:
N, A, B = map(int, raw_input().split())
a, b = 0, 0
for s in raw_input():
    if s == 'a' and a+b < A+B:
        print 'YES'
        a += 1
    elif s == 'b' and a+b < A+B and b < B:
        print 'YES'
        b += 1
    else:
        print 'NO'

Submission status: Time Limit Exceeded

Solution code:
N,A,B=list(map(int,input().split()))
S=list(input())
t=0
for i in range(N):
 if S[i]=='a':
     if t<A+B:
         t=t+1
         print("Yes")
     else:
         print("No")
 elif S[i]=='b':
     if t<A+B and B>S[:i].count('b'):
         t=t+1
         print('Yes')
     else:
         print('No')
 else:
     print('No')

Submission status: Time Limit Exceeded

Solution code:
n,a,b=map(int, input().split())
s=list(input())
num=0
qual=[]
s_b=[i for i,x in enumerate(s) if x=='b']
for i in range(n):
  if num<a+b:
    if s[i]=='c':
      qual.append('No')
    elif s[i]=='a':
      num+=1
      qual.append('Yes')     
    else:
      if s_b.index(i)<b:
        num+=1
        qual.append('Yes')
      else:
        qual.append('No')   
  else:
    qual.append('No')
for j in range(n):
  print(qual[j])

Submission status: Time Limit Exceeded

Solution code:
n,a,b=map(int, input().split())
s=list(input())
num=0
s_b=[i for i,x in enumerate(s) if x=='b']
for i in range(n):
  if num<a+b:
    if s[i]=='c':
      print('No')
    elif s[i]=='a':
      num+=1
      print('Yes')     
    else:
      if s_b.index(i)<b:
        num+=1
        print('Yes')
      else:
        print('No')   
  else:
    print('No')

Submission status: Time Limit Exceeded

Solution code:
def simulator(n, a, b, s):
    print()
    boolean_list = ['No'] * n
    count = 0
    for i in range(n):
        if s[i]=='a' and count < a+b:
            count += 1
            boolean_list[i] = 'Yes'
        if s[i]=='b' and count < a+b and s[:i].count('b') <b :
            count += 1
            boolean_list[i] = 'Yes'
    
    for _ in boolean_list:
        print(_)

n, a, b = map(int,input().split())
s = input()
simulator(n, a, b, s)

Submission status: Time Limit Exceeded

Solution code:
n,a,b=map(int,input().split())
s=input()
passed=0
oversea=[]
yep=False
cnt=0
for i in range(n):
    if s[i]=="b":
        oversea.append(i)
for i in range(n):
    if s[i]=="c":
        print("No")
    elif s[i]=="a":
        if passed<(a+b):
            print("Yes")
            passed+=1
        else:
            print("No")
    else:
        if oversea.index(i)<b and passed<(a+b):
            print("Yes")
            passed+=1
        else:
            print("No")
    if passed>=(a+b):
        yep=True
        cnt=len(s)-(i+1)
        break
if yep:
    for i in range(cnt):
        print("No")

Submission status: Time Limit Exceeded

Solution code:
n,a,b=map(int,input().split())
s=input()
passed=0
oversea=[]
for i in range(n):
    if s[i]=="b":
        oversea.append(i)
for i in range(n):
    if s[i]=="c":
        print("No")
    elif s[i]=="a":
        if passed<(a+b):
            print("Yes")
            passed+=1
        else:
            print("No")
    else:
        if oversea.index(i)<b and passed<(a+b):
            print("Yes")
            passed+=1
        else:
            print("No")

Submission status: Time Limit Exceeded

Solution code:
def main():
    quantity, A, B = map(int, input().split())
    l = list(input())
    ans = []
    
    for i in range(quantity):
        if l[i] == 'a' and ans.count('Yes') < (A + B):
            ans.append('Yes')
            continue
        elif l[i] == 'b' and ans.count('Yes') < (A + B):
            check = 0
            for x in range(len(ans)):
                if ans[x] == 'Yes':
                    check = check + 1
            if check <= B:
                ans.append('Yes')
                continue
        ans.append('No')
    
    for y in ans:
        print(y)

main()

Submission status: Time Limit Exceeded

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

answer = [0] * len(S)
b_list = []
for idx, moji in enumerate(S):
    if moji == "a" and sum(answer) < A + B:
        answer[idx] = 1
        print("Yes")
        continue
    elif moji == "b":
        b_list.append(1)
        if sum(answer) < A + B and sum(b_list) <= B:
            answer[idx] = 1
            print("Yes")
            continue
    print("No")

Submission status: Time Limit Exceeded

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

answer = [0] * len(S)
b_list = []
for idx, moji in enumerate(S):
    if moji == "a" and sum(answer) < A + B:
        answer[idx] = 1
    elif moji == "b":
        b_list.append(1)
        if sum(answer) < A + B and sum(b_list) <= B:
            answer[idx] = 1
    elif moji == "c":
        pass
    else:
        pass
for result in answer:
    if result == 1:
        print("Yes")
    elif result == 0:
        print("No")

Submission status: Time Limit Exceeded

Solution code:
import sys

n, a, b = map(int, input().split())
s = input()

#合格人数
clear = 0

flag = [False, False]

ans = []

for i, x in enumerate(s):

  if flag.count(True) == 2:
    print('\n'.join(ans))
    print('\n'.join(['No']*(n-i)))
    sys.exit()
  
  #a,bそれぞれの合格人数
  cnta = s[:i+1].count('a')
  cntb = s[:i+1].count('b')
  
  #a, b, cそれぞれで場合分けして判定
  if x == 'a':
    if clear < a + b:
      ans.append('Yes')
      clear += 1
    else:
      ans.append('No')
      flag[0] = True
  
  elif x == 'b':
    if cntb <= b and clear < (a + b):
      ans.append('Yes')
      clear += 1
    else:
      ans.append('No')
      flag[1] = True
      
  else:
    ans.append('No')
                 
print('\n'.join(ans))

Submission status: Time Limit Exceeded

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

#合格人数
clear = 0

flag = [False, False]

for i, x in enumerate(s):

  if flag.count(True) == 2:
    print('\n'.join(['No']*(n-i)))
    break
  
  #a,bそれぞれの合格人数
  cnta = s[:i+1].count('a')
  cntb = s[:i+1].count('b')
  
  #a, b, cそれぞれで場合分けして判定
  if x == 'a':
    if clear < a + b:
      print('Yes')
      clear += 1
    else:
      print('No')
      flag[0] = True
  
  elif x == 'b':
    if cntb <= b and clear < (a + b):
      print('Yes')
      clear += 1
    else:
      print('No')
      flag[1] = True
      
  else:
    print('No')

Submission status: Time Limit Exceeded

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

#合格人数
clear = 0

for i, x in enumerate(s):

  #a,bそれぞれの合格人数
  cnta = s[:i+1].count('a')
  cntb = s[:i+1].count('b')
  
  #a, b, cそれぞれで場合分けして判定
  if x == 'a':
    if clear < a + b:
      print('Yes')
      clear += 1
    else:
      print('No')
  
  elif x == 'b':
    if cntb <= b and clear < (a + b):
      print('Yes')
      clear += 1
    else:
      print('No')
      
  else:
    print('No')

Submission status: Time Limit Exceeded

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

ans = ["No"] * n
foreigner = 0

for i in range(n):
    if s[i] == "a":
        ans[i] = "Yes"
    elif s[i] == "b" and foreigner < b:
        ans[i] = "Yes"
        foreigner += 1
    if ans.count("Yes") == a + b:
        break

for i in ans:
    print(i)

Submission status: Time Limit Exceeded

Solution code:
n,a,b=map(int,input().split())
s=input()
ans=list('No'for _ in range(n))
c=a+b
for i in range(n):
    if ans[:i].count('Yes')<c:
        if s[i]=='a':
            ans[i]='Yes'
        if s[i]=='b' and s[:i].count('b')<b:
            ans[i]='Yes'
            
            

print(*ans,sep='\n')

Submission status: Time Limit Exceeded

Solution code:
n,a,b=map(int,input().split())
s=list(input())
ans=list('No' for _ in range(n))
c=a+b
for i in range(n):
    if  ans[:i].count('Yes')<c:
        if s[i]=='a':
            ans[i]='Yes'
        
        if s[i]=='b' and s[:i+1].count('b')<=b:
            ans[i]='Yes'
print('\n'.join(ans))

Submission status: Time Limit Exceeded

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

# a: 国内の学生
# b: 海外の学生
# c: その他
# i番idxはi位

# # 海外の学生
# foregin_list = []
# for i, c in enumerate(s):
#     if c == "b":
#         foregin_list.append(i)


passes_num = 0
foregin_list = []
thredshould = a + b
for i, c in enumerate(s):
    if c == "c":
        print("No")
    elif c == "a":
        if passes_num < thredshould:
            passes_num += 1
            print("Yes")
        else:
            print("No")
    else:
        foregin_list.append(i)
        if passes_num < thredshould and foregin_list.index(i) + 1 <= b:
            passes_num += 1
            print("Yes")
        else:
            print("No")

Submission status: Time Limit Exceeded

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

# a: 国内の学生
# b: 海外の学生
# c: その他
# i番idxはi位

# 海外の学生
foregin_list = []
for i, c in enumerate(s):
    if c == "b":
        foregin_list.append(i)


passes_num = 0
for i, c in enumerate(s):
    if c == "c":
        print("No")
    elif c == "a":
        if passes_num < a + b:
            passes_num += 1
            print("Yes")
        else:
            print("No")
    else:
        if passes_num < a + b and foregin_list.index(i) + 1 <= b:
            passes_num += 1
            print("Yes")
        else:
            print("No")

Submission status: Time Limit Exceeded

Solution code:
import re
N,A,B = map(int,input().split())
S = input()
motoplayers = []
cnt = 0
for i in S:
    motoplayers.append(i + str(cnt))
    cnt+=1
players = [i for i in motoplayers if not "c" in i]

kaigai = [i for i in players if "b" in i]
del kaigai[B:]
tuukaninzuu = 0
for i in range(N):
    if motoplayers[i] in players:
        if tuukaninzuu < A+B:
            if "b" in motoplayers[i]:
                if motoplayers[i] in kaigai:
                    print("Yes")
                    tuukaninzuu+=1
                    continue
                else:
                    print("No")
                    continue
            else:
                print("Yes")
                tuukaninzuu+=1
                continue
        else:
            print("No")
            continue
    else:
        print("No")
        continue

Submission status: Time Limit Exceeded

Solution code:
n,A,B = map(int,input().split())
s = list(str(input()))
p =[]
for i in range(0,n):
  if s[i] =="c":
    print("No")
  elif s[i]=="a":
    if A+B>len(p):
      p.append(s[i])
      print("Yes")
    else:
      print("No")
  elif s[i] =="b":
    if A+B>len(p) and p.count("b")<B:
      p.append(s[i])
      print("Yes")
    else:
      print("No")

Submission status: Time Limit Exceeded

Solution code:
n,A,B = map(int,input().split())
s = list(str(input()))
p =[]
for i in range(0,n):
  if s[i] =="a":
    if A+B>len(p):
      p.append(s[i])
      print("Yes")
    else:
      print("No")
  elif s[i] =="b":
    if A+B>len(p) and p.count("b")<B:
      p.append(s[i])
      print("Yes")
    else:
      print("No")
  else:
    print("No")

Submission status: Time Limit Exceeded

Solution code:
N, A, B = map(int, input().split())
S = input()
T = []
Answer = []

for i in range(N):
  if S[i] == "a":
    if A + B > Answer.count("Yes"):
      Answer.append("Yes")
    else:
      Answer.append("No")
  elif S[i] == "b":
    if A + B > Answer.count("Yes") and B > T.count("Yes"):
      Answer.append("Yes")
      T.append("Yes")
    else:
      Answer.append("No")
  else:
    Answer.append("No")
  print(Answer[i])

Submission status: Time Limit Exceeded

Solution code:
N, A, B = map(int, input().split())
s = str(input())

passed = []

for i in range(N):
  if s[i] == "a" and len(passed) < A + B:
    passed.append(s[i])
    print("Yes")
  elif s[i] == "b" and len(passed) < A + B and passed.count("b") < B:
    passed.append(s[i])
    print("Yes")
  else:
    print("No")

Submission status: Time Limit Exceeded

Solution code:
N, A, B = map(int, input().split())
s = str(input())

passed = []

for i in range(N):
  if s[i] == "c":
    print("No")
  elif s[i] == "a" and len(passed) < A + B:
    passed.append(s[i])
    print("Yes")
  elif s[i] == "b" and len(passed) < A + B and passed.count("b") < B:
    passed.append(s[i])
    print("Yes")
  else:
    print("No")

Submission status: Time Limit Exceeded

Solution code:
n,a,b = map(int,input().split())
s = input()
ans = ["0"]*n
bcnt = 0
for i in range(n):
  if s[i] == "a":
    if ans.count("Yes") < a+b:
      ans[i] = "Yes"
    else:
      ans[i] = "No"
  elif s[i] == "b":
    bcnt += 1
    if ans.count("Yes") < a+b and bcnt <= b:
      ans[i] = "Yes"
    else:
      ans[i] = "No"
  else:
    ans[i] = "No"
print(*ans,sep='\n')

Submission status: Time Limit Exceeded

Solution code:
import sys

sys.setrecursionlimit(10 ** 5 + 10)


def input(): return sys.stdin.readline().strip()


def resolve():
    N, a, b = map(int, input().split())
    S = str(input())
    A, B = [0] * N, [0] * N
    for i in range(N):
        if S[i] == 'a':
            A[i] = 1
        elif S[i] == 'b':
            B[i] = 1
    from itertools import accumulate

    AA = [0] + A
    AA = list(accumulate(AA))  # 累積和を格納したリスト作成
    BB = [0] + B
    BB = list(accumulate(BB))  # 累積和を格納したリスト作成

    for i in range(N):
        if S[i] == 'a':
            if AA[i + 1] + BB[i + 1] - 1 < a + b:
                print('Yes')
            else:
                print('No')
                for j in range(i + 1, N + 1):
                    AA[j] -= 1
        elif S[i] == 'b':
            if AA[i + 1] + BB[i + 1] - 1 < a + b and BB[i + 1] - 1 < b:
                print('Yes')
            else:
                print('No')
                for j in range(i + 1, N + 1):
                    BB[j] -= 1

        else:
            print('No')


resolve()

Submission status: Time Limit Exceeded

Solution code:
N,A,B=map(int,input().split())
S=list(input())
ans=[]
for i in S:
    if i=='a':
        if ans.count('Yes')<A+B:
            ans.append('Yes')
        else:
            ans.append('No')
    elif i=='b':
        if ans.count('Yes')<A+B and S[0:len(ans)].count('b')<B:
            ans.append('Yes')
        else:
            ans.append('No')
    else:
        ans.append('No')

print('\n'.join(ans))

Submission status: Time Limit Exceeded

Solution code:
# coding: utf-8
# Your code here!
n,a,b=map(int,input().split())
s=list(input())
t=[]
count=1
for i in range(n):
    if s[i]=='a':
        if count<=a+b:
            count+=1
            print('Yes')
        else:
            print('No')
    elif s[i]=='b':
        t.append(s[i])
        if count<=a+b and t.count('b')<=b:
            count+=1
            print('Yes')
        else:
            print('No')
    else:
        print('No')

Submission status: Time Limit Exceeded

Solution code:
import sys
input=sys.stdin.readline
n,a,b=map(int,input().split())
s=input()
ok=0
x=0
ans=""
for i in range(n):
    ss=s[i]
    if ss=="a" and ok<a+b:
        ok+=1
        ans+="Yes\n"
    elif ss=="b" and ok<a+b and x<b:
        ok+=1
        x+=1
        ans+="Yes\n"
    else:
        ans+="No\n"

print(ans[:-1])

Submission status: Time Limit Exceeded

Solution code:
n,a,b=map(int,input().split())
s=input()
ok=0
x=0
ans=""
for i in range(n):
    if s[i]=="a" and ok<a+b:
        ok+=1
        ans+="Yes\n"
    elif s[i]=="b" and ok<a+b and x<b:
        ok+=1
        x+=1
        ans+="Yes\n"
    else:
        ans+="No\n"

print(ans[:-1])

Submission status: Time Limit Exceeded

Solution code:
N, A, B = map(int, input().split())
S = input()
passed = []

for i in range(N):
  if S[i] == 'c':
    print('No')
  elif S[i] == 'a':
    if len(passed) < A+B:
      print('Yes')
      passed.append('a')
    else: print('No')
  else:
    if len(passed) < A+B and passed.count('b') < B:
      print('Yes')
      passed.append('b')
    else: print('No')

Submission status: Time Limit Exceeded

Solution code:
# -*- coding: utf-8 -*-
count = 0

N, A, B = [int(i) for i in raw_input().split()]
S = raw_input()

for i in range(len(S)):
    if count < A + B:
        if S[i] == 'a' or (S[i] == 'b' and S[:i].count('b') < B):
            print 'Yes'
            count += 1
        else:
            print 'No'
    else:
        print 'No'

Submission status: Time Limit Exceeded

Solution code:
n,a,b=map(int,input().split())
s=input()
Pass=[]
out=1
for i in range(n):
    if s[i]=="a" and len(Pass)+1<=a+b:
            Pass.append(i)
    if s[i]=="b" and len(Pass)+1<=a+b and out<=b:
            Pass.append(i)
            out+=1
for i in range(n):
    print("Yes" if i in Pass else "No")

Submission status: Accepted

Solution code:
N,A,B = map(int, input().split())
S = ["*"]+list(input())

finalist = 0
foreigner_student_finalist = 0

for i in range(1,N+1):
    if S[i] == "a":
        if finalist < A+B:
            print("Yes")
            finalist += 1
        else:
            print("No")
    elif S[i] == "b":
        if finalist < A+B and foreigner_student_finalist < B:
            print("Yes")
            finalist += 1
            foreigner_student_finalist += 1
        else:
            print("No")
    else:
        print("No")

Submission status: Accepted

Solution code:
N, A, B = map(int, input().split())
S = input()

capacity = A+B
rank = 1
for i in range(N):
    if 'a' == S[i] and 0 < capacity:
        print('Yes')
        capacity -= 1
    elif 'b' == S[i] and 0 < capacity and rank <= B:
        print('Yes')
        capacity -= 1
        rank += 1
    else:
        print('No')

Submission status: Accepted

Solution code:
import sys
# sys.setrecursionlimit(100000)


def input():
    return sys.stdin.readline().strip()


def input_int():
    return int(input())


def input_int_list():
    return [int(i) for i in input().split()]


def main():
    n, a, b = input_int_list()
    S = input()
    passed = 0
    oversea = 0
    for s in S:
        if s == "a" and passed < a + b:
            passed += 1
            print("Yes")
        elif s == "b" and passed < a + b and oversea < b:
            oversea += 1
            passed += 1
            print("Yes")
        else:
            print("No")


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
N, A, B = map(int, input().split())
S = input()
participants = 0
i = 1
for s in S:
    if s == 'c':
        print('No')
        continue
    elif s == 'a':
        if participants < A+B:
            print('Yes')
            participants += 1
        else:
            print('No')
    elif s == 'b':
        if participants < A+B and i <= B:
            print('Yes')
            participants += 1
        else:
            print('No')
        i += 1

Submission status: Accepted

Solution code:
n,a,b = map(int,input().split())
s = input()
kokunai = 0
kaigai = 0

for i in range(n):
    if s[i] == "a" and a + b > kokunai + kaigai:
        print("Yes")
        kokunai += 1
    elif s[i] == "b" and a + b > kokunai + kaigai and b > kaigai:
        print("Yes")
        kaigai += 1
    else:
        print("No")

Submission status: Accepted

Solution code:
li = list(map(int,input().split()))
s=list(input())
N=li[0]
A=li[1]
B=li[2]
domPass=0
forePass=0
for x in s:
    if(x=='a'):
        if((domPass+forePass)<(A+B)):
            domPass=domPass+1
            print('Yes')
        else:
            print('No')
    elif(x=='b'):
        if(((domPass+forePass)<(A+B))and(forePass<B)):
            forePass=forePass+1
            print('Yes')
        else :
            print('No')
    elif(x=='c'):
        print('No')

Submission status: Accepted

Solution code:
n,a,b = map(int,input().split())
s = input()
count_a = 0
count_b = 0
for i in range(n):
  s1 = s[i]
  if s1 == "c":
    print("No")
  elif s1 == "b":
    if count_a + count_b < a+b and count_b < b:
      count_b += 1
      print("Yes")
    else:
      print("No")
  else:
    if count_a + count_b < a+b:
      count_a += 1
      print("Yes")
    else:
      print("No")

Submission status: Accepted

Solution code:
N,A,B=map(int,input().split())
s=str(input())
x = 0 #通過者数
y = 0
count = 0
for i in range(len(s)):
  if s[i] == 'a' and x+y < A+B:
    print('Yes')
    x += 1
  elif s[i] == 'b' and x+y < A+B and y < B:
    print('Yes')
    y += 1
  else:
      print('No')

Submission status: Accepted

Solution code:
def solve1(n, a, b, s):
    ans = ["No" for i in range(len(s))]

    #print("|     i|s[i]|     a|     b|ans[i]|")
    #print("----------------------------------")

    for i in range(len(s)):
        if s[i] == "a":
            if a > 0:
                ans[i] = "Yes"
                a -= 1
            elif b > 0:
                ans[i] = "Yes"
                b -= 1
        elif s[i] == "b":
            if b > 0:
                ans[i] = "Yes"
                b -= 1

        #print(f"|{i:6d}|{s[i]:4s}|{a:6d}|{b:6d}|{ans[i]:6s}|")

    return ans


n, a, b = map(int, input().split(" "))
s = input()

print("\n".join(solve1(n, a, b, s)))

Submission status: Accepted

Solution code:
n,a,b = list(map(int, input().split()))
s = input()
success = 0
success_b = 0
for S in s:
    if S == 'a' and success < a + b:
        print('Yes')
        success += 1
    elif S == 'b' and success < a + b and success_b < b:
        print('Yes')
        success += 1
        success_b += 1
    else:
        print('No')

Submission status: Accepted

Solution code:
N, A, B = map(int, input().split())
S = input()
a = 0
b = 0
for i in range(N):
  if S[i] == "a" and a + b < A + B:
    print("Yes")
    a += 1
  elif S[i] == "b" and a + b < A + B and b < B:
    print("Yes")
    b += 1
  else:
    print("No")

Submission status: Accepted

Solution code:
n,a,b=map(int,input().split())
s=input().strip()
njp=0
nop=0
for i in range(len(s)):
  if s[i]=='a':
    if njp<(a+b):
      njp+=1
      print('Yes')
    else:
      print('No')
  elif s[i]=='b':
    if njp<(a+b):
      if nop<b:
        nop+=1
        njp+=1
        print('Yes')
      else:
        print('No')
    else:
      print('No')
  else:
    print('No')

Submission status: Accepted

Solution code:
n,x,y=map(int,input().split())
s= input()
c=0
d=x+y
e = 0
f= False
for i in range(n):
    if s[i]=="a":
        if c<d:
            f=True
    elif s[i]=="b":
        if c<d and e<y:
            f=True
            e+=1
    if f:
        print("Yes")
        c+=1
    else:
        print("No")
    f=False

Submission status: Accepted

Solution code:
n,a,b =map(int,input().split())
s = input()
cnt = 0
p = 0
for i in range(n):
    if s[i] == 'a':
        if cnt <a+b:
            print('Yes')
            cnt +=1
        else:
            print('No')
    elif s[i] == 'b':
        p +=1
        if cnt <a+b and p <=b:
            print('Yes')
            cnt +=1
        else:
            print('No')
    else:
        print('No')