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:
#! /usr/bin/env python3
# -*- coding:utf-8 -*-

def get_result(N, A, B, S):
    result = []
    num_passed = 0
    rank_global = 1
    for x in S:
        if num_passed >= A+B:
            result.append(False)
            continue
        if x == "a":
            result.append(True)
            num_passed += 1
            continue
        if x == "b":
            if rank_global > B:
                result.append(False)
            else:
                result.append(True)
                num_passed += 1
                rank_global += 1
            continue
        else:
            result.append(False)
    return result

def main():
    N, A, B = map(int, input().split())
    S = input()
    result = get_result(N, A, B, S)
    for x in result:
        if x == True: print("Yes")
        elif x == False: print("No")

if __name__ == "__main__":
    try:
        assert get_result(10, 2, 3, "abccabaabb") == [True, True, False, False, True, True, True, False, False, False]
        assert get_result(12, 5, 2, "cabbabaacaba") == [False, True, True, True, True, False, True, True, False, True, False, False]
    except:
        import traceback
        traceback.print_exc()
        exit()
    main()

Submission status: Accepted

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

count = 0
foreign = 0
for s_i in s:
  if s_i=='a':
    if count<a+b:
      count+=1
      print("Yes")
    else:
      print("No")
  elif s_i=='b':
    if count<a+b and foreign < b:
      count+=1
      foreign+=1
      print("Yes")
    else:
      print("No")
  else:
    print("No")

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
n, a, b = [int(i) for i in input().split()]
s = input()
count = 0
count_b = 0

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

Submission status: Accepted

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

x = 0
y = 0
for c in s:
    if c == "a":
        if x < a + b:
            print("Yes")
            x += 1
        else:
            print("No")
    elif c == "b":
        if x < a + b and y < b:
            print("Yes")
            x += 1
            y += 1
        else:
            print("No")
            y += 1
    else:
        print("No")

Submission status: Accepted

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

Submission status: Accepted

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

ab = 0
f = 0

for t in s:
    if t == "a":
        if ab < A + B:
            print("Yes")
            ab += 1
        else:
            print("No")
    elif t == "b":
        if ab < A + B and f < B:
            print("Yes")
            ab += 1
            f += 1
        else:
            print("No")
    else:
        print("No")

Submission status: Accepted

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

rank = 1
b_rank = 0
for n in range(N):
    if S[n] == 'a':
        if rank <= (A+B):
            rank += 1
            print('Yes')
        else:
            print('No')

    if S[n] == 'b':
        b_rank += 1
        if (rank <= (A+B)) and (b_rank <= B):
            rank += 1
            print('Yes')
        else:
            print('No')

    if S[n] == 'c':
        print('No')

Submission status: Accepted

Solution code:
import numpy as np
import sys 
read = sys.stdin.buffer.read
read = sys.stdin.buffer.readline
read = sys.stdin.buffer.readlines

n , A , B = map(int,input().split())
S = input()
a , b = 0 , 0
for s in S:
    if s == "a":
        if  a + 1 + b <= A + B:
            print("Yes")
            a += 1
            continue
    
    if s == "b":
        if  a + 1 + b <= A + B and b + 1 <= B:
            print("Yes")
            b += 1
            continue
    
    print("No")

Submission status: Accepted

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

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n,a,b = map(int,input().split())
s = input()
ga = 0
gb = 0
for i in s:
    if i == 'a':
        if ga >= a+b:
            print('No')
        else:
            print('Yes')
            ga += 1
    elif i == 'b':
        if ga >= a+b or gb >= b:
            print('No')
        else:
            print('Yes')
            ga += 1
            gb += 1
    else:
        print('No')

Submission status: Accepted

Solution code:
def II(): return int(input())
def MI(): return map(int,input().split())
def LMI(): return list(map(int,input().split()))
def LIIN(n): return list(int(input()) for _ in range(n))
def LMIN(n): return [list(map(int, input().split())) for _ in range(n)]
def IS(): return input()
def LS(): return list(input())
def MS(): return map(str,input().split())
def LMS(): return list(map(str,input().split()))
def LMS(): return list(map(str,input().split()))
def LISN(n): return list(input() for _ in range(n))
def LMSN(n): return [input().split() for _ in range(n)]
MOD = 10**9+7
INF = 10**18

