Submission #62028002


Source Code Expand

package main

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

func main() { solve(os.Stdin, os.Stdout) }

func solve(_r io.Reader, _w io.Writer) {
	in, out := bufio.NewReader(_r), bufio.NewWriter(_w)
	defer out.Flush()

	a := readNNums(in, 5)
	s := ""
	for _, x := range a {
		s += strconv.Itoa(x)
	}
	if s == "21345" || s == "13245" || s == "12435" || s == "12354" {
		fmt.Fprintln(out, "Yes")
	} else {
		fmt.Fprintln(out, "No")
	}
}

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

func readInt(bytes []byte, from int, val *int) int {
	i := from
	sign := 1
	if bytes[i] == '-' {
		sign = -1
		i++
	}
	tmp := 0
	for i < len(bytes) && bytes[i] >= '0' && bytes[i] <= '9' {
		tmp = tmp*10 + int(bytes[i]-'0')
		i++
	}
	*val = tmp * sign
	return i
}

func readNum(reader *bufio.Reader) (a int) {
	bs, _ := reader.ReadBytes('\n')
	readInt(bs, 0, &a)
	return
}

func readTwoNums(reader *bufio.Reader) (a int, b int) {
	res := readNNums(reader, 2)
	a, b = res[0], res[1]
	return
}

func readThreeNums(reader *bufio.Reader) (a int, b int, c int) {
	res := readNNums(reader, 3)
	a, b, c = res[0], res[1], res[2]
	return
}

func readNNums(reader *bufio.Reader, n int) []int {
	res := make([]int, n)
	x := 0
	bs, _ := reader.ReadBytes('\n')
	for i := 0; i < n; i++ {
		for x < len(bs) && (bs[x] < '0' || bs[x] > '9') && bs[x] != '-' {
			x++
		}
		x = readInt(bs, x, &res[i])
	}
	return res
}

Submission Info

Submission Time
Task A - 12435
User xylu
Language Go (go 1.20.6)
Score 150
Code Size 1485 Byte
Status AC
Exec Time 1 ms
Memory 1624 KiB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 150 / 150
Status
AC × 4
AC × 15
Set Name Test Cases
Sample 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt, 00_sample_03.txt
All 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt, 00_sample_03.txt, 01_handmade_00.txt, 01_handmade_01.txt, 01_handmade_02.txt, 02_Yes_00.txt, 02_Yes_01.txt, 03_No_00.txt, 03_No_01.txt, 03_No_02.txt, 03_No_03.txt, 03_No_04.txt, 03_No_05.txt
Case Name Status Exec Time Memory
00_sample_00.txt AC 1 ms 1616 KiB
00_sample_01.txt AC 0 ms 1616 KiB
00_sample_02.txt AC 0 ms 1620 KiB
00_sample_03.txt AC 0 ms 1616 KiB
01_handmade_00.txt AC 0 ms 1620 KiB
01_handmade_01.txt AC 0 ms 1616 KiB
01_handmade_02.txt AC 0 ms 1620 KiB
02_Yes_00.txt AC 0 ms 1616 KiB
02_Yes_01.txt AC 0 ms 1620 KiB
03_No_00.txt AC 0 ms 1616 KiB
03_No_01.txt AC 1 ms 1624 KiB
03_No_02.txt AC 0 ms 1616 KiB
03_No_03.txt AC 0 ms 1616 KiB
03_No_04.txt AC 0 ms 1620 KiB
03_No_05.txt AC 0 ms 1624 KiB