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:
row = input().split(' ')
n = int(row[0])
a = int(row[1])
b = int(row[2])
s = input()
passed_kokunai = 0
passed_kaigai = 0
ans = list()
for i, ch in enumerate(s):
    if passed_kokunai + passed_kaigai >= a + b:
        ans.append('No')
        continue
    if ch == 'a':
        ans.append('Yes')
        passed_kokunai += 1
    elif ch == 'b' and passed_kaigai < b:
        ans.append('Yes')
        passed_kaigai += 1
    else:
        ans.append('No')
for elem in ans:
    print(elem)

Submission status: Accepted

Solution code:
N, A, B = map(int, input().split())
S = input()
cnt = 0
over = 0
for i in range(N):
    # print(S[i])
    if S[i] == 'c':
        print('No')
        continue
    if S[i] == 'a':
        if cnt < A + B:
            print('Yes')
            cnt += 1
        else:
            print('No')
    else:
        if cnt < A + B:
            if over + 1 <= B:
                print('Yes')
                cnt += 1
                over += 1
            else:
                print('No')
        else:
            print('No')

Submission status: Accepted

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

Submission status: Accepted

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

for F in f:
  print(F)

Submission status: Accepted

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

ab = a + b
cnt = 0
fcnt = 1
for i in range(n):
    if s[i] == 'a' and ab > cnt:
        cnt += 1
        print('Yes')
    elif s[i] == 'b' and (ab > cnt and b >= fcnt):
        cnt += 1
        fcnt += 1
        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 i in range(N):
    if S[i] == 'a':
        if count_a+count_b < A+B:
            count_a+=1
            print('Yes')
        else:
            print('No')
    elif S[i] == '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:
def resolve():
    n,a,b=map(int, input().split())
    s=list(input())
    cnt=0
    cnt_b=0
    for i in range(n):
        if s[i]=='c':
            print('No')
        elif s[i]=='a':
            if cnt<a+b:
                print('Yes')
                cnt+=1
            else:
                print('No')
        else:
            if cnt<a+b and cnt_b<b:
                print('Yes')
                cnt+=1
                cnt_b+=1
            else:
                print('No')
resolve()

Submission status: Accepted

Solution code:
import sys
import heapq, math
from itertools import zip_longest, permutations, combinations, combinations_with_replacement
from itertools import accumulate, dropwhile, takewhile, groupby
from functools import lru_cache
from copy import deepcopy

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

for s in S:
    if s == 'a' and A + B > 0:
        print("Yes")
        if A > 0:
            A -= 1
        else:
            B -= 1
    elif s == 'b' and B > 0:
        print("Yes")
        B -= 1
    else:
        print("No")

Submission status: Accepted

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

passed_japanese = 0
passed_foreigner = 0
ans = []

for i, c in enumerate(S):
    if A+B > passed_japanese+passed_foreigner:
        if c == 'a':
            passed_japanese += 1
            ans.append('Yes')
        elif c == 'b':
            if passed_foreigner+1 <= B:
                passed_foreigner += 1
                ans.append('Yes')
            else:
                ans.append('No')
        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()

total = a + b
foreign = b

for c in s:
    if total <= 0:
        print('No')
    else:
        # still remain places
        if c == 'c':
            print('No')
        elif c == 'a':
            print('Yes')
            total -= 1
        elif foreign <= 0:
            print('No')
        else:
            print('Yes')
            total -= 1
            foreign -= 1

Submission status: Accepted

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

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

Submission status: Accepted

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

passed_foreigner = 0
passed_native = 0

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

Submission status: Accepted

Solution code:
import sys

sys.setrecursionlimit(10 ** 7)
f_inf = float('inf')
mod = 10 ** 9 + 7


def resolve():
    n, a, b = map(int, input().split())
    S = input()

    cnt = 0
    cnt_b = 0
    for s in S:
        if cnt < a + b:
            if s == "a":
                print("Yes")
                cnt += 1
            elif s == "b":
                if cnt_b < b:
                    print("Yes")
                    cnt += 1
                    cnt_b += 1
                else:
                    print("No")
            else:
                print("No")
        else:
            print("No")


if __name__ == '__main__':
    resolve()

Submission status: Accepted

Solution code:
l=list(map(int,input().split()))
participant=list(input())
passnum=l[1]+l[2]
b=0
for i in range(l[0]):
    if participant[i]=='a' and passnum>0:
        participant[i]='Yes'
        passnum-=1
    elif participant[i]=='b' and passnum>0 and b<l[2]:
            participant[i]='Yes'
            passnum-=1
            b+=1
    elif passnum==0:
        break
