結果

問題 No.2715 Unique Chimatagram
ユーザー ks2mks2m
提出日時 2024-04-05 22:44:05
言語 Java21
(openjdk 21)
結果
AC  
実行時間 253 ms / 2,000 ms
コード長 761 bytes
コンパイル時間 2,793 ms
コンパイル使用メモリ 79,556 KB
実行使用メモリ 61,440 KB
最終ジャッジ日時 2024-04-05 22:44:20
合計ジャッジ時間 13,265 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 137 ms
57,968 KB
testcase_01 AC 130 ms
57,964 KB
testcase_02 AC 131 ms
57,832 KB
testcase_03 AC 133 ms
57,960 KB
testcase_04 AC 135 ms
57,984 KB
testcase_05 AC 138 ms
57,960 KB
testcase_06 AC 134 ms
57,972 KB
testcase_07 AC 120 ms
56,812 KB
testcase_08 AC 226 ms
61,284 KB
testcase_09 AC 231 ms
61,288 KB
testcase_10 AC 239 ms
61,240 KB
testcase_11 AC 229 ms
61,288 KB
testcase_12 AC 236 ms
61,228 KB
testcase_13 AC 229 ms
61,152 KB
testcase_14 AC 230 ms
59,552 KB
testcase_15 AC 230 ms
59,320 KB
testcase_16 AC 223 ms
61,252 KB
testcase_17 AC 232 ms
61,296 KB
testcase_18 AC 246 ms
61,192 KB
testcase_19 AC 244 ms
61,268 KB
testcase_20 AC 242 ms
61,384 KB
testcase_21 AC 241 ms
60,988 KB
testcase_22 AC 253 ms
61,192 KB
testcase_23 AC 239 ms
61,132 KB
testcase_24 AC 238 ms
61,424 KB
testcase_25 AC 248 ms
61,440 KB
testcase_26 AC 236 ms
61,244 KB
testcase_27 AC 241 ms
61,268 KB
testcase_28 AC 221 ms
60,444 KB
testcase_29 AC 222 ms
60,560 KB
testcase_30 AC 213 ms
60,416 KB
testcase_31 AC 226 ms
60,680 KB
testcase_32 AC 211 ms
58,608 KB
testcase_33 AC 129 ms
57,976 KB
testcase_34 AC 127 ms
56,124 KB
testcase_35 AC 130 ms
57,968 KB
testcase_36 AC 126 ms
57,856 KB
testcase_37 AC 130 ms
57,848 KB
testcase_38 AC 144 ms
58,188 KB
testcase_39 AC 212 ms
60,460 KB
testcase_40 AC 204 ms
60,984 KB
testcase_41 AC 233 ms
61,224 KB
testcase_42 AC 229 ms
61,060 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		char[][] s = new char[n][];
		for (int i = 0; i < n; i++) {
			s[i] = sc.next().toCharArray();
		}
		sc.close();

		Map<String, Integer> map = new HashMap<>();
		for (int i = 0; i < n; i++) {
			for (char c = 'a'; c <= 'z'; c++) {
				int len = s[i].length;
				char[] t = new char[len + 1];
				System.arraycopy(s[i], 0, t, 0, len);
				t[len] = c;
				Arrays.sort(t);
				String k = String.valueOf(t);
				map.put(k, map.getOrDefault(k, 0) + 1);
			}
		}
		for (String k : map.keySet()) {
			if (map.get(k) == 1) {
				System.out.println(k);
				return;
			}
		}
		System.out.println(-1);
	}
}
0