結果

問題 No.1994 Confusing Name
ユーザー titan23titan23
提出日時 2022-07-01 22:38:48
言語 C++17
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 1,671 ms / 2,000 ms
コード長 623 bytes
コンパイル時間 2,109 ms
コンパイル使用メモリ 207,436 KB
実行使用メモリ 8,828 KB
最終ジャッジ日時 2023-08-17 10:11:58
合計ジャッジ時間 24,173 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 2 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,380 KB
testcase_07 AC 4 ms
4,380 KB
testcase_08 AC 11 ms
4,376 KB
testcase_09 AC 16 ms
4,376 KB
testcase_10 AC 8 ms
4,376 KB
testcase_11 AC 7 ms
4,380 KB
testcase_12 AC 1,388 ms
8,568 KB
testcase_13 AC 1,671 ms
8,828 KB
testcase_14 AC 1,509 ms
8,364 KB
testcase_15 AC 1,211 ms
7,260 KB
testcase_16 AC 1,086 ms
6,756 KB
testcase_17 AC 1,184 ms
7,260 KB
testcase_18 AC 1,592 ms
8,576 KB
testcase_19 AC 1,606 ms
8,576 KB
testcase_20 AC 1,599 ms
8,580 KB
testcase_21 AC 259 ms
4,380 KB
testcase_22 AC 114 ms
4,376 KB
testcase_23 AC 1,420 ms
8,320 KB
testcase_24 AC 1,407 ms
8,320 KB
testcase_25 AC 820 ms
6,552 KB
testcase_26 AC 378 ms
4,888 KB
testcase_27 AC 1,307 ms
8,052 KB
testcase_28 AC 913 ms
6,772 KB
testcase_29 AC 86 ms
4,376 KB
testcase_30 AC 1,006 ms
7,000 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

void solve() {
  string alp = "abcdefghijklmnopqrstuvwxyz";
  int n;
  cin >> n;
  vector<string> S(n);
  set<string> st;
  for (int i = 0; i < n; i++) {
    string s;
    cin >> s;
    S[i] = s;
    st.insert(s);
  }
  for (string &s : S) {
    int ans = 0;
    for (int i = 0; i < s.size(); i++) {
      for (char &c : alp) {
        if (s[i] == c) continue;
        string t = s;
        t[i] = c;
        if (st.count(t)) ans++;
      }
    }
    cout << ans << "\n";
  }
  


  return;
}

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  solve();
  return 0;
}
0