結果

問題 No.1994 Confusing Name
ユーザー zawakasu
提出日時 2022-07-20 19:47:05
言語 C++17(gcc12)
(gcc 12.3.0 + boost 1.87.0)
結果
TLE  
(最新)
AC  
(最初)
実行時間 -
コード長 1,661 bytes
コンパイル時間 14,691 ms
コンパイル使用メモリ 288,628 KB
最終ジャッジ日時 2025-01-30 11:18:45
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 18 TLE * 10
権限があれば一括ダウンロードができます

ソースコード

diff #

#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
// #include <atcoder/modint>
// #include <atcoder/fenwicktree>
// #include <atcoder/segtree>
// #include <atcoder/scc>

#define int long long
#define all(x) begin(x), end(x)

using namespace std;
// using namespace atcoder;
// using mint = modint998244353;
// using mint = modint1000000007;
using ld = long double;
using pii = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using vp = vector<pii>;
using vvp = vector<vp>;
using vs = vector<string>;
using vvc = vector<vector<char>>;

void debug(vector<int> a) {
    for (auto x : a) cout << x << ' ';
    cout << endl;
}

void debug(vector<vector<int>> a) {
    for (auto y : a) debug(y);
}

template <typename T1, typename T2>
inline bool chmax(T1 &a, T2 b) {return a < b and (a = b, true);}

template <typename T1, typename T2>
inline bool chmin(T1 &a, T2 b) {return a > b and (a = b, true);}

const int supl = LONG_LONG_MAX - 100;

void main_() {
    int n; cin >> n;
    map<string, int> mp;
    vs ss(n);
    for (auto& s : ss) cin >> s;
    for (auto s : ss) mp[s]++;

    vi anses(n);
    for (int i = 0 ; i < n ; i++) {
        for (auto& c : ss[i]) {
            char origin = c;
            for (char t = 'a' ; t <= 'z' ; t++) if (t != origin) {
                c = t;
                if (mp.count(ss[i])) anses[i] += mp[ss[i]];
            }
            c = origin;
        }
    }

    for (auto ans : anses) cout << ans << endl;
}

signed main() {
    ios::sync_with_stdio(false);
    std::cin.tie(nullptr);

    main_();

    return 0;
}
0