結果

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

テストケース

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

ソースコード

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 = cnt/2 + 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