結果

問題 No.1994 Confusing Name
ユーザー nyst
提出日時 2022-07-02 13:17:22
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
TLE  
(最新)
AC  
(最初)
実行時間 -
コード長 655 bytes
コンパイル時間 984 ms
コンパイル使用メモリ 90,284 KB
実行使用メモリ 8,832 KB
最終ジャッジ日時 2024-11-27 06:47:51
合計ジャッジ時間 25,844 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 27 TLE * 1
権限があれば一括ダウンロードができます

ソースコード

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