結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 2 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,384 KB
testcase_07 AC 5 ms
4,376 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 3 ms
4,380 KB
testcase_11 AC 4 ms
4,376 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,417 ms
10,300 KB
testcase_17 AC 1,402 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,411 ms
10,304 KB
testcase_25 AC 1,412 ms
10,304 KB
testcase_26 WA -
testcase_27 WA -
testcase_28 AC 1,410 ms
10,304 KB
testcase_29 AC 1,401 ms
10,308 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("YES")
	} else {
		fmt.Println("NO")
	}
}
0