結果

問題 No.2715 Unique Chimatagram
ユーザー halhal
提出日時 2024-04-20 11:42:43
言語 Go
(1.22.1)
結果
WA  
実行時間 -
コード長 860 bytes
コンパイル時間 12,183 ms
コンパイル使用メモリ 229,860 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-04-20 11:42:58
合計ジャッジ時間 14,285 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,812 KB
testcase_01 AC 1 ms
6,816 KB
testcase_02 AC 1 ms
6,940 KB
testcase_03 AC 1 ms
6,940 KB
testcase_04 AC 1 ms
6,944 KB
testcase_05 AC 1 ms
6,940 KB
testcase_06 AC 1 ms
6,944 KB
testcase_07 AC 2 ms
6,940 KB
testcase_08 AC 8 ms
6,940 KB
testcase_09 AC 8 ms
6,944 KB
testcase_10 AC 8 ms
6,940 KB
testcase_11 AC 8 ms
6,940 KB
testcase_12 AC 8 ms
6,944 KB
testcase_13 AC 7 ms
6,948 KB
testcase_14 AC 7 ms
6,940 KB
testcase_15 AC 9 ms
6,940 KB
testcase_16 AC 7 ms
6,944 KB
testcase_17 AC 8 ms
6,940 KB
testcase_18 AC 12 ms
6,940 KB
testcase_19 AC 12 ms
6,940 KB
testcase_20 AC 12 ms
6,944 KB
testcase_21 AC 13 ms
6,944 KB
testcase_22 AC 13 ms
6,940 KB
testcase_23 AC 13 ms
6,944 KB
testcase_24 AC 12 ms
6,940 KB
testcase_25 AC 13 ms
6,940 KB
testcase_26 AC 13 ms
6,940 KB
testcase_27 AC 12 ms
6,940 KB
testcase_28 AC 8 ms
6,944 KB
testcase_29 AC 7 ms
6,940 KB
testcase_30 AC 8 ms
6,944 KB
testcase_31 AC 9 ms
6,944 KB
testcase_32 AC 8 ms
6,940 KB
testcase_33 AC 1 ms
6,944 KB
testcase_34 AC 1 ms
6,944 KB
testcase_35 AC 1 ms
6,944 KB
testcase_36 AC 1 ms
6,940 KB
testcase_37 WA -
testcase_38 AC 1 ms
6,944 KB
testcase_39 WA -
testcase_40 AC 3 ms
6,940 KB
testcase_41 AC 7 ms
6,940 KB
testcase_42 AC 13 ms
6,944 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

package main

import (
	"fmt"
	"sort"
)

func sum[T int | float64](nums []T) T {
	var sum T
	for _, n := range nums {
		sum += n
	}
	return sum
}

func reverse(s string) string {
	var r []rune = []rune(s)
	for i, j := 0, len(r)-1; i < j; i, j = i+1, j-1 {
		r[i], r[j] = r[j], r[i]
	}
	return string(r)
}

func main() {
	var N int
	fmt.Scan(&N)
	var S []string = make([]string, N)

	for i := 0; i < N; i++ {
		var t string
		fmt.Scan(&t)
		r := []rune(t)
		sort.Slice(r, func(i, j int) bool { return r[i] < r[j] })
		S[i] = string(r)
	}

	sort.Slice(S, func(i, j int) bool { return S[i] < S[j] })

	var not_ans []bool = make([]bool, N)
	for i := 0; i < N-1; i++ {
		if S[i] == S[i+1] {
			not_ans[i] = true
			not_ans[i+1] = true
		}
	}

	for i, v := range not_ans {
		if !v {
			fmt.Println(S[i] + string([]rune(S[i])[0]))
			return
		}
	}
	fmt.Println(-1)
}
0