結果

問題 No.1994 Confusing Name
ユーザー Nzt3Nzt3
提出日時 2022-07-01 21:56:20
言語 C++17
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 1,845 ms / 2,000 ms
コード長 674 bytes
コンパイル時間 2,783 ms
コンパイル使用メモリ 211,888 KB
実行使用メモリ 5,424 KB
最終ジャッジ日時 2023-08-17 09:30:30
合計ジャッジ時間 27,800 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 2 ms
4,376 KB
testcase_05 AC 8 ms
4,376 KB
testcase_06 AC 20 ms
4,376 KB
testcase_07 AC 4 ms
4,376 KB
testcase_08 AC 14 ms
4,376 KB
testcase_09 AC 21 ms
4,380 KB
testcase_10 AC 10 ms
4,380 KB
testcase_11 AC 9 ms
4,380 KB
testcase_12 AC 1,447 ms
5,188 KB
testcase_13 AC 1,845 ms
5,160 KB
testcase_14 AC 1,746 ms
5,140 KB
testcase_15 AC 1,426 ms
4,868 KB
testcase_16 AC 1,226 ms
4,628 KB
testcase_17 AC 1,395 ms
4,716 KB
testcase_18 AC 1,829 ms
5,424 KB
testcase_19 AC 1,836 ms
5,252 KB
testcase_20 AC 1,842 ms
5,356 KB
testcase_21 AC 315 ms
4,376 KB
testcase_22 AC 140 ms
4,376 KB
testcase_23 AC 1,594 ms
5,292 KB
testcase_24 AC 1,543 ms
5,176 KB
testcase_25 AC 979 ms
4,480 KB
testcase_26 AC 453 ms
4,376 KB
testcase_27 AC 1,437 ms
5,060 KB
testcase_28 AC 1,026 ms
4,580 KB
testcase_29 AC 109 ms
4,380 KB
testcase_30 AC 1,136 ms
4,648 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
//これ想定じゃないだろ
int main(){
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int N;
  cin>>N;
  vector<pair<string,int>>S(N);
  for(int i=0;i<N;i++)cin>>S[i].first,S[i].second=i;
  sort(S.begin(),S.end());
  vector<int>ans(N);
  for(int i=0;i<N;i++){
    string T=S[i].first;
    for(int j=0;j<S[i].first.size();j++){
      for(int k=0;k<26;k++){
        if(S[i].first[j]-'a'==k)continue;
        T[j]='a'+k;
        auto it=lower_bound(S.begin(),S.end(),make_pair(T,-1));
        if(it!=S.end()&&(*it).first==T)++ans[S[i].second];
      }
      T[j]=S[i].first[j];
    }
  }
  for(int i:ans)cout<<i<<'\n';
}
0