Submission #73238736


Source Code Expand

package main

import (
	"cmp"
	"fmt"
	"io"
	"math"
	"os"
	"reflect"
	"strconv"
	"unsafe"
)

type unsigned_integer interface {
	~uint | ~uint8 | ~uint16 | ~uint32 | ~uint64
}

type signed_integer interface {
	~int | ~int8 | ~int16 | ~int32 | ~int64
}

type integer interface {
	signed_integer | unsigned_integer
}

type real interface {
	integer |
		~float32 | ~float64
}

type complex interface {
	real |
		~complex64 | ~complex128
}
type void struct{}

type numeric_limits[T integer] struct{}

func limit[T integer]() numeric_limits[T] {
	return struct{}{}
}

func (numeric_limits[T]) max() T {
	var z T
	if (^z) < 0 {
		b := uint(unsafe.Sizeof(z) * 8)
		u := uint(1)<<(b-1) - 1
		return T(u)
	} else {
		return ^z
	}
}

func (numeric_limits[T]) min() T {
	var z T
	if (^z) < 0 {
		b := uint(unsafe.Sizeof(z) * 8)
		u := uint(1) << (b - 1)
		return T(-int(u))
	}
	return 0
}

func to_string[T any](e T) string {
	return fmt.Sprintf("%v", e)
}

func to_int[T integer](s string) T {
	x, _ := strconv.Atoi(s)
	return T(x)
}

func ckmax[T cmp.Ordered](x *T, y T) {
	*x = max(*x, y)
}

func ckmin[T cmp.Ordered](x *T, y T) {
	*x = min(*x, y)
}

func sum[T complex, E ~[]T](v E) T {
	var s T
	for _, w := range v {
		s += w
	}
	return s
}

func presum[T complex, E ~[]T](v E) E {
	p := make(E, len(v)+1)
	for i, w := range v {
		p[i+1] = p[i] + w
	}
	return p
}

func count[T comparable, E ~[]T](v E, e T) int {
	cnt := 0
	for _, w := range v {
		if w == e {
			cnt++
		}
	}
	return cnt
}

func cond[T any](cond bool, x, y T) T {
	if cond {
		return x
	}
	return y
}

type scannable interface {
	scan(func(...any))
}

type writable interface {
	format() []byte
}

type fastio struct {
	in         io.Reader
	out        io.Writer
	rbuf, wbuf []byte
	i, n       int
	fpc        int
}

func new_fastio(in io.Reader, out io.Writer) *fastio {
	return &fastio{in, out, make([]byte, 4096), make([]byte, 0), 0, 0, -1}
}

func new_std_fastio() *fastio {
	return new_fastio(os.Stdin, os.Stdout)
}

func (fastio *fastio) __read_byte() byte {
	if fastio.i == fastio.n {
		fastio.n, _ = fastio.in.Read(fastio.rbuf)
		if fastio.n == 0 {
			return 0
		}
		fastio.i = 0
	}
	b := fastio.rbuf[fastio.i]
	fastio.i++
	return b
}

func (fastio *fastio) read(ptrs ...any) {
	var rd func(v reflect.Value)
	rd = func(v reflect.Value) {
		for i := 0; i < v.Len(); i++ {
			elem := v.Index(i)
			if elem.Kind() == reflect.Slice {
				rd(elem)
			} else {
				fastio.read(elem.Addr().Interface())
			}
		}
	}
	read_unsigned := func() uint {
		var x uint
		b := fastio.__read_byte()
		for ; '0' > b || b > '9'; b = fastio.__read_byte() {
			if b == 0 {
				return x
			}
		}
		for ; '0' <= b && b <= '9'; b = fastio.__read_byte() {
			x = x*10 + uint(b&15)
		}
		return x
	}
	read_signed := func() int {
		var y uint
		var x int
		neg := false
		b := fastio.__read_byte()
		for ; '0' > b || b > '9'; b = fastio.__read_byte() {
			if b == 0 {
				return x
			}
			if b == '-' {
				neg = true
			}
		}
		for ; '0' <= b && b <= '9'; b = fastio.__read_byte() {
			y = y*10 + uint(b&15)
		}
		if neg {
			if y == math.MaxInt+1 {
				x = math.MinInt
			} else {
				x = -int(y)
			}
		} else {
			x = int(y)
		}
		return x
	}
	read_float := func() float64 {
		b := fastio.__read_byte()
		var s []byte
		for ; b == ' ' || b == '\n' || b == '\r' || b == '\t'; b = fastio.__read_byte() {
		}
		for ; !(b == ' ' || b == '\n' || b == '\r' || b == '\t' || b == 0); b = fastio.__read_byte() {
			s = append(s, b)
		}
		w, _ := strconv.ParseFloat(string(s), 64)
		return w
	}
	for _, p := range ptrs {
		switch v := any(p).(type) {
		case *uint:
			*v = read_unsigned()
		case *uint8:
			*v = uint8(read_unsigned())
		case *uint16:
			*v = uint16(read_unsigned())
		case *uint32:
			*v = uint32(read_unsigned())
		case *uint64:
			*v = uint64(read_unsigned())
		case *int:
			*v = read_signed()
		case *int8:
			*v = int8(read_signed())
		case *int16:
			*v = int16(read_signed())
		case *int32:
			*v = int32(read_signed())
		case *int64:
			*v = int64(read_signed())
		case *float32:
			*v = float32(read_float())
		case *float64:
			*v = read_float()
		case *string:
			{
				b := fastio.__read_byte()
				var s []byte
				for ; b == ' ' || b == '\n' || b == '\r'; b = fastio.__read_byte() {
				}
				for ; !(b == ' ' || b == '\n' || b == '\r' || b == 0); b = fastio.__read_byte() {
					s = append(s, b)
				}
				*v = string(s)
			}
		default:
			if v, ok := p.(scannable); ok {
				v.scan(fastio.read)
			} else {
				rv := reflect.ValueOf(p)
				if rv.Kind() == reflect.Ptr && (rv.Elem().Kind() == reflect.Slice || rv.Elem().Kind() == reflect.Array) {
					rd(rv.Elem())
				}
			}
		}
	}
}

