Submission #1725888


Source Code Expand

package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

func main() {
	fsc := NewFastScanner()
	N, A, B := fsc.NextInt(), fsc.NextInt(), fsc.NextInt()
	S := fsc.Next()
	passed := 0
	rank := 0
	for i := 0; i < N; i++ {
		if S[i] == 'a' {
			if passed < A+B {
				fmt.Println("Yes")
				passed++
			} else {
				fmt.Println("No")
			}
		} else if S[i] == 'b' {
			rank++
			if passed < A+B && rank <= B {
				fmt.Println("Yes")

				passed++
			} else {
				fmt.Println("No")
			}

		} else {
			fmt.Println("No")
		}
	}
}

//template
type FastScanner struct {
	r   *bufio.Reader
	buf []byte
	p   int
}

func NewFastScanner() *FastScanner {
	rdr := bufio.NewReaderSize(os.Stdin, 1024)
	return &FastScanner{r: rdr}
}
func (s *FastScanner) Next() string {
	s.pre()
	start := s.p
	for ; s.p < len(s.buf); s.p++ {
		if s.buf[s.p] == ' ' {
			break
		}
	}
	result := string(s.buf[start:s.p])
	s.p++
	return result
}
func (s *FastScanner) NextLine() string {
	s.pre()
	start := s.p
	s.p = len(s.buf)
	return string(s.buf[start:])
}
func (s *FastScanner) NextInt() int {
	v, _ := strconv.Atoi(s.Next())
	return v
}
func (s *FastScanner) NextInt64() int64 {
	v, _ := strconv.ParseInt(s.Next(), 10, 64)
	return v
}

func (s *FastScanner) pre() {
	if s.p >= len(s.buf) {
		s.readLine()
		s.p = 0
	}
}
func (s *FastScanner) readLine() {
	s.buf = make([]byte, 0)
	for {
		l, p, e := s.r.ReadLine()
		if e != nil {
			panic(e)
		}
		s.buf = append(s.buf, l...)
		if !p {
			break
		}
	}
}

//Max,Min
func IntMax(a, b int) int {
	if a < b {
		return b
	}
	return a
}

func Int64Max(a, b int64) int64 {
	if a < b {
		return b
	}
	return a
}
func Float64Max(a, b float64) float64 {
	if a < b {
		return b
	}
	return a
}

func IntMin(a, b int) int {
	if a > b {
		return b
	}
	return a
}

func Int64Min(a, b int64) int64 {
	if a > b {
		return b
	}
	return a
}
func Float64Min(a, b float64) float64 {
	if a > b {
		return b
	}
	return a
}

//Gcd
func IntGcd(a, b int) int {
	if a < b {
		b, a = a, b
	}
	if b == 0 {
		return a
	}
	return IntGcd(b, a%b)
}
func Int64Gcd(a, b int64) int64 {
	if a < b {
		b, a = a, b
	}
	if b == 0 {
		return a
	}
	return Int64Gcd(b, a%b)
}

func IntAbs(a int) int {
	if a < 0 {
		a *= -1
	}
	return a
}

func Int64Abs(a int64) int64 {
	if a < 0 {
		a *= -1
	}
	return a
}

Submission Info

Submission Time
Task B - Qualification simulator
User togatoga
Language Go (1.6)
Score 200
Code Size 2459 Byte
Status AC
Exec Time 210 ms
Memory 3328 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 200 / 200
Status
AC × 3
AC × 13
Set Name Test Cases
Sample s1.txt, s2.txt, s3.txt
All 01.txt, 02.txt, 03.txt, 04.txt, 05.txt, 06.txt, 07.txt, 08.txt, 09.txt, 10.txt, s1.txt, s2.txt, s3.txt
Case Name Status Exec Time Memory
01.txt AC 207 ms 3200 KB
02.txt AC 210 ms 3200 KB
03.txt AC 208 ms 3200 KB
04.txt AC 208 ms 3200 KB
05.txt AC 181 ms 2816 KB
06.txt AC 208 ms 3200 KB
07.txt AC 209 ms 3328 KB
08.txt AC 208 ms 3328 KB
09.txt AC 206 ms 3200 KB
10.txt AC 209 ms 3200 KB
s1.txt AC 1 ms 640 KB
s2.txt AC 1 ms 640 KB
s3.txt AC 1 ms 640 KB