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: Accepted

Solution code:
N, A, B = map(int, input().split())
ans = []
a = 0
b = 0
c = 0
for i, s in enumerate(input()):
    if s == 'a':
        if a + b < A + B:
            ans.append('Yes')
            a += 1
        else:
            ans.append('No')
    if s == 'b':
        if a + b < A + B and c < B:
            ans.append('Yes')
            b += 1
        else:
            ans.append('No')
        c += 1
    if s == 'c':
        ans.append('No')

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

Submission status: Accepted

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

p = 0
b = 0
for c in S:
  if c == 'a':
    if p < A+B:
      p += 1
      print('Yes')
    else:
      print('No')
  if c == 'b':
    if p < A+B and b < B:
      p += 1
      print('Yes')
    else:
      print('No')
    b += 1
  if c == 'c':
    print('No')

Submission status: Accepted

Solution code:
# coding: utf-8
# Your code here!
n,a,b=map(int,input().split())
s=list(input())
count=1
c=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':
        if count<=a+b and c<=b:
            count+=1
            c+=1
            print('Yes')
        else:
            print('No')
    else:
        print('No')

Submission status: Accepted

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

cnt = 0
b_cnt = 0

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

Submission status: Accepted

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

acnt = 0
bcnt = 0
for s in S:
  if s == "a":
    if (acnt + bcnt) < (A + B):
      print("Yes")
      acnt += 1
    else:
      print("No")    
  elif s== "b":
    if (acnt + bcnt) < (A + B) and bcnt < B:
      print("Yes")
      bcnt += 1
    else:
      print("No")
  else:
    print("No")

Submission status: Accepted

Solution code:
N, A, B = map(int, input().split())
S = input()
Ans = []
passed = 0
oversee = 0
for c in S:
    f = False
    if c=="a":
        if passed < A+B:
            passed += 1
            f = True
    elif c=="b":
        if passed < A+B and oversee < B:
            passed += 1
            oversee += 1
            f = True
    Ans.append(f)
print("\n".join(map(lambda x: ["No", "Yes"][x], Ans)))

Submission status: Accepted

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

Submission status: Accepted

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

s=input()
ans=[]
cnt=a+b
tmp=1
for i in range(len(s)):
    if s[i]=="a":
        if cnt>0:
            ans.append("Yes")
            cnt-=1
        else:
            ans.append("No")
    elif s[i]=="b":
        if cnt>0 and tmp<=b:
            ans.append("Yes")
            tmp+=1
            cnt-=1
        else:
            ans.append("No")
    else:
        ans.append("No")

for i in range(len(s)):
    print(ans[i])

Submission status: Accepted

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.append("Yes")
    elif ss=="b" and ok<a+b and x<b:
        ok+=1
        x+=1
        ans.append("Yes")
    else:
        ans.append("No")

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

Submission status: Accepted

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

a, b = 0, 0
for s in S:
    if s == 'a' and a+b < A+B:
        print('Yes')
        if a < A:
            a += 1
        else:
            b += 1
    elif s == '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()
ac=0
bc=0
cc=0
for c in s:
    if c=='a':
        ac+=1
        if cc<a+b:
            print('Yes')
            cc+=1
        else:
            print('No')
    elif c=='b':
        bc+=1
        if cc<a+b and bc<=b:
            print('Yes')
            cc+=1
        else:
            print('No')
    else:
        print('No')

Submission status: Accepted

Solution code:
def resolve():
    n, a, b = map(int, input().split())
    s = input()
    ans = 0
    foreign = 0
    for c in s:
        if c == "a":
            if ans < a + b:
                ans += 1
                print("Yes")
            else:
                print("No")
        elif c == "b":
            if ans < a + b and foreign < b:
                ans += 1
                foreign += 1
                print("Yes")
            else:
                print("No")
        else:
            print("No")


if __name__ == "__main__":
    resolve()

Submission status: Accepted

Solution code:
import os
import sys

if os.getenv("LOCAL"):
    sys.stdin = open("_in.txt", "r")

sys.setrecursionlimit(2147483647)
INF = float("inf")
IINF = 10 ** 18
MOD = 10 ** 9 + 7

N, A, B = list(map(int, sys.stdin.readline().split()))
S = sys.stdin.readline().rstrip()

cnt = 0
b = 0
for c in S:
    ok = False
    if c == 'a':
        ok = cnt < A + B
    if c == 'b':
        ok = cnt < A + B and b < B
        b += ok
    cnt += ok
    if ok:
        print('Yes')
    else:
        print('No')

Submission status: Accepted

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

count_a = 0
count_b = 0