func (fastio *fastio) write(a ...any) {
	unsigned_to_string := func(v uint64) []byte {
		var s []byte
		if v == 0 {
			return []byte{'0'}
		}
		for v > 0 {
			s = append(s, '0'+byte(v%10))
			v /= 10
		}
		for i := 0; i < len(s)/2; i++ {
			s[i], s[len(s)-1-i] = s[len(s)-1-i], s[i]
		}
		return s
	}
	signed_to_string := func(v int64) []byte {
		if v == 0 {
			return []byte{'0'}
		}
		if v == math.MinInt64 {
			return []byte("-9223372036854775808")
		}
		neg := v < 0
		if neg {
			v = -v
		}
		var s []byte
		for v > 0 {
			s = append(s, '0'+byte(v%10))
			v /= 10
		}
		if neg {
			s = append(s, '-')
		}
		for i := 0; i < len(s)/2; i++ {
			s[i], s[len(s)-1-i] = s[len(s)-1-i], s[i]
		}
		return s
	}

	for i, p := range a {
		if i != 0 {
			fastio.wbuf = append(fastio.wbuf, ' ')
		}
		switch v := p.(type) {
		case uint:
			fastio.wbuf = append(fastio.wbuf, unsigned_to_string(uint64(v))...)
		case uint8:
			fastio.wbuf = append(fastio.wbuf, unsigned_to_string(uint64(v))...)
		case uint16:
			fastio.wbuf = append(fastio.wbuf, unsigned_to_string(uint64(v))...)
		case uint32:
			fastio.wbuf = append(fastio.wbuf, unsigned_to_string(uint64(v))...)
		case uint64:
			fastio.wbuf = append(fastio.wbuf, unsigned_to_string(v)...)

		case int:
			fastio.wbuf = append(fastio.wbuf, signed_to_string(int64(v))...)
		case int8:
			fastio.wbuf = append(fastio.wbuf, signed_to_string(int64(v))...)
		case int16:
			fastio.wbuf = append(fastio.wbuf, signed_to_string(int64(v))...)
		case int32:
			fastio.wbuf = append(fastio.wbuf, signed_to_string(int64(v))...)
		case int64:
			fastio.wbuf = append(fastio.wbuf, signed_to_string(v)...)

		case float32:
			fastio.wbuf = append(fastio.wbuf, []byte(strconv.FormatFloat(float64(v), 'f', fastio.fpc, 64))...)
		case float64:
			fastio.wbuf = append(fastio.wbuf, []byte(strconv.FormatFloat(v, 'f', fastio.fpc, 64))...)
		case string:
			fastio.wbuf = append(fastio.wbuf, v...)
		default:
			if v, ok := p.(writable); ok {
				fastio.wbuf = append(fastio.wbuf, v.format()...)
			} else {
				rv := reflect.ValueOf(p)
				if rv.Kind() == reflect.Slice || rv.Kind() == reflect.Array {
					if rv.Type().Elem().Kind() == reflect.Slice {
						for j := 0; j < rv.Len(); j++ {
							if j+1 == rv.Len() {
								fastio.write(rv.Index(j).Interface())
							} else {
								fastio.writeln(rv.Index(j).Interface())
							}
						}
					} else {
						for j := 0; j < rv.Len(); j++ {
							if j != 0 {
								fastio.wbuf = append(fastio.wbuf, ' ')
							}
							fastio.write(rv.Index(j).Interface())
						}
					}
				}
			}
		}
	}
}

func (fastio *fastio) set_precision(x int) {
	fastio.fpc = x
}

func (fastio *fastio) writeln(a ...any) {
	fastio.write(a...)
	fastio.write("\n")
}
func (fastio *fastio) flush() {
	fastio.out.Write(fastio.wbuf)
	fastio.wbuf = fastio.wbuf[:0]
}
func (fastio *fastio) close() {
	fastio.flush()
}

