結果

問題 No.1994 Confusing Name
ユーザー mmn15277198mmn15277198
提出日時 2022-07-31 13:53:52
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 545 ms / 2,000 ms
コード長 499 bytes
コンパイル時間 1,605 ms
コンパイル使用メモリ 174,176 KB
実行使用メモリ 30,308 KB
最終ジャッジ日時 2023-09-28 04:07:31
合計ジャッジ時間 9,387 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 1 ms
4,380 KB
testcase_04 AC 2 ms
4,376 KB
testcase_05 AC 3 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 6 ms
4,380 KB
testcase_10 AC 4 ms
4,380 KB
testcase_11 AC 4 ms
4,380 KB
testcase_12 AC 358 ms
20,520 KB
testcase_13 AC 482 ms
28,364 KB
testcase_14 AC 515 ms
29,444 KB
testcase_15 AC 395 ms
25,308 KB
testcase_16 AC 336 ms
22,316 KB
testcase_17 AC 402 ms
24,824 KB
testcase_18 AC 526 ms
29,996 KB
testcase_19 AC 522 ms
30,044 KB
testcase_20 AC 545 ms
30,308 KB
testcase_21 AC 73 ms
8,124 KB
testcase_22 AC 34 ms
5,884 KB
testcase_23 AC 447 ms
24,984 KB
testcase_24 AC 424 ms
24,192 KB
testcase_25 AC 244 ms
16,816 KB
testcase_26 AC 106 ms
9,824 KB
testcase_27 AC 372 ms
22,376 KB
testcase_28 AC 252 ms
17,804 KB
testcase_29 AC 25 ms
5,396 KB
testcase_30 AC 290 ms
19,236 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<string> s(n);
  map<string, int> mp;
  for (int i = 0; i < n; i++) {
    cin >> s[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 += max(0, mp[t] - 1);
    }
    cout << ans << endl;
  }
  return 0;
}
0