結果

問題 No.1994 Confusing Name
ユーザー rogi52
提出日時 2022-10-03 23:37:42
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 1,383 ms / 2,000 ms
コード長 670 bytes
コンパイル時間 2,335 ms
コンパイル使用メモリ 205,068 KB
最終ジャッジ日時 2025-02-07 21:02:48
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 28
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(0);
    
    int N; cin >> N;
    vector<string> S(N);
    rep(i,N) cin >> S[i];

    auto T = S;
    sort(T.begin(), T.end());
    rep(i,N) {
        int ans = 0;
        rep(j,int(S[i].size())) {
            for(char c = 'a'; c <= 'z'; c++) {
                if(S[i][j] != c) {
                    swap(S[i][j], c);
                    ans += binary_search(T.begin(), T.end(), S[i]);
                    swap(S[i][j], c);
                }
            }
        }
        cout << ans << "\n";
    }
}
0