結果

問題 No.1692 Expectations
ユーザー ccppjsrbccppjsrb
提出日時 2021-10-01 21:27:11
言語 Go
(1.22.1)
結果
WA  
実行時間 -
コード長 2,319 bytes
コンパイル時間 11,384 ms
コンパイル使用メモリ 212,532 KB
実行使用メモリ 16,544 KB
最終ジャッジ日時 2023-09-26 16:26:07
合計ジャッジ時間 12,820 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 1 ms
4,384 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 2 ms
4,380 KB
testcase_08 AC 2 ms
5,492 KB
testcase_09 AC 2 ms
5,492 KB
testcase_10 AC 16 ms
5,512 KB
testcase_11 AC 15 ms
5,512 KB
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 AC 54 ms
16,172 KB
testcase_20 WA -
testcase_21 AC 54 ms
16,544 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

package main

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

var iost *Iost

type Iost struct {
	Scanner *bufio.Scanner
	Writer  *bufio.Writer
}

func NewIost(fp io.Reader, wfp io.Writer) *Iost {
	const BufSize = 2000005
	scanner := bufio.NewScanner(fp)
	scanner.Split(bufio.ScanWords)
	scanner.Buffer(make([]byte, BufSize), BufSize)
	return &Iost{Scanner: scanner, Writer: bufio.NewWriter(wfp)}
}
func (i *Iost) Text() string {
	if !i.Scanner.Scan() {
		panic("scan failed")
	}
	return i.Scanner.Text()
}
func (i *Iost) Atoi(s string) int                 { x, _ := strconv.Atoi(s); return x }
func (i *Iost) GetNextInt() int                   { return i.Atoi(i.Text()) }
func (i *Iost) Atoi64(s string) int64             { x, _ := strconv.ParseInt(s, 10, 64); return x }
func (i *Iost) GetNextInt64() int64               { return i.Atoi64(i.Text()) }
func (i *Iost) Atof64(s string) float64           { x, _ := strconv.ParseFloat(s, 64); return x }
func (i *Iost) GetNextFloat64() float64           { return i.Atof64(i.Text()) }
func (i *Iost) Print(x ...interface{})            { fmt.Fprint(i.Writer, x...) }
func (i *Iost) Printf(s string, x ...interface{}) { fmt.Fprintf(i.Writer, s, x...) }
func (i *Iost) Println(x ...interface{})          { fmt.Fprintln(i.Writer, x...) }
func isLocal() bool                               { return os.Getenv("I") == "IronMan" }
func main() {
	fp := os.Stdin
	wfp := os.Stdout
	if isLocal() {
		fp, _ = os.Open(os.Getenv("END_GAME"))
	}
	iost = NewIost(fp, wfp)
	defer func() {
		if isLocal() {
			iost.Println(recover())
		}
		iost.Writer.Flush()
	}()
	solve()
	for i := 0; isLocal() && i < 100; i++ {
		iost.Println("-----------------------------------")
		solve()
	}
}
func solve() {
	n := iost.GetNextInt()
	_ = iost.GetNextInt()
	aa := make([]int, n)
	for i := 0; i < n; i++ {
		aa[i] = iost.GetNextInt()
	}
	bb := map[int]int{}
	for i := 0; i < n; i++ {
		if aa[i] > n {
			continue
		}
		bb[aa[i]]++
	}
	cnt := 0
	for a, c := range bb {
		if a > n {
			continue
		}
		cnt = max(cnt, c)
	}
	if cnt < n {
		iost.Println(fmt.Sprintf("%d %d", len(bb), 0))
		return
	}
	iost.Println(fmt.Sprintf("%d %d", len(bb), 1))
}
func max(a, b int) int {
	if a < b {
		return b
	}
	return a
}
func min(a, b int) int { return -max(-a, -b) }
func abs(a int) int    { return max(a, -a) }
0