var stdio = new_std_fastio()
var read = stdio.read
var write = stdio.write
var writeln = stdio.writeln
var flush = stdio.flush

func solve() {
	var n, s, t int
	read(&n, &s, &t)
	a := make([]int, n)
	read(&a)
	ans := (t - s) * 60
	for _, x := range a {
		ans -= x
	}
	if ans >= 0 {
		writeln("Yes")
	} else {
		writeln("No")
	}

}
func main() {
	var t int
	t = 1
	// read(&t)
	for ; t > 0; t-- {
		solve()
	}
	flush()
}

Submission Info

Submission Time
Task A - Preparations Before Departure
User xiaoe
Language Go (go 1.25.1)
Score 200
Code Size 8359 Byte
Status AC
Exec Time 1 ms
Memory 1680 KiB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 200 / 200
Status
AC × 3
AC × 63
Set Name Test Cases
Sample sample01.txt, sample02.txt, sample03.txt
All sample01.txt, sample02.txt, sample03.txt, in01.txt, in02.txt, in03.txt, in04.txt, in05.txt, in06.txt, in07.txt, in08.txt, in09.txt, in10.txt, in11.txt, in12.txt, in13.txt, in14.txt, in15.txt, in16.txt, in17.txt, in18.txt, in19.txt, in20.txt, in21.txt, in22.txt, in23.txt, in24.txt, in25.txt, in26.txt, in27.txt, in28.txt, in29.txt, in30.txt, in31.txt, in32.txt, in33.txt, in34.txt, in35.txt, in36.txt, in37.txt, in38.txt, in39.txt, in40.txt, in41.txt, in42.txt, in43.txt, in44.txt, in45.txt, in46.txt, in47.txt, in48.txt, in49.txt, in50.txt, in51.txt, in52.txt, in53.txt, in54.txt, in55.txt, in56.txt, in57.txt, in58.txt, in59.txt, in60.txt
Case Name Status Exec Time Memory
in01.txt AC 1 ms 1680 KiB
in02.txt AC 1 ms 1680 KiB
in03.txt AC 1 ms 1680 KiB
in04.txt AC 1 ms 1680 KiB
in05.txt AC 1 ms 1680 KiB
in06.txt AC 1 ms 1680 KiB
in07.txt AC 1 ms 1680 KiB
in08.txt AC 1 ms 1680 KiB
in09.txt AC 1 ms 1680 KiB
in10.txt AC 1 ms 1680 KiB
in11.txt AC 1 ms 1680 KiB
in12.txt AC 1 ms 1680 KiB
in13.txt AC 1 ms 1680 KiB
in14.txt AC 1 ms 1680 KiB
in15.txt AC 1 ms 1680 KiB
in16.txt AC 1 ms 1680 KiB
in17.txt AC 1 ms 1680 KiB
in18.txt AC 1 ms 1680 KiB
in19.txt AC 1 ms 1680 KiB
in20.txt AC 1 ms 1680 KiB
in21.txt AC 1 ms 1680 KiB
in22.txt AC 1 ms 1680 KiB
in23.txt AC 1 ms 1680 KiB
in24.txt AC 1 ms 1680 KiB
in25.txt AC 1 ms 1680 KiB
in26.txt AC 1 ms 1680 KiB
in27.txt AC 1 ms 1680 KiB
in28.txt AC 1 ms 1680 KiB
in29.txt AC 1 ms 1680 KiB
in30.txt AC 1 ms 1680 KiB
in31.txt AC 1 ms 1680 KiB
in32.txt AC 1 ms 1680 KiB
in33.txt AC 1 ms 1680 KiB
in34.txt AC 1 ms 1680 KiB
in35.txt AC 1 ms 1680 KiB
in36.txt AC 1 ms 1680 KiB
in37.txt AC 1 ms 1680 KiB
in38.txt AC 1 ms 1680 KiB
in39.txt AC 1 ms 1680 KiB
in40.txt AC 1 ms 1680 KiB
in41.txt AC 1 ms 1680 KiB
in42.txt AC 1 ms 1680 KiB
in43.txt AC 1 ms 1680 KiB
in44.txt AC 1 ms 1680 KiB
in45.txt AC 1 ms 1680 KiB
in46.txt AC 1 ms 1680 KiB
in47.txt AC 1 ms 1680 KiB
in48.txt AC 1 ms 1680 KiB
in49.txt AC 1 ms 1680 KiB
in50.txt AC 1 ms 1680 KiB
in51.txt AC 1 ms 1680 KiB
in52.txt AC 1 ms 1680 KiB
in53.txt AC 1 ms 1680 KiB
in54.txt AC 1 ms 1680 KiB
in55.txt AC 1 ms 1680 KiB
in56.txt AC 1 ms 1680 KiB
in57.txt AC 1 ms 1680 KiB
in58.txt AC 1 ms 1680 KiB
in59.txt AC 1 ms 1680 KiB
in60.txt AC 1 ms 1680 KiB
sample01.txt AC 1 ms 1680 KiB
sample02.txt AC 1 ms 1680 KiB
sample03.txt AC 1 ms 1680 KiB