結果

問題 No.1994 Confusing Name
ユーザー kakel-san
提出日時 2023-09-27 21:53:43
言語 C#(csc)
(csc 3.9.0)
結果
TLE  
実行時間 -
コード長 1,062 bytes
コンパイル時間 874 ms
コンパイル使用メモリ 108,288 KB
実行使用メモリ 32,512 KB
最終ジャッジ日時 2024-07-20 16:21:56
合計ジャッジ時間 8,459 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 9 TLE * 2 -- * 17
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

using System;
using static System.Console;
using System.Linq;
using System.Collections.Generic;
class Program
{
    static int NN => int.Parse(ReadLine());
    static int[] NList => ReadLine().Split().Select(int.Parse).ToArray();
    static string[] SList(long n) => Enumerable.Repeat(0, (int)n).Select(_ => ReadLine()).ToArray();
    public static void Main()
    {
        Solve();
    }
    static void Solve()
    {
        var n = NN;
        var s = SList(n);
        var set = new HashSet<string>(s);
        var ans = new int[n];
        for (var i = 0; i < n; ++i)
        {
            var ch = s[i].ToCharArray();
            for (var j = 0; j < ch.Length; ++j)
            {
                for (var c = 'a'; c <= 'z'; ++c)
                {
                    if (s[i][j] == c) continue;
                    ch[j] = c;
                    if (set.Contains(string.Concat(ch))) ++ans[i];
                }
                ch[j] = s[i][j];
            }
        }
        WriteLine(string.Join("\n", ans));
    }
}
0