結果

問題 No.1994 Confusing Name
ユーザー polyesterpolyester
提出日時 2022-07-01 23:35:15
言語 C++17(clang)
(17.0.6 + boost 1.83.0)
結果
AC  
実行時間 776 ms / 2,000 ms
コード長 822 bytes
コンパイル時間 1,806 ms
コンパイル使用メモリ 145,956 KB
実行使用メモリ 30,464 KB
最終ジャッジ日時 2024-05-04 18:05:44
合計ジャッジ時間 13,060 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 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 4 ms
5,376 KB
testcase_06 AC 7 ms
5,376 KB
testcase_07 AC 3 ms
5,376 KB
testcase_08 AC 5 ms
5,376 KB
testcase_09 AC 7 ms
5,376 KB
testcase_10 AC 4 ms
5,376 KB
testcase_11 AC 4 ms
5,376 KB
testcase_12 AC 523 ms
20,608 KB
testcase_13 AC 714 ms
28,672 KB
testcase_14 AC 718 ms
29,696 KB
testcase_15 AC 563 ms
25,472 KB
testcase_16 AC 483 ms
22,656 KB
testcase_17 AC 552 ms
24,832 KB
testcase_18 AC 766 ms
30,208 KB
testcase_19 AC 769 ms
30,464 KB
testcase_20 AC 776 ms
30,336 KB
testcase_21 AC 101 ms
8,448 KB
testcase_22 AC 42 ms
5,872 KB
testcase_23 AC 635 ms
25,344 KB
testcase_24 AC 610 ms
24,576 KB
testcase_25 AC 335 ms
16,896 KB
testcase_26 AC 149 ms
10,112 KB
testcase_27 AC 559 ms
22,656 KB
testcase_28 AC 376 ms
18,176 KB
testcase_29 AC 32 ms
5,504 KB
testcase_30 AC 433 ms
19,584 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
using ll = long long;
int main() {
  int n;
  cin >> n;
  vector<string> vs(n);
  map<string, int> mp;
  for(int i = 0; i < n; i++) {
    cin >> vs[i];
  }
  vector<int> ans(n, 0);
  for(int i = 0; i < n; i++) {
    for(int j = 0; j < vs[i].size(); j++) {
      string tmp = vs[i];
      tmp[j] = '.';
      mp[tmp]++;
    }
  }
  for(int i = 0; i < n; i++) {
    for(int j = 0; j < vs[i].size(); j++) {
      string tmp = vs[i];
      tmp[j] = '.';
      ans[i] += mp[tmp] - 1;
    }
  }
  for(int i = 0; i < n; i++) {
    cout << ans[i] << endl;
  }
  return 0;
}
0