for i in range(l[0]):
    if participant[i]!='Yes':
        participant[i]='No'
for i in range(l[0]):
    print(participant[i])

Submission status: Accepted

Solution code:
def main():
    import sys
    input = sys.stdin.readline
    sys.setrecursionlimit(10**7)
    from collections import Counter, deque
    #from collections import defaultdict
    from itertools import combinations, permutations, accumulate, groupby, product
    from bisect import bisect_left,bisect_right
    from heapq import heapify, heappop, heappush
    from math import floor, ceil
    #from operator import itemgetter

    #inf = 10**17
    #mod = 10**9 + 7

    n,a,b = map(int, input().split())
    s = input().rstrip()
    # 通過者
    c = 0
    # 海外の学生の順位
    d = 1
    res = []
    for i in s:
        if i=='c':
            res.append('No')
        if i=='b':
            if c<a+b and d<=b:
                res.append('Yes')
                c += 1
                d += 1
            else:
                res.append('No')
        if i=='a':
            if c<a+b:
                res.append('Yes')
                c += 1
            else:
                res.append('No')
    for i in res:
        print(i)

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
# 1
# https://atcoder.jp/contests/code-festival-2016-qualb/tasks/codefestival_2016_qualB_b
N,A,B=map(int,input().split())
S=input()
X=0
Y=0
for s in S:
    if s=='a':
        if X+Y<A+B:
            print('Yes')
            X+=1
        else:
            print('No')
    elif s=='b':
        if X+Y<A+B and Y+1<=B:
            print('Yes')
            Y+=1
        else:
            print('No')
    else:
        print('No')

Submission status: Accepted

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

K = 0
L = 0

for i in range(N):
  if(str[i] == "a"):
    if(K < A + B):
      print("Yes")
      K+=1
    else:
      print("No")
  elif(str[i] == "b"):
    if(K < A + B and L < B):
      print("Yes")
      K+=1
      L+=1
    else:
      print("No")
  else:
  	print("No")

Submission status: Accepted

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

Submission status: Accepted

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

s1 = 0
#全体の通過者
s2 = 1
#海外の順位

for x in range(N):
    if S[x] == "a":
        if s1 < A + B:
            print("Yes")
            s1 += 1
        else:
            print("No")

    elif S[x] == "b":
        if s1 < A + B and s2 <= B:
            print("Yes")
            s1 += 1
        else:
            print("No")
        s2 += 1

    elif S[x] == "c":
        print("No")

Submission status: Accepted

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

cnt = A + B

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

Submission status: Accepted

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

ans = ["No"] * N
kaigai = 0
cnt = 0
for i in range(N):
    if S[i] == "a":
        if cnt < A + B:
            ans[i] = "Yes"
            cnt += 1

    elif S[i] == "b":
        if cnt < A+B and kaigai < B:
            ans[i] = "Yes"
            kaigai += 1
            cnt += 1

for i in ans:
    print(i)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
N, A, B = map(int, input().split())
C = input()
D = [C[i:i+1] for i in range(N)]
AA = 0
BB = 0
for i in(D):
  if i == 'c':
    print('No')
  elif i =='a' and A+B > AA+BB:
    print('Yes')
    AA += 1
  elif i =='b' and A+B > AA+BB and BB < B:
    print('Yes')
    BB += 1
  else:
    print('No')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import sys
import copy
from collections import deque


def main():

    n ,a, b = map(int, input().split())
    s=input()
    cnt=[0,0]
    for i ,item in enumerate(s):
        if item=='a' and a+b>cnt[0]:
            print('Yes')
            cnt[0]+=1

        elif item=='b' and a+b>cnt[0] and b>cnt[1] :
            print("Yes")
            cnt[0]+=1
            cnt[1]+=1
        else:
            print("No")


main()

Submission status: Accepted

Solution code:
import numpy as np
import sys

input = sys.stdin.readline

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

S = input()

nai = 0
gai = 0


goukaku = 0
for i in range(len(S)):
    if S[i] == 'a':
        nai+=1
        if goukaku < A+B:
            goukaku+=1
            print("Yes")
        else:
            print("No")

    elif S[i] == 'b':
        gai+=1
        if goukaku < A+B and gai <= B:
            goukaku+=1
            print("Yes")
        else:
            print("No")

    elif S[i] == 'c':
        print("No")

Submission status: Accepted

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

pass_human = 0
overseas = 0

