結果

問題 No.1994 Confusing Name
ユーザー nystnyst
提出日時 2022-07-02 14:33:31
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 557 ms / 2,000 ms
コード長 615 bytes
コンパイル時間 871 ms
コンパイル使用メモリ 89,660 KB
実行使用メモリ 30,188 KB
最終ジャッジ日時 2023-08-18 05:31:18
合計ジャッジ時間 10,593 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 1 ms
4,376 KB
testcase_05 AC 4 ms
4,380 KB
testcase_06 AC 6 ms
4,380 KB
testcase_07 AC 2 ms
4,380 KB
testcase_08 AC 5 ms
4,380 KB
testcase_09 AC 7 ms
4,380 KB
testcase_10 AC 4 ms
4,380 KB
testcase_11 AC 4 ms
4,376 KB
testcase_12 AC 371 ms
20,500 KB
testcase_13 AC 499 ms
28,496 KB
testcase_14 AC 503 ms
29,344 KB
testcase_15 AC 407 ms
25,328 KB
testcase_16 AC 332 ms
22,352 KB
testcase_17 AC 399 ms
24,800 KB
testcase_18 AC 524 ms
30,016 KB
testcase_19 AC 557 ms
30,176 KB
testcase_20 AC 508 ms
30,188 KB
testcase_21 AC 73 ms
8,532 KB
testcase_22 AC 34 ms
5,596 KB
testcase_23 AC 423 ms
24,848 KB
testcase_24 AC 405 ms
24,200 KB
testcase_25 AC 290 ms
16,672 KB
testcase_26 AC 124 ms
9,848 KB
testcase_27 AC 458 ms
22,312 KB
testcase_28 AC 279 ms
17,720 KB
testcase_29 AC 27 ms
5,464 KB
testcase_30 AC 309 ms
19,204 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);
    for(int i=0;i<n;i++) cin >> s[i];
    map<string,int> mp;
    
    for(int i=0;i<n;i++){
        for(int j=0;j<s[i].size();j++){
            string t = s[i];
            t[j] = '.';
            mp[t]++;
        }
    }
    
    for(int i=0;i<n;i++){
        int ans =0;
        for(int j=0;j<s[i].size();j++){
            string t = s[i];
            t[j] = '.';
            ans += mp[t] - 1;
        }
        cout << ans << endl;
    }
}
0