結果

問題 No.975 ミスターマックスバリュ
ユーザー kat0rik
提出日時 2020-02-01 21:11:08
言語 Go
(1.23.4)
結果
AC  
実行時間 6 ms / 2,000 ms
コード長 638 bytes
コンパイル時間 16,847 ms
コンパイル使用メモリ 226,824 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-09-18 20:19:59
合計ジャッジ時間 14,984 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 9
権限があれば一括ダウンロードができます

ソースコード

diff #

package main

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

func nextInt(sc *bufio.Scanner) int {
	sc.Scan()
	t, _ := strconv.Atoi(sc.Text())
	return t
}

func main() {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	X := nextInt(sc)
	N := nextInt(sc)
	M := nextInt(sc)
	var v int
	var ok1, ok2 bool
	for i := 0; i < N; i++ {
		v = nextInt(sc)
		if v == X {
			ok1 = true
		}
	}
	for i := 0; i < M; i++ {
		v = nextInt(sc)
		if v == X {
			ok2 = true
		}
	}
	var ans string
	if ok1 && ok2 {
		ans = "MrMaxValu"
	} else if ok1 {
		ans = "MrMax"
	} else if ok2 {
		ans = "MaxValu"
	} else {
		ans = "-1"
	}
	fmt.Println(ans)
}
0