結果

問題 No.1994 Confusing Name
ユーザー umimelumimel
提出日時 2023-02-20 12:30:45
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 313 ms / 2,000 ms
コード長 964 bytes
コンパイル時間 2,026 ms
コンパイル使用メモリ 173,744 KB
実行使用メモリ 27,852 KB
最終ジャッジ日時 2023-09-28 11:28:48
合計ジャッジ時間 6,888 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 3 ms
4,380 KB
testcase_07 AC 2 ms
4,380 KB
testcase_08 AC 3 ms
4,376 KB
testcase_09 AC 3 ms
4,380 KB
testcase_10 AC 2 ms
4,376 KB
testcase_11 AC 2 ms
4,380 KB
testcase_12 AC 185 ms
19,924 KB
testcase_13 AC 254 ms
26,536 KB
testcase_14 AC 253 ms
27,196 KB
testcase_15 AC 223 ms
23,828 KB
testcase_16 AC 176 ms
21,500 KB
testcase_17 AC 206 ms
23,228 KB
testcase_18 AC 313 ms
27,596 KB
testcase_19 AC 270 ms
27,804 KB
testcase_20 AC 265 ms
27,852 KB
testcase_21 AC 26 ms
7,912 KB
testcase_22 AC 13 ms
5,576 KB
testcase_23 AC 213 ms
23,816 KB
testcase_24 AC 223 ms
22,992 KB
testcase_25 AC 107 ms
15,564 KB
testcase_26 AC 43 ms
9,348 KB
testcase_27 AC 189 ms
21,544 KB
testcase_28 AC 136 ms
19,124 KB
testcase_29 AC 11 ms
5,204 KB
testcase_30 AC 155 ms
19,184 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pll = pair<ll, ll>;
#define drep(i, cc, n) for (int i = (cc); i <= (n); ++i)
#define rep(i, n) drep(i, 0, n - 1)
#define all(a) (a).begin(), (a).end()
#define pb push_back
#define fi first
#define se second

const ll MOD = 1000000007;
const ll MOD2 = 998244353;
const ll INF = 1LL << 60;
const ll MAX_N = 2e5;

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

    unordered_map<string, int> mp;
    rep(i, N){
        rep(j, (ll)S[i].size()){
            char tmp = S[i][j];
            S[i][j]='.';
            mp[S[i]]++;
            S[i][j] = tmp;
        }
    }

    rep(i, N){
        int ans = 0;
        rep(j, (int)S[i].size()){
            char tmp = S[i][j];
            S[i][j]='.';
            ans += mp[S[i]]-1;
            S[i][j]=tmp;
        }
        cout << ans << '\n';
    }
}
0