結果

問題 No.1994 Confusing Name
ユーザー atjh16atjh16
提出日時 2022-08-11 23:29:47
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 718 ms / 2,000 ms
コード長 624 bytes
コンパイル時間 2,758 ms
コンパイル使用メモリ 212,912 KB
実行使用メモリ 30,780 KB
最終ジャッジ日時 2023-10-22 04:43:36
合計ジャッジ時間 13,691 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 3 ms
5,236 KB
testcase_01 AC 3 ms
5,236 KB
testcase_02 AC 3 ms
5,240 KB
testcase_03 AC 3 ms
5,232 KB
testcase_04 AC 3 ms
5,236 KB
testcase_05 AC 6 ms
5,416 KB
testcase_06 AC 8 ms
5,624 KB
testcase_07 AC 4 ms
5,316 KB
testcase_08 AC 8 ms
5,528 KB
testcase_09 AC 9 ms
5,668 KB
testcase_10 AC 6 ms
5,436 KB
testcase_11 AC 5 ms
5,416 KB
testcase_12 AC 481 ms
20,980 KB
testcase_13 AC 669 ms
29,084 KB
testcase_14 AC 666 ms
30,200 KB
testcase_15 AC 523 ms
26,084 KB
testcase_16 AC 456 ms
23,488 KB
testcase_17 AC 500 ms
25,652 KB
testcase_18 AC 689 ms
30,552 KB
testcase_19 AC 718 ms
30,704 KB
testcase_20 AC 707 ms
30,780 KB
testcase_21 AC 99 ms
10,000 KB
testcase_22 AC 43 ms
7,544 KB
testcase_23 AC 600 ms
25,704 KB
testcase_24 AC 580 ms
24,736 KB
testcase_25 AC 333 ms
17,944 KB
testcase_26 AC 141 ms
11,676 KB
testcase_27 AC 525 ms
23,172 KB
testcase_28 AC 362 ms
19,004 KB
testcase_29 AC 33 ms
7,240 KB
testcase_30 AC 403 ms
20,276 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

int n, m;
string s[50000];
map<string, int> Mp;

int main() {    
    cin >> n;

    for (int i = 0; i < n; i++) {
        cin >> s[i];

        for (int j = 0; j < s[i].size(); j++) {
            string t = s[i].substr(0, j) + "#" + s[i].substr(j + 1, s[i].size() - j - 1);

            Mp[t]++;
        }
    }

    for (int i = 0; i < n; i++) {
        m = 0;

        for (int j = 0; j < s[i].size(); j++) {
            string t = s[i].substr(0, j) + "#" + s[i].substr(j + 1, s[i].size() - j - 1);

            m += Mp[t] - 1;
        }

        cout << m << endl;
    }
}
0