結果
問題 | No.1994 Confusing Name |
ユーザー |
|
提出日時 | 2022-07-01 21:56:20 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 1,747 ms / 2,000 ms |
コード長 | 674 bytes |
コンパイル時間 | 2,152 ms |
コンパイル使用メモリ | 208,060 KB |
最終ジャッジ日時 | 2025-01-30 02:47:37 |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 28 |
ソースコード
#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';}