for w in s:
    if w == "a":
        if (count_a + count_b) < (a + b):
            count_a += 1
            print("Yes")
        else:
            print("No")
    elif w == "b":
        if (count_a + count_b) < (a + b) and count_b < b:
            count_b += 1
            print("Yes")
        else:
            print("No")
    else:
        print("No")

Submission status: Accepted

Solution code:
n,a,b=map(int,input().split())	
s=list(input())
cnt=0
cnt2=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":
        if cnt<a+b and b>cnt2:
            print("Yes")
            cnt+=1
            cnt2+=1
        else:
            print("No")
            cnt2+=1
    else:
        print("No")

Submission status: Accepted

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

capacity = 0
f_capacity = 0

for c in s:
    if c == 'a':
        if capacity < a+b:
            capacity += 1
            print('Yes')
        else:
            print('No')
    elif c == 'b':
        if capacity < a+b and f_capacity < b:
            capacity += 1
            f_capacity += 1
            print('Yes')
        else:
            print('No')
    else:
        print('No')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n,a,b=map(int,input().split())
c1=c2=0
for i in input():
  if c1+c2>=a+b:
    print("No")
  elif i=="a":
    print("Yes")
    c1+=1
  elif i=="b":
    if c2>=b:
      print("No")
    else:
      print("Yes")
      c2+=1
  else:
    print("No")

Submission status: Accepted

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

for i in range(n):
    if s[i]=='a':
        print('Yes' if c>0 else'No')
        c-=1
    elif s[i]=='b':
        if c>0 and b>0:
            print('Yes')
            c-=1
            b-=1
        else:
            print('No')
    else:
        print('No')

Submission status: Accepted

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

for i in range(n):
    if s[i]=='a':
        if c>0:
            print('Yes')
            c-=1
        else:
            print('No')
    elif s[i]=='b':
        if c>0 and b>0:
            print('Yes')
            c-=1
            b-=1
        else:
            print('No')
    else:
        print('No')

Submission status: Accepted

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

c = 0
d = 0

for i in range(n):
    if s[i] == 'a':
        if c < a+b:
            c += 1
            print('Yes')
        else:
            print('No')
    elif s[i] == 'b':
        if c < a+b:
            if d < b:
                print('Yes')
                c += 1
                d += 1
            else:
                print('No')
        else:
            print('No')
    else:
        print('No')




#%%

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N, A, B = map(int, input().split())
S = input()
decided = 0
foreign_decided = 0
for c in S:
    if c == "c":
        print("No")
    else:
        if decided < A + B:
            if c == "a":
                print("Yes")
                decided += 1
            else:
                if foreign_decided < B:
                    print("Yes")
                    decided += 1
                    foreign_decided += 1
                else:
                    print("No")
        else:
            print("No")

Submission status: Accepted

Solution code:
N,A,B=map(int,input().split())
S=list(input())
cnt=0
cnt_b=0
for s in S:
  if cnt<A+B:
    if s=="a":
      cnt+=1
      print("Yes")
    elif s=="b":
      cnt_b+=1
      if cnt_b<=B:
        cnt+=1
        print("Yes")
      else:
        print("No")
    else:
      print("No")        
  else:
    print("No")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

a,b=0,0
for i,s in enumerate(S):
  if s=="c":
    print("No")
  elif s=="a":
    if a+b<A+B:
      print("Yes")
      a+=1
    else:
      print("No")
  else:
    if a+b<A+B and b<B:
      print("Yes")
      b+=1
    else:
      print("No")

Submission status: Accepted

Solution code:

def main():

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

if __name__ == '__main__':
    # print(main())
    main()

Submission status: Accepted

Solution code:
from collections import Counter, defaultdict
import sys
sys.setrecursionlimit(10 ** 5 + 10)
# input = sys.stdin.readline
from math import factorial
import heapq, bisect
import math
import itertools


import queue
from collections import deque




def main():
    num, a, b = map(int, input().split())
    data = list(input())

    for i in range(num):
        if data[i] == 'a':
            if a > 0:
                a -= 1
                print('Yes')
            elif b > 0:
                b -= 1
                print('Yes')
            else:
                print('No')
        elif data[i] == 'b':
            if b > 0:
                b -= 1
                print('Yes')
            else:
                print('No')
        else:
            print('No')




if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
_,A,B=map(int,input().split())
for c in input():
 if(c=="a")&(A+B>0):print("Yes");A-=1
 elif(c=="b")&(A+B>0)&(B>0):print("Yes");B-=1
 else:print("No")

Submission status: Accepted

Solution code:
_,A,B=map(int,input().split());C=A+B
for c in input():
 if(c=="a")&(C>0):print("Yes");C-=1
 elif(c=="b")&(C>0)&(B>0):print("Yes");C-=1;B-=1
 else:print("No")

