結果

問題 No.69 文字を自由に並び替え
ユーザー tyochiaityochiai
提出日時 2015-02-08 07:09:11
言語 Go
(1.22.1)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 484 bytes
コンパイル時間 13,078 ms
コンパイル使用メモリ 215,908 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-08-20 22:45:34
合計ジャッジ時間 13,884 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 1 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 AC 1 ms
4,376 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 1 ms
4,380 KB
testcase_10 AC 1 ms
4,380 KB
testcase_11 AC 1 ms
4,376 KB
testcase_12 AC 2 ms
4,376 KB
testcase_13 AC 2 ms
4,384 KB
testcase_14 AC 1 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

package main

import (
	"fmt"
	"sort"
)

type RuneSlice []rune

func (p RuneSlice) Less(i, j int) bool {
	return p[i] < p[j]
}

func (p RuneSlice) Len() int {
	return len(p)
}

func (p RuneSlice) Swap(i, j int) {
	p[i], p[j] = p[j], p[i]
}

func resolve(A, B RuneSlice) string {
	sort.Sort(A)
	sort.Sort(B)
	if string(A) == string(B) {
		return "YES"
	}
	return "NO"
}

func main() {
	var A, B string
	fmt.Scanf("%s\n%s\n", &A, &B)
	fmt.Println(resolve(RuneSlice(A), RuneSlice(B)))
}
0