結果

問題 No.482 あなたの名は
ユーザー fmhrfmhr
提出日時 2017-02-10 23:20:45
言語 Go
(1.22.1)
結果
WA  
実行時間 -
コード長 416 bytes
コンパイル時間 10,681 ms
コンパイル使用メモリ 209,860 KB
実行使用メモリ 10,320 KB
最終ジャッジ日時 2023-08-28 08:56:03
合計ジャッジ時間 32,890 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

package main

import (
	"fmt"
	"sort"
)

func main() {
	var N, K int
	fmt.Scan(&N, &K)
	D := make([]int, N)
	d := make([]int, N)
	for i := 0; i < N; i++ {
		fmt.Scan(&D[i])
		d[i] = D[i]
	}
	sort.Ints(d)
	var cnt int
	for i := 0; i < N; i++ {
		if D[i] != d[i] {
			cnt++
		}
	}
	cnt /= 2
	// fmt.Println(cnt, K)
	// fmt.Println(cnt%2, K%2)
	if cnt%2 != K%2 {
		fmt.Println("NO")
	} else {
		fmt.Println("YES")
	}
}
0