結果

問題 No.1994 Confusing Name
ユーザー Sugam Kumar
提出日時 2022-07-01 22:00:09
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
TLE  
実行時間 -
コード長 723 bytes
コンパイル時間 1,921 ms
コンパイル使用メモリ 176,844 KB
実行使用メモリ 342,784 KB
最終ジャッジ日時 2024-11-26 05:02:46
合計ジャッジ時間 53,351 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 12 TLE * 16
権限があれば一括ダウンロードができます

ソースコード

diff #

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

#define int      long long
#define all(xs)   xs.begin(), xs.end()
#define make_unique(x) sort(all((x))); (x).resize(unique(all((x))) - (x).begin())

signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  map<string , int> mp;
  vector<string> a(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    mp[a[i]]++;
  }

  for (int i = 0; i < n; i++) {
    int ans = 0;
    string s = a[i];
    for (int j = 0; j < a[i].size(); j++) {
      for (char a = 'a'; a <= 'z'; a++) {
        if (s[j] != a) {
          char old = s[j];
          s[j] = a;
          ans += mp[s];
          s[j] = old;
        }
      }
    }

    cout << ans << "\n";
  }
}
0