Submission status: Accepted

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

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def solve(n, a, b, s):
    num_domestic = 0
    num_overseas = 0
    for i in range(n):
        if s[i] == "a":
            if num_domestic + num_overseas < a + b:
                num_domestic += 1
                print("Yes")
            else:
                print("No")
        elif s[i] == "b":
            if (num_domestic + num_overseas < a + b) and (num_overseas < b):
                num_overseas += 1
                print("Yes")
            else:
                print("No")
        else:
            print("No")

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

Submission status: Accepted

Solution code:
N, A, B = map(int, input().split())
s = input()
a = 0
b = 0
ans = []

for i in range(N):
    if s[i] == 'a':
        if a < A:
            ans.append('Yes')
            a += 1
        elif b < B:
            ans.append('Yes')
            b += 1
        else:
            ans.append('No')
    elif s[i] == 'b':
        if b < B:
            ans.append('Yes')
            b += 1
        else:
            ans.append('No')
    else:
        ans.append('No')

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N, A, B = map(int, input().split())
S = input()
for s in S:
  if s == "a" and A > 0:
    print("Yes")
    A -= 1
  elif s == "a" and B > 0:
    print("Yes")
    B -= 1
  elif s == "b" and B > 0:
    print("Yes")
    B -= 1
  else:
    print("No")

Submission status: Accepted

Solution code:
import math, string, itertools, fractions, heapq, collections, re, array, bisect, copy, functools, random
import sys
from collections import deque, defaultdict, Counter; from heapq import heappush, heappop
from itertools import permutations, combinations, product, accumulate, groupby
from bisect import bisect_left, bisect_right, insort_left, insort_right
from operator import itemgetter as ig
sys.setrecursionlimit(10 ** 7)
inf = 10 ** 20; INF = float("INF"); ans = 0; tmp = 0; cnt = 0; ansli = []; tmpli = []; candili = []; stillset = set()
eps = 1.0 / 10 ** 10; mod = 10 ** 9 + 7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]; ddn = dd + [(-1, 1), (1, 1), (1, -1), (-1, -1)]; ddn9 = ddn + [(0, 0)]
"""for dx, dy in dd:
        nx = j + dx; ny = i + dy
            if 0 <= nx < w and 0 <= ny < h:"""
def wi(): return list(map(int, sys.stdin.readline().split()))
def wip(): return [int(x) - 1 for x in sys.stdin.readline().split()]#WideIntPoint
def ws(): return sys.stdin.readline().split()
def i(): return int(sys.stdin.readline())
def s(): return input()
def s_list(): return list(input())
def hi(n): return [i() for _ in range(n)]
def hs(n): return [s() for _ in range(n)]#HeightString
def mi(n): return [wi() for _ in range(n)]#MatrixInt
def num_grid(n): return [[int(i) for i in sys.stdin.readline().split()[0]] for _ in range(n)]#NumberGrid
def mip(n): return [wip() for _ in range(n)]
def ms(n): return [ws() for _ in range(n)]
def grid(n): return [s_list() for _ in range(n)]


if __name__ == '__main__':
    n, a, b = wi()
    s = s()
    acnt = 0
    bcnt = 0
    for i in range(n):
        if s[i] == "a":
            if acnt + bcnt < a + b:
                print("Yes")
                acnt += 1
            else:
                print("No")
        elif s[i] == "b":
            if acnt + bcnt < a + b:
                if bcnt < b:
                    print("Yes")
                    bcnt += 1
                else:
                    print("No")
            else:
                print("No")
        else:
            print("No")

Submission status: Accepted

Solution code:
n, a, b = [ int(v) for v in input().split() ]
s = input()
total, abroad = 0, 0
for i in s:
    ans = "No"
    if i == "a":
        if total < a + b:
            total += 1
            ans = "Yes"
    elif i == "b":
        if total < a + b and abroad < b:
            total += 1
            abroad += 1
            ans = "Yes"
    print(ans)

Submission status: Accepted

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

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

if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n,a,b = map(int,input().split())
t = 0
t1 = 1

s = input()
for i in range(n):
    if s[i]=="a":
        if t < a+b:
            print("Yes")
            t += 1
        else:
            print("No")
    elif s[i] == "b":
        if t < a+b and t1 <= b:
            print("Yes")
            t1 += 1
            t += 1
        else:
            print("No")
    else:
        print("No")

Submission status: Accepted

