結果

問題 No.482 あなたの名は
ユーザー tsuchinagatsuchinaga
提出日時 2019-03-07 09:39:19
言語 Go
(1.22.1)
結果
WA  
実行時間 -
コード長 470 bytes
コンパイル時間 12,159 ms
コンパイル使用メモリ 205,428 KB
実行使用メモリ 5,568 KB
最終ジャッジ日時 2023-09-05 19:19:36
合計ジャッジ時間 14,618 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 1 ms
4,380 KB
testcase_05 AC 2 ms
4,380 KB
testcase_06 AC 1 ms
4,376 KB
testcase_07 AC 1 ms
4,380 KB
testcase_08 AC 2 ms
4,380 KB
testcase_09 AC 2 ms
4,376 KB
testcase_10 AC 2 ms
4,376 KB
testcase_11 WA -
testcase_12 AC 1 ms
4,376 KB
testcase_13 AC 1 ms
4,380 KB
testcase_14 WA -
testcase_15 AC 41 ms
5,556 KB
testcase_16 WA -
testcase_17 WA -
testcase_18 AC 40 ms
5,556 KB
testcase_19 WA -
testcase_20 AC 41 ms
5,556 KB
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 AC 41 ms
5,556 KB
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 AC 41 ms
5,556 KB
testcase_29 AC 16 ms
5,552 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 {
		fmt.Println("YES")
	} else {
		fmt.Println("NO")
	}
}
0