for i in S:
    if i == "a":
        if pass_human < A+B:
            print("Yes")
            pass_human += 1
        else:
            print("No")
    elif i == "b":
        if pass_human < A+B and overseas < B:
            print("Yes")
            pass_human += 1
            overseas += 1
        else:
            print("No")
    else:
        print("No")

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
n, a, b = map(int, input().split())
S = input()
cnt = 0
no = 0
for i in range(n):
    if S[i] == 'a':
        if cnt < a+b:
            print('Yes')
            cnt += 1
        else:
            print('No')
    if S[i] == 'b':
        no += 1
        if cnt < a+b and no <= b:
            print('Yes')
            cnt += 1
        else:
            print('No')
    if S[i] == 'c':
        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 == "c":
        print("No")
    elif s == "a":
        if a < A + B:
            print("Yes")
            a += 1
        else:
            print("No")
    else:
        b += 1
        if a < A + B and b <= B:
            a += 1
            print("Yes")
        else:
            print("No")

Submission status: Accepted

Solution code:
n,a,b = map(int,raw_input().split())
s = raw_input()
apb = 0
over = 0
for i in s:
    if i =='a':
        if apb >= a+b:
            print  'No'
        else:
            print 'Yes'
            apb+=1
    elif i == 'b':
        if apb < a+b and over <=b-1:
            print 'Yes'
            apb+=1
            over+=1
        else:
            print 'No'
    else:
        print 'No'

Submission status: Accepted

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

Submission status: Accepted

Solution code:
p = f = 0
n, a, b = map(int, input().split())
q = print

for i in input():
    if i == "a" and p < a + b:
        p += 1
        q("Yes")

    elif i == "b" and p < a + b and f < b:
        p += 1
        f += 1
        q("Yes")
    
    else:
        q("No")

Submission status: Accepted

Solution code:
#code festival2016-B
n,a,b = map(int,input().split())
s = input()
c = a+b
kaigai = []
yosen = []

for i in s:
    if i == 'a':
        if len(yosen) < c:
            print('Yes')
            yosen.append(i)
        else:
            print('No')
    elif i == 'b':
        if len(yosen) < c and len(kaigai) < b:
            print('Yes')
            yosen.append(i)
            kaigai.append(i)
        else:
            print('No')
            
        
    else:
        print('No')

Submission status: Accepted

Solution code:
N,a,b = map(int,input().split())
S = str(input())

C=[]
A=0
B=0

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

    elif S[i] == 'b':
        if A+B < a+b and B < b:
            B += 1
            C.append('Yes')
        else:
            C.append('No')
    else:
        C.append('No')

for w in C:
    print(w)

Submission status: Accepted

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

Submission status: Accepted

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

C = A + B
ans = []
df = 0
f = 0

for i in range(N):
  s = S[i]
  if s == 'c':
    ans.append('No')
    continue
  elif s == 'a':
    df += 1
    if df <= C:
      ans.append('Yes')
    else:
      ans.append('No')
  elif s == 'b':
    df += 1
    f += 1
    if df <= C and f <= B:
      ans.append('Yes')
    else:
      df -= 1
      ans.append('No')
      
print('\n'.join(ans))

Submission status: Accepted

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

Submission status: Accepted

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

cnt = 0
cnt_b = 0
for s in S:
    if s =='a':
        if cnt < A+B:
            print('Yes')
            cnt+=1
        else:
            print('No')
    elif s=='b':
        if (cnt < A+B)&(cnt_b < B):
            print('Yes')
            cnt+=1
            cnt_b+=1
        else:
            print('No')
    else:
        print('No')

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

a = 0
b = 0
for si in s:
    if si == 'a' and a+b < A+B:
        a += 1
        print('Yes')
    elif si == 'b' and a+b < A+B and b < B:
        b += 1
        print('Yes')
    else:
        print('No')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10**8)
INF = float('inf')
MOD = 10**9+7


def main():
  N, A, B = map(int, readline().split())
  S = input()
  L = len(S)
  cnt_AB = 0
  cnt_B = 0
  for i in range(L):
    s = S[i]
    if s == 'a':
      if cnt_AB < A + B:
        print('Yes')
        cnt_AB += 1
      else:
        print('No')
    elif s == 'b':
      if cnt_AB<A+B and cnt_B<B:
        print('Yes')
        cnt_AB += 1
        cnt_B += 1
      else:
        print('No')
    else:
      print('No')
  
  
  
if __name__ == '__main__':
  main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n, a, b = map(int,input().split())
s_list = list(input())
judge=[]
count_tot = 0
count_inter = 0