Solution code:
# code-festival-2016-qualbB - Qualification simulator
def main():
    N, A, B = tuple(map(int, input().split()))
    S = input()
    ans, x, y = [], 0, 0
    for i in S:
        if (i == "a" and x < A + B) or (i == "b" and x < A + B and y < B):
            ans += ["Yes"]
            x += 1
            y += 1 if i == "b" else 0
        else:
            ans += ["No"]
    print(*ans, sep="\n")


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
# code-festival-2016-qualbB - Qualification simulator
def main():
    N, A, B = tuple(map(int, input().rstrip().split()))
    S = input().rstrip()
    ans, a, b = [], 0, 0
    for i in S:
        if i == "a":
            if a < A + B:
                ans += ["Yes"]
                a += 1
            else:
                ans += ["No"]
        elif i == "b":
            if a < A + B and b < B:
                ans += ["Yes"]
                a += 1
                b += 1
            else:
                ans += ["No"]
        else:
            ans += ["No"]
    print(*ans, sep="\n")


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
n, a, b = map(int, input().split())
s = input()
u = v = 0
for x in s:
    if u == a+b or x == 'c':
        print('No')
    elif x == 'a':
        print('Yes')
        u += 1
    else:
        if v == b:
            print('No')
        else:
            print('Yes')
            u += 1
            v += 1

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n,a,b=map(int,input().split())
l=list(input())
PASS=0
B=0
for i in l:
    if i=="a":
        if PASS<a+b:
            print("Yes")
            PASS+=1
        else:print("No")
    elif i=="b":
        if PASS<a+b and B<=b-1:
            print("Yes")
            PASS+=1
            B+=1
        else:print("No")
    else:print("No")

Submission status: Accepted

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

num_passed = 0
b_passed = 0

for n in range(N):
    if S[n] == 'c':
        print('No')
    elif S[n] == 'b':
        b_passed += 1
        num_passed += 1
        if num_passed > A + B:
            print('No')
        else:
            if b_passed > B:
                print('No')
                num_passed -= 1
            else:
                print('Yes')
    elif S[n] == 'a':
        num_passed += 1
        if num_passed > A + B:
            print('No')
        else:
            print('Yes')

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n, a, b = [int(item) for item in input().split()]
s = input().rstrip()

domestic = 0; foreign = 0
for item in s:
    if item == "a":
        if domestic + foreign < a + b:
            print("Yes")
            domestic += 1
        else:
            print("No")
    elif item == "b":
        if domestic + foreign < a + b and foreign < b:
            print("Yes")
            foreign += 1
        else:
            print("No")
    elif item == "c":
        print("No")

Submission status: Accepted

Solution code:
###template###
import sys
def input(): return sys.stdin.readline().rstrip()
from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt, ceil, floor
from collections import deque
from bisect import bisect, bisect_left, bisect_right
from string import ascii_lowercase
import heapq
INF = float("inf")
sys.setrecursionlimit(10**7)
# 4近傍（右, 下, 左, 上）
dy = [0, -1, 0, 1]
dx = [1, 0, -1, 0]
def inside(y: int, x: int, H: int, W: int) -> bool: return 0 <= y < H and 0 <= x < W
def mi(): return map(int, input().split())
def ii(): return int(input())
###template###

N, A, B = mi()
S = input()

passed = 0
passedfrgn = 0
for c in S:
  if c=='a':
    if passed<A+B:
      print('Yes')
      passed += 1
    else:
      print('No')
  elif c=='b':
    if passed<A+B and passedfrgn<B:
      print('Yes')
      passed += 1
      passedfrgn += 1
    else:
      print('No')
  else:
    print('No')

Submission status: Accepted

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

a=0
b=0
for s in 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: Accepted

Solution code:
def main():
    N, A, B = map(int, input().split())
    S = input()
    for c in S:
        if c == "a":
            if A + B > 0:
                print("Yes")
                A -= 1
                continue
        elif c == "b":
            if A + B > 0 and B > 0:
                print("Yes")
                B -= 1
                continue
        print("No")


if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

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

passA = 0
passB = 0
for i in range(N):
    if passA + passB >= A + B:
        print('No')
        continue
    if S[i] == 'c':
        print('No')
    if S[i] == 'b':
        if passB >= B:
            print('No')
        else:
            print('Yes')
            passB += 1
    if S[i] == 'a':
        print('Yes')
        passA += 1

Submission status: Accepted

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

ac, bc = 0, 0
for s in S:
	if "a" == s:
		if (ac + bc) < (A + B):
			ac += 1
			print("Yes")
		else:
			print("No")
	elif "b" == s:
		if (ac + bc) < (A + B) and (bc < B):
			bc += 1
			print("Yes")
		else:
			print("No")
	else:
		print("No")

Submission status: Accepted

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