結果

問題 No.1994 Confusing Name
ユーザー umezoumezo
提出日時 2022-07-02 02:28:06
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 655 ms / 2,000 ms
コード長 615 bytes
コンパイル時間 3,171 ms
コンパイル使用メモリ 209,356 KB
実行使用メモリ 34,176 KB
最終ジャッジ日時 2023-08-17 14:32:25
合計ジャッジ時間 11,872 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 1 ms
4,380 KB
testcase_04 AC 1 ms
4,380 KB
testcase_05 AC 4 ms
4,380 KB
testcase_06 AC 7 ms
4,376 KB
testcase_07 AC 3 ms
4,376 KB
testcase_08 AC 6 ms
4,380 KB
testcase_09 AC 8 ms
4,380 KB
testcase_10 AC 4 ms
4,380 KB
testcase_11 AC 4 ms
4,376 KB
testcase_12 AC 472 ms
24,192 KB
testcase_13 AC 639 ms
32,344 KB
testcase_14 AC 597 ms
33,148 KB
testcase_15 AC 490 ms
28,116 KB
testcase_16 AC 410 ms
25,212 KB
testcase_17 AC 469 ms
27,892 KB
testcase_18 AC 641 ms
33,924 KB
testcase_19 AC 655 ms
34,028 KB
testcase_20 AC 651 ms
34,176 KB
testcase_21 AC 89 ms
9,104 KB
testcase_22 AC 42 ms
6,192 KB
testcase_23 AC 518 ms
28,744 KB
testcase_24 AC 538 ms
27,896 KB
testcase_25 AC 369 ms
19,268 KB
testcase_26 AC 140 ms
11,316 KB
testcase_27 AC 493 ms
26,036 KB
testcase_28 AC 337 ms
20,504 KB
testcase_29 AC 33 ms
5,740 KB
testcase_30 AC 370 ms
22,048 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define ALL(v) v.begin(),v.end()
typedef long long ll;
 
#include<bits/stdc++.h>
using namespace std;
 
int main(){
  ios::sync_with_stdio(false);
  std::cin.tie(nullptr);
  
  int n;
  cin>>n;
  vector<string> S(n);
  rep(i,n) cin>>S[i];
  map<string,int> M,MM;
  rep(i,n){
    int a=S[i].size();
    rep(j,a){
      string s=S[i];
      s[j]='$';
      M[s]++;
    }
    MM[S[i]]++;
  }
  
  rep(i,n){
    int a=S[i].size();
    int ans=0;
    rep(j,a){
      string s=S[i];
      s[j]='$';
      ans+=M[s]-MM[S[i]];
    }
    cout<<ans<<endl;
  }
      
  return 0;
}
0