結果

問題 No.2715 Unique Chimatagram
ユーザー halhal
提出日時 2024-04-20 17:43:34
言語 Go
(1.22.1)
結果
AC  
実行時間 36 ms / 2,000 ms
コード長 801 bytes
コンパイル時間 12,600 ms
コンパイル使用メモリ 217,848 KB
実行使用メモリ 6,656 KB
最終ジャッジ日時 2024-04-20 17:43:51
合計ジャッジ時間 15,112 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
5,248 KB
testcase_01 AC 1 ms
5,248 KB
testcase_02 AC 1 ms
5,376 KB
testcase_03 AC 1 ms
5,376 KB
testcase_04 AC 2 ms
5,376 KB
testcase_05 AC 2 ms
5,376 KB
testcase_06 AC 1 ms
5,376 KB
testcase_07 AC 1 ms
5,376 KB
testcase_08 AC 27 ms
6,528 KB
testcase_09 AC 28 ms
6,528 KB
testcase_10 AC 27 ms
6,528 KB
testcase_11 AC 28 ms
6,528 KB
testcase_12 AC 27 ms
6,528 KB
testcase_13 AC 25 ms
6,528 KB
testcase_14 AC 24 ms
6,400 KB
testcase_15 AC 26 ms
6,528 KB
testcase_16 AC 27 ms
6,528 KB
testcase_17 AC 27 ms
6,528 KB
testcase_18 AC 36 ms
6,656 KB
testcase_19 AC 34 ms
6,656 KB
testcase_20 AC 36 ms
6,656 KB
testcase_21 AC 34 ms
6,656 KB
testcase_22 AC 36 ms
6,656 KB
testcase_23 AC 34 ms
6,656 KB
testcase_24 AC 34 ms
6,656 KB
testcase_25 AC 35 ms
6,656 KB
testcase_26 AC 34 ms
6,656 KB
testcase_27 AC 34 ms
6,656 KB
testcase_28 AC 21 ms
5,376 KB
testcase_29 AC 21 ms
5,376 KB
testcase_30 AC 20 ms
5,376 KB
testcase_31 AC 21 ms
5,376 KB
testcase_32 AC 21 ms
5,376 KB
testcase_33 AC 1 ms
5,376 KB
testcase_34 AC 1 ms
5,376 KB
testcase_35 AC 1 ms
5,376 KB
testcase_36 AC 1 ms
5,376 KB
testcase_37 AC 2 ms
5,376 KB
testcase_38 AC 2 ms
5,376 KB
testcase_39 AC 11 ms
5,376 KB
testcase_40 AC 11 ms
5,376 KB
testcase_41 AC 25 ms
5,632 KB
testcase_42 AC 27 ms
5,376 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)
		S[i] = t
	}


	encount_str := make(map[string]int)
	for _, v := range S {
		for i := 0; i < 26; i++ {
			s := v + string(rune('a' + i))
			r := []rune(s)
			sort.Slice(r, func(i, j int) bool { return r[i] < r[j] })
			s = string(r)
			encount_str[s]++
		}
	}
	
	for k, v := range encount_str {
		if v == 1 {
			fmt.Println(k)
			return
		}
	}
	fmt.Println(-1)
}
0