結果

問題 No.1994 Confusing Name
ユーザー titan23titan23
提出日時 2022-07-01 22:38:48
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 1,667 ms / 2,000 ms
コード長 623 bytes
コンパイル時間 2,432 ms
コンパイル使用メモリ 209,096 KB
実行使用メモリ 8,832 KB
最終ジャッジ日時 2024-05-04 17:00:50
合計ジャッジ時間 24,087 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 1 ms
5,376 KB
testcase_04 AC 2 ms
5,376 KB
testcase_05 AC 7 ms
5,376 KB
testcase_06 AC 14 ms
5,376 KB
testcase_07 AC 4 ms
5,376 KB
testcase_08 AC 11 ms
5,376 KB
testcase_09 AC 15 ms
5,376 KB
testcase_10 AC 8 ms
5,376 KB
testcase_11 AC 7 ms
5,376 KB
testcase_12 AC 1,449 ms
8,576 KB
testcase_13 AC 1,667 ms
8,832 KB
testcase_14 AC 1,500 ms
8,448 KB
testcase_15 AC 1,201 ms
7,552 KB
testcase_16 AC 1,011 ms
7,040 KB
testcase_17 AC 1,156 ms
7,552 KB
testcase_18 AC 1,551 ms
8,576 KB
testcase_19 AC 1,628 ms
8,704 KB
testcase_20 AC 1,583 ms
8,832 KB
testcase_21 AC 251 ms
5,376 KB
testcase_22 AC 111 ms
5,376 KB
testcase_23 AC 1,406 ms
8,448 KB
testcase_24 AC 1,407 ms
8,576 KB
testcase_25 AC 791 ms
6,528 KB
testcase_26 AC 374 ms
5,376 KB
testcase_27 AC 1,343 ms
8,192 KB
testcase_28 AC 878 ms
6,784 KB
testcase_29 AC 81 ms
5,376 KB
testcase_30 AC 1,022 ms
7,168 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