def main():
    n,a,b = MI()
    s = LS()
    for i in range(n):
        if s[i] == 'c':
            print('No')
            continue
        if s[i] == 'a':
            if a > 0:
                a-=1
                print('Yes')
            elif b > 0:
                b-=1
                print('Yes')
            else:
                print('No')
            continue
        if s[i] == 'b':
            if a+b > 0 and b > 0:
                b-=1
                print('Yes')
            else:
                print('No')
            continue

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
N,A,B=map(int, input().split())
S=input()
cntA=0
cntB=0
for s in S:
  if s == 'c':
    print('No')
    continue
  if s == 'a' and (cntA+cntB) < A+B:
    print('Yes')
    cntA +=1
  elif (s == '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()

count, rank = 0, 0
for s in S:
    if s == 'b':
        rank += 1

    if (s == 'a') and (count < A + B):
        count += 1
        print('Yes')
    elif (s == 'b') and (count < A + B) and (rank <= B):
        count += 1
        print('Yes')
    else:
        print('No')

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

pass_a = True
cnt = 0
cnt_b = 1
for i in s:

    if cnt < A + B:
        if i == "a":
            print("Yes")
            cnt += 1

        elif i == "b":
            if cnt_b <= B:
                print("Yes")
                cnt += 1
                cnt_b += 1
            else:
                print("No")
        else:
            print("No")
    
    else:
        print("No")

Submission status: Accepted

Solution code:
vars = input().split()
n,a,b = int(vars[0]),int(vars[1]),int(vars[2])
passed = 0
os = 1
parts = input()
for c in parts:
  if c=="c":
    print("No")
  elif c=="b" and passed<a+b and os<=b:
    print("Yes")
    passed += 1
    os += 1
  elif c=="a" and passed<a+b:
    print("Yes")
    passed += 1
  else:
    print("No")

Submission status: Accepted

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

Submission status: Accepted

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

b_cnt = 0
ab_cnt = 0
for i in s:
    if i == "a":
        if ab_cnt < a + b:
            ab_cnt += 1
            print("Yes")
        else:
            print("No")
    elif i == "b":
        if ab_cnt < a + b and b_cnt < b:
            ab_cnt += 1
            b_cnt += 1
            print("Yes")
        else:
            print("No")
    else:
        print("No")

Submission status: Accepted

Solution code:
import sys
## io ##
def IS(): return sys.stdin.readline().rstrip()
def II(): return int(IS())
def MII(): return list(map(int, IS().split()))
def MIIZ(): return list(map(lambda x: x-1, MII()))
## dp ##
def DD2(d1,d2,init=0): return [[init]*d2 for _ in range(d1)]
def DD3(d1,d2,d3,init=0): return [DD2(d2,d3,init) for _ in range(d1)]
## math ##
def to_bin(x: int) -> str: return format(x, 'b') # rev => int(res, 2)
def to_oct(x: int) -> str: return format(x, 'o') # rev => int(res, 8)
def to_hex(x: int) -> str: return format(x, 'x') # rev => int(res, 16)
MOD=10**9+7
def divc(x,y) -> int: return -(-x//y)
def divf(x,y) -> int: return x//y
def gcd(x,y):
    while y: x,y = y,x%y
    return x
def lcm(x,y): return x*y//gcd(x,y)
def enumerate_divs(n):
    """Return a tuple list of divisor of n"""
    return [(i,n//i) for i in range(1,int(n**0.5)+1) if n%i==0]
def get_primes(MAX_NUM=10**3):
    """Return a list of prime numbers n or less"""
    is_prime = [True]*(MAX_NUM+1)
    is_prime[0] = is_prime[1] = False
    for i in range(2, int(MAX_NUM**0.5)+1):
        if not is_prime[i]: continue
        for j in range(i*2, MAX_NUM+1, i):
            is_prime[j] = False
    return [i for i in range(MAX_NUM+1) if is_prime[i]]
## libs ##
from itertools import accumulate as acc
from collections import deque, Counter
from heapq import heapify, heappop, heappush
from bisect import bisect_left

#======================================================#

def main():
    n, a, b = MII()
    s = IS()
    maxv = a+b
    now = 0
    e_now = 0
    for si in s:
        if si == 'a':
            if now < maxv:
                print('Yes')
                now += 1
                continue
        elif si == 'b':
            if now < maxv and e_now < b:
                print('Yes')
                now += 1
                e_now += 1
                continue
        print('No')

if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

countA = 0
countB = 0
count = 0

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

Submission status: Accepted

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

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

Submission status: Accepted

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

def ans(b):
  print('Yes' if b else 'No')

passed = 0 # 現在までに予選通過した人数のカウント
overseas = 0 # 海外の学生のカウント

# 条件式の効率はよくないが明瞭さを重視
for s in S:
  if s == 'a':
    if passed < A + B:
      passed += 1
      ans(1)
    else:
      ans(0)
  elif s == 'b':
    overseas += 1
    if passed < A + B and overseas <= B:
      passed += 1
      ans(1)
    else:
      ans(0)
  else:
    ans(0)

Submission status: Accepted

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

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

Submission status: Accepted

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

tuuka = 0
kaigai = 0

for s in S:
    if s == "b":
        kaigai += 1
        if tuuka < A + B and kaigai <= B:
            ans = "Yes"
            tuuka += 1
        else:
            ans = "No"
    elif s == "a":
        if tuuka < A + B:
            ans = "Yes"
            tuuka += 1
        else:
            ans = "No"
    else:
        ans = "No"
    print(ans)

Submission status: Accepted

Solution code:
# CODE FESTIVAL 2016 予選 B: B – Qualification simulator
N, A, B = [int(s) for s in input().split()]
S = input()

domestics = 0
abroads = 0

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

Submission status: Accepted

Solution code:
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))

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

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

Submission status: Accepted

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

for c in s:
  if c =='c':
    print('No')
  elif c=='a':
    if a >0:
      print('Yes')
      a -= 1
    elif b > 0:
      print('Yes')
      b -= 1
    else:
      print('No')
  else:
    if b > 0:
      print('Yes')
      b -= 1
    else:
      print('No')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# N = int(input())
N, A, B = map(int, input().split())
students = list(input())
through = 0
abroad_rank = 0
for student in students:
    if through >= A+B:
        print('No')
        continue
    if student == 'a':
        print('Yes')
        through += 1
    elif student == 'b':
        if abroad_rank+1<=B:
            print('Yes')
            through += 1
            abroad_rank += 1
        else:
            print('No')
    else:
        print('No')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
input=sys.stdin.buffer.readline
n,a,b=map(int,input().split())
S=input()[:-1]
total=0
b_lim=0
for i in range(n):
    if S[i]==97 and total<a+b:
        print("Yes")
        total+=1
        continue
    if S[i]==98 and total<a+b and b_lim<b:
        print("Yes")
        total+=1
        b_lim+=1
        continue
    else:print("No")

Submission status: Accepted

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

Submission status: Accepted

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

a_counter = 0
b_counter = 0

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

Submission status: Accepted

Solution code:
n,a,b = map(int,input().split())
s = list(input())
x = a + b
xb = b
for i in range(n):
    if s[i] == "c" or x == 0:
        print("No")
    else:
        if s[i] == "b":
            if xb == 0:
                print("No")
            else:
                print("Yes")
                x -= 1
                xb -= 1
        else:
            print("Yes")
            x -= 1

Submission status: Accepted

Solution code:
n,nai,out=map(int,input().split())
b=input()
kokunai=0
kaigai=0
for i in range(n):
  if(b[i]=='c'):
    print('No')
  elif(b[i]=='a'):
    if(kokunai+kaigai>=nai+out):
      print('No')
    else:
      kokunai=kokunai+1
      print('Yes')
  else:
    if(kokunai+kaigai>=nai+out or kaigai>=out):
      print('No')
    else:
      print('Yes')
      kaigai=kaigai+1

Submission status: Accepted

Solution code:
N, A, B = tuple(map(int, input().split()))
S = input()
cutline = A + B
qualified = 0
foreigner = 0

for i in range(len(S)):
    c = S[i]
    if c == "a":
        if qualified < cutline:
            print("Yes")
            qualified += 1
        else:
            print("No")
    
    elif c == "b":
        if (qualified < cutline) and (foreigner < B):
            print("Yes")
            qualified += 1
        else:
            print("No")
        
        foreigner += 1
    
    else:
        print("No")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def main():
    from builtins import int, map, list, print
    import sys
    sys.setrecursionlimit(10 ** 6)

    input = sys.stdin.readline
    input_list = (lambda: input().rstrip().split())
    input_number = (lambda: int(input()))
    input_number_list = (lambda: list(map(int, input_list())))

    N, A, B = input_number_list()
    S = input()
    total = 0
    total_f = 0
    for c in S[:-1]:
        isNg = False
        if c == 'a' and total < A + B:
            total += 1
        elif c == 'b' and total < A + B and total_f < B:
            total += 1
            total_f += 1
        else:
            isNg = True
        print('YNeos'[isNg::2])


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N, A, B = MAP()
S = input()
f = 0
passed = 0
for i, s in enumerate(S):
	if s == "b":
		f += 1
	if s == "a" and passed < A+B:
		print("Yes")
		passed += 1
	elif s == "b" and passed < A+B and f <= B:
		print("Yes")
		passed += 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]=="c":
        print("No")
    elif S[i]=="a":
        if (a+b)<(A+B):
            print("Yes")
            a+=1
        else:
            print("No")
    elif S[i]=="b":
        if (a+b)<(A+B) and b+1<=B:
            print("Yes")
            b+=1
        else:
            print("No")

Submission status: Accepted

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

Submission status: Accepted

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

for i in range(N):
    if S[i]=="c":
        print("No")
    elif S[i]=="a" and passnumber<A+B:
        print("Yes")
        passnumber+=1
        #print("passnumber is "+str(passnumber))
        
    elif S[i]=="b" and passnumber<A+B and Bnumber<B:
        print("Yes")
        Bnumber+=1
        passnumber+=1
        #print("Bnumber is "+str(Bnumber))
    else:
        print("No")

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline

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

    c_all = 0
    c_b = 0

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


if __name__ == '__main__':
    main()

Submission status: Accepted

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

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

    elif s[i] == 'b':
        b = b - 1
        if b >= 0:
            a_b = a_b - 1
            if a_b >= 0:
                print('Yes')
            else:
                print('No')
        else:
            print('No')

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

Submission status: Accepted

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

Submission status: Accepted

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

all_cnt, for_cnt = 0, 0
for i in s:
    if i == 'a':
        if all_cnt < a+b:
            print('Yes')
            all_cnt += 1
        else:
            print('No')
    elif i == 'b':
        if all_cnt < a+b:
            if for_cnt < b:
                print('Yes')
                all_cnt += 1
                for_cnt += 1
            else:
                print('No')
        else:
            print('No')
    else:
        print('No')

Submission status: Accepted

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

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

Submission status: Accepted

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

for s in S:
    if M <= 0:
        print("No")
    elif s == "a":
        print("Yes")
        M -= 1
    elif s == "b":
        if B <= 0:
            print("No")
        else:
            print("Yes")
            M -= 1
            B -= 1
    else:
        print("No")

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from statistics import median
#import collections
#aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]
from itertools import combinations # (string,3) 3回
from collections import deque
from collections import defaultdict
from fractions import gcd
import bisect
#
#    d = m - k[i] - k[j]
#    if kk[bisect.bisect_right(kk,d) - 1] == d:
#
#
#
# pythonで無理なときは、pypyでやると正解するかも！！
#
#

import sys
sys.setrecursionlimit(10000000)
mod = 10**9 + 7

def readInts():
  return list(map(int,input().split()))
def main():
    n,a,b = readInts()
    S = input()
    ab = a + b
    passed = 0
    ovs = 1
    for i in range(n):
        if S[i] == 'a':# 国内
            if passed < ab:
                print('Yes')
                passed += 1
            else:
                print('No')
        if S[i] == 'b':
            if passed < ab and ovs <= b:
                print('Yes')
                passed += 1
                ovs += 1
            else:
                print('No')
        if S[i] == 'c':
            print('No')

if __name__ == '__main__':
  main()

Submission status: Accepted

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