結果

問題 No.1994 Confusing Name
ユーザー kokatsukokatsu
提出日時 2022-07-01 22:21:23
言語 D
(dmd 2.106.1)
結果
AC  
実行時間 295 ms / 2,000 ms
コード長 619 bytes
コンパイル時間 1,973 ms
コンパイル使用メモリ 200,264 KB
実行使用メモリ 34,712 KB
最終ジャッジ日時 2023-09-04 17:38:30
合計ジャッジ時間 6,723 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 1 ms
4,380 KB
testcase_04 AC 1 ms
4,376 KB
testcase_05 AC 3 ms
4,380 KB
testcase_06 AC 4 ms
4,380 KB
testcase_07 AC 2 ms
4,380 KB
testcase_08 AC 4 ms
4,384 KB
testcase_09 AC 5 ms
4,380 KB
testcase_10 AC 3 ms
4,376 KB
testcase_11 AC 3 ms
4,376 KB
testcase_12 AC 163 ms
28,060 KB
testcase_13 AC 265 ms
34,452 KB
testcase_14 AC 265 ms
33,780 KB
testcase_15 AC 190 ms
31,192 KB
testcase_16 AC 163 ms
28,076 KB
testcase_17 AC 183 ms
30,880 KB
testcase_18 AC 286 ms
34,084 KB
testcase_19 AC 295 ms
34,712 KB
testcase_20 AC 276 ms
32,904 KB
testcase_21 AC 45 ms
10,804 KB
testcase_22 AC 24 ms
8,796 KB
testcase_23 AC 212 ms
30,632 KB
testcase_24 AC 185 ms
30,572 KB
testcase_25 AC 124 ms
26,476 KB
testcase_26 AC 65 ms
11,072 KB
testcase_27 AC 181 ms
29,388 KB
testcase_28 AC 140 ms
26,256 KB
testcase_29 AC 16 ms
6,388 KB
testcase_30 AC 153 ms
26,544 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import std;

struct User {
    ulong len;
    string a, b;
}

void main() {
    int N;
    readf("%d\n", N);

    auto S = new string[](N);
    int[User] cnts;
    foreach (i; 0 .. N) {
        S[i] = readln.chomp;
        auto len = S[i].length;
        foreach (j; 0 .. len) {
            auto t = User(len, S[i][0..j], S[i][j+1..len]);
            ++cnts[t];
        }
    }

    foreach (s; S) {
        int res;

        auto len = s.length;
        foreach (i; 0 .. len) {
            auto t = User(len, s[0..i], s[i+1..len]);
            if (t in cnts) res += cnts[t] - 1;
        }

        res.writeln;
    }
}
0