結果

問題 No.1994 Confusing Name
ユーザー mmn15277198mmn15277198
提出日時 2022-07-31 13:33:40
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 1,612 ms / 2,000 ms
コード長 667 bytes
コンパイル時間 1,803 ms
コンパイル使用メモリ 180,528 KB
実行使用メモリ 8,940 KB
最終ジャッジ日時 2023-09-28 04:06:25
合計ジャッジ時間 22,997 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 1 ms
4,376 KB
testcase_04 AC 1 ms
4,376 KB
testcase_05 AC 7 ms
4,376 KB
testcase_06 AC 14 ms
4,376 KB
testcase_07 AC 4 ms
4,380 KB
testcase_08 AC 11 ms
4,376 KB
testcase_09 AC 17 ms
4,376 KB
testcase_10 AC 7 ms
4,376 KB
testcase_11 AC 7 ms
4,376 KB
testcase_12 AC 1,342 ms
8,620 KB
testcase_13 AC 1,612 ms
8,716 KB
testcase_14 AC 1,444 ms
8,360 KB
testcase_15 AC 1,151 ms
7,572 KB
testcase_16 AC 983 ms
7,088 KB
testcase_17 AC 1,130 ms
7,580 KB
testcase_18 AC 1,531 ms
8,696 KB
testcase_19 AC 1,548 ms
8,940 KB
testcase_20 AC 1,552 ms
8,940 KB
testcase_21 AC 251 ms
4,436 KB
testcase_22 AC 108 ms
4,380 KB
testcase_23 AC 1,372 ms
8,288 KB
testcase_24 AC 1,361 ms
8,716 KB
testcase_25 AC 810 ms
6,464 KB
testcase_26 AC 365 ms
4,840 KB
testcase_27 AC 1,256 ms
8,044 KB
testcase_28 AC 878 ms
6,680 KB
testcase_29 AC 85 ms
4,376 KB
testcase_30 AC 973 ms
7,320 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<string> s(n);
  for (int i = 0; i < n; i++) {
    cin >> s[i];
  }
  set<string> st;
  map<int, int> mp;
  for (int i = 0; i < n; i++) {
    st.insert(s[i]);
    mp[(int)s[i].size()]++;
  }
  vector<int> ans(n, 0);
  for (int i = 0; i < n; i++) {
    if (mp[s[i].size()] <= 1) continue;
    for (int j = 0; j < s[i].size(); j++) {
      for (char c = 'a'; c <= 'z'; c++) {
        if (s[i][j] == c) continue;
        string t = s[i];
        t[j] = c;
        ans[i] += st.count(t);
      }
    }
  }
  for (int i = 0; i < n; i++) {
    cout << ans[i] << endl;
  }
  return 0;
}
0