結果

問題 No.482 あなたの名は
ユーザー tsuchinagatsuchinaga
提出日時 2019-03-07 10:07:25
言語 Go
(1.22.1)
結果
WA  
実行時間 -
コード長 483 bytes
コンパイル時間 11,728 ms
コンパイル使用メモリ 213,384 KB
実行使用メモリ 5,616 KB
最終ジャッジ日時 2023-09-05 19:20:17
合計ジャッジ時間 13,415 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

package main

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

func main() {
	var n, k int
	_, _ = fmt.Scan(&n, &k)
	l := make([]int, n)

	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)

	for i := range l {
		sc.Scan()
		l[i], _ = strconv.Atoi(sc.Text())
	}

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

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