for s in s_list:
    if s == 'a':
        if count_tot < a+b:
            judge.append('Yes')
            count_tot += 1
            continue
    elif s == 'b':
        if count_tot < a+b and count_inter < b:
            judge.append('Yes')
            count_tot += 1
            count_inter += 1
            continue
    judge.append('No')

for result in judge:
    print(result)

Submission status: Accepted

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

aac = 0
bac = 0

for i in s:
    if i == 'a' and aac + bac < a + b:
        print("Yes")
        aac += 1
    elif i == 'b' and aac + bac < a + b and bac < b:
        print("Yes")
        bac += 1
    else:
        print("No")

Submission status: Accepted

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

total = 0
b = 0
answer = []

for s in S:
  bl = False
  if s == 'a':
    if total < A+B:
      bl = True
      total += 1
  elif s == 'b':
    if total < A+B and b < B:
      bl = True
      total += 1
      b += 1
  answer.append('Yes' if bl else 'No')
  
print(*answer, sep='\n')

Submission status: Accepted

Solution code:
#!usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS():return [list(x) for x in sys.stdin.readline().split()]
def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res
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)]

sys.setrecursionlimit(1000000)
mod = 1000000007

def solve():
    n,a,b = LI()
    s = input()
    su = sb = 0
    c = a+b
    for i in range(n):
        if su >= c:
            print("No")
            continue
        if s[i] == "a":
            su += 1
            print("Yes")
        elif s[i] == "b":
            if sb < b:
                su += 1
                sb += 1
                print("Yes")
            else:
                print("No")
        else:
            print("No")
    return

#Solve
if __name__ == "__main__":
    solve()

Submission status: Accepted

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


if __name__ == "__main__":
    resolve()

Submission status: Accepted

Solution code:
N, A, B = map(int, input().split())
S = input()
l = list(S)
#l is composed of a, b, and c

k = 0
for i in range(0, N):
    if l[i] == 'c':
        l[i] = 'No'
    elif l[i] == 'a' and k < A+B:
        l[i] = 'Yes'
        k += 1
    elif l[i] == 'b' and k < A+B:
        l[i] = 'passedb'
        k += 1
        #A's and B's ranked in the top A+Bth among all the A's andB's tentatively passed now 
        #C's were rejected now
#l is now composed of Yes(a), passedb, No(c), a, and b

m = 0
for j in range(0, N):
    if l[j] == 'passedb':
        if m < B:
            l[j] = 'Yes'
            m += 1
        else:
            l[j] = 'No'
    #B's ranked in the top Bth among all the B's passed now
    elif l[j] == 'b':
        l[j] = 'No'
    #the other B's were rejected now
#l is now composed of Yes, No, 

t = 0
for k in range(N):
    if l[k] == 'Yes':
        t += 1
    elif l[k] == 'a' and t < A+B:
        l[k] = 'Yes'
        t += 1
    else:
        l[k] = 'No'

for i in range(N):
    print(l[i])

#全体として
#cを弾く。上位a+b位のAとBについて全員とおしpassedA, passedBに置換
#passedBの中で上位b位に入っていない人をNoにする
#もう一回Aを対象に選考

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
import sys
sys.setrecursionlimit(10**9)
INF=10**18
MOD=10**9+7
input=lambda: sys.stdin.readline().rstrip()
YesNo=lambda b: bool([print('Yes')] if b else print('No'))
YESNO=lambda b: bool([print('YES')] if b else print('NO'))

def main():
    N,A,B=map(int,input().split())
    S=list(input())
    c=0
    cc=0
    for i in range(N):
        if S[i]=='a':
            c+=YesNo(c<A+B)
        elif S[i]=='b':
            tmp=YesNo(c<A+B and cc<B)
            c+=tmp
            cc+=tmp
        else:
            YesNo(0)

if __name__ == '__main__':
    main()

f3=lambda b: bool([print('Yes')] if b else print('No'))

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
# https://atcoder.jp/contests/code-festival-2016-qualb/tasks/codefestival_2016_qualB_b
n, a, b = map(int, input().split())
s = input()

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

N, A, B = list(map(int, input().split()))
S = input()
k = 0
ans = ""
b_i = 0
for i, ch in enumerate(S):

    if ch == "b":
        b_i += 1
    r = "No"
    if ch == "a" and k < A + B:
        r = "Yes"
        k += 1
    elif ch == "b" and k < A + B and b_i <= B:
        r = "Yes"
        k += 1
    ans += r + "\n"

print(ans)

Submission status: Accepted

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