結果

問題 No.482 あなたの名は
ユーザー tsuchinagatsuchinaga
提出日時 2019-03-07 10:02:11
言語 Go
(1.22.1)
結果
WA  
実行時間 -
コード長 557 bytes
コンパイル時間 11,505 ms
コンパイル使用メモリ 206,368 KB
実行使用メモリ 18,256 KB
最終ジャッジ日時 2023-09-05 19:20:03
合計ジャッジ時間 13,909 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,688 KB
testcase_01 AC 2 ms
5,688 KB
testcase_02 AC 2 ms
5,692 KB
testcase_03 AC 2 ms
5,688 KB
testcase_04 AC 2 ms
5,688 KB
testcase_05 AC 3 ms
5,688 KB
testcase_06 AC 3 ms
5,688 KB
testcase_07 AC 2 ms
5,700 KB
testcase_08 AC 2 ms
5,696 KB
testcase_09 AC 2 ms
5,696 KB
testcase_10 AC 2 ms
5,696 KB
testcase_11 WA -
testcase_12 AC 3 ms
5,700 KB
testcase_13 AC 3 ms
5,696 KB
testcase_14 WA -
testcase_15 AC 42 ms
17,380 KB
testcase_16 WA -
testcase_17 WA -
testcase_18 AC 42 ms
18,252 KB
testcase_19 WA -
testcase_20 AC 42 ms
18,252 KB
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 AC 42 ms
17,380 KB
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 AC 42 ms
17,380 KB
testcase_29 AC 16 ms
17,368 KB
testcase_30 AC 2 ms
5,688 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

package main

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

func main() {
	var n, k int
	_, _ = fmt.Scan(&n, &k)

	rdr := bufio.NewReaderSize(os.Stdin, 10000000)
	line, _, _ := rdr.ReadLine()

	l := make([]int, 0)
	for _, c := range strings.Split(string(line), " ") {
		a, _ := strconv.Atoi(c)
		l = append(l, a)
	}

	var cnt int
	sort.Slice(l, func(i, j int) bool {
		if l[i] < l[j] {
			cnt++
			return true
		}
		return false
	})

	// fmt.Println(cnt, k, l)

	if (k-cnt)%2 == 0 {
		fmt.Println("YES")
	} else {
		fmt.Println("NO")
	}
}
0