結果

問題 No.1994 Confusing Name
ユーザー nystnyst
提出日時 2022-07-02 13:53:07
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 1,927 ms / 2,000 ms
コード長 730 bytes
コンパイル時間 1,092 ms
コンパイル使用メモリ 91,552 KB
実行使用メモリ 8,680 KB
最終ジャッジ日時 2023-08-18 04:51:05
合計ジャッジ時間 24,202 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 1 ms
4,380 KB
testcase_04 AC 2 ms
4,376 KB
testcase_05 AC 6 ms
4,376 KB
testcase_06 AC 13 ms
4,376 KB
testcase_07 AC 3 ms
4,380 KB
testcase_08 AC 10 ms
4,376 KB
testcase_09 AC 13 ms
4,376 KB
testcase_10 AC 7 ms
4,380 KB
testcase_11 AC 6 ms
4,376 KB
testcase_12 AC 1,824 ms
8,660 KB
testcase_13 AC 1,927 ms
8,652 KB
testcase_14 AC 1,553 ms
8,280 KB
testcase_15 AC 1,226 ms
7,284 KB
testcase_16 AC 1,035 ms
6,740 KB
testcase_17 AC 1,205 ms
7,188 KB
testcase_18 AC 1,646 ms
8,584 KB
testcase_19 AC 1,607 ms
8,556 KB
testcase_20 AC 1,639 ms
8,680 KB
testcase_21 AC 238 ms
4,432 KB
testcase_22 AC 103 ms
4,380 KB
testcase_23 AC 1,446 ms
8,404 KB
testcase_24 AC 1,424 ms
8,388 KB
testcase_25 AC 781 ms
6,548 KB
testcase_26 AC 349 ms
5,120 KB
testcase_27 AC 1,307 ms
7,752 KB
testcase_28 AC 865 ms
6,508 KB
testcase_29 AC 79 ms
4,380 KB
testcase_30 AC 992 ms
7,016 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);
    vector<map<string,int>> mp(11);
    for(int i=0;i<n;i++){
        cin >> s[i];
        mp[s[i].size()][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;
                int sz = (int)s[i].size();
                t[j] = k;
                auto itr = mp[sz].find(t);
                if(itr!=mp[sz].end()) ans+=mp[sz][t];
            }
        }
        cout << ans << endl;
    }
}
0