結果

問題 No.1994 Confusing Name
ユーザー nystnyst
提出日時 2022-07-02 13:17:22
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 1,994 ms / 2,000 ms
コード長 655 bytes
コンパイル時間 1,123 ms
コンパイル使用メモリ 90,140 KB
実行使用メモリ 8,648 KB
最終ジャッジ日時 2023-08-18 04:09:51
合計ジャッジ時間 25,610 ms
ジャッジサーバーID
(参考情報)
judge13 / 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 2 ms
4,376 KB
testcase_04 AC 1 ms
4,380 KB
testcase_05 AC 8 ms
4,376 KB
testcase_06 AC 16 ms
4,380 KB
testcase_07 AC 4 ms
4,376 KB
testcase_08 AC 12 ms
4,380 KB
testcase_09 AC 17 ms
4,380 KB
testcase_10 AC 8 ms
4,376 KB
testcase_11 AC 7 ms
4,376 KB
testcase_12 AC 1,676 ms
8,516 KB
testcase_13 AC 1,994 ms
8,632 KB
testcase_14 AC 1,602 ms
8,260 KB
testcase_15 AC 1,269 ms
7,324 KB
testcase_16 AC 1,083 ms
6,724 KB
testcase_17 AC 1,264 ms
7,528 KB
testcase_18 AC 1,692 ms
8,520 KB
testcase_19 AC 1,696 ms
8,644 KB
testcase_20 AC 1,708 ms
8,648 KB
testcase_21 AC 284 ms
4,420 KB
testcase_22 AC 126 ms
4,376 KB
testcase_23 AC 1,566 ms
8,404 KB
testcase_24 AC 1,563 ms
8,300 KB
testcase_25 AC 890 ms
6,452 KB
testcase_26 AC 426 ms
4,872 KB
testcase_27 AC 1,453 ms
8,160 KB
testcase_28 AC 995 ms
6,440 KB
testcase_29 AC 93 ms
4,376 KB
testcase_30 AC 1,087 ms
7,208 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <map>
using namespace std;

int main() {
    int n;cin>>n;
    vector<string> s(n);
    map<string,int> mp;
    
    for(int i=0;i<n;i++){
        cin >> s[i];
        mp[s[i]]++;
    }
    
    for(int i=0;i<n;i++){
        long long ans = 0;
        for(int j=0;j<s[i].size();j++){
            string t = s[i];
            for(char k = 'a';k<='z';k++){
                if(s[i][j]==k) continue;
                t[j] = k;
                auto itr = mp.find(t);
                if(itr!=mp.end()) ans+=mp[t];
            }
        }
        cout << ans << endl;
    }
}
0