結果

問題 No.1994 Confusing Name
ユーザー ChocolateCornetChocolateCornet
提出日時 2022-07-07 21:06:18
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 4,446 bytes
コンパイル時間 1,563 ms
コンパイル使用メモリ 177,712 KB
実行使用メモリ 239,932 KB
最終ジャッジ日時 2023-08-26 08:17:01
合計ジャッジ時間 5,766 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
8,752 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 1 ms
4,380 KB
testcase_04 AC 1 ms
4,380 KB
testcase_05 AC 24 ms
7,936 KB
testcase_06 AC 57 ms
13,156 KB
testcase_07 AC 11 ms
5,492 KB
testcase_08 AC 42 ms
10,736 KB
testcase_09 AC 65 ms
14,324 KB
testcase_10 AC 28 ms
8,356 KB
testcase_11 AC 26 ms
7,956 KB
testcase_12 TLE -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

//#include <bits/stdc++.h>
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>

#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
using namespace std;
using ll = long long;
#define _GLIBCXX_DEBUG
#define all(v) (v).begin(), (v).end()
#define rep(i, n) for(int i=0;i<n;++i)
using Graph = vector<vector<int>>;
ll MAX(ll x, ll y) {
    if (x >= y)return x;
    else return y;
}
ll MIN(ll x, ll y) {
    if (x >= y)return y;
    else return x;
}
ll gcd(ll x, ll y) {
    if (x < y)swap(x, y);
    if (y == 0)return x;
    return gcd(y, x % y);
}//最大公約数
ll lcm(ll a, ll b) {
    return (a / gcd(a, b)) * b;
}//最小公倍数
ll one_to_k(ll K) {
    return K * (K + 1) / 2;
}//1~Kまでの和
vector<pair<ll, ll>> prime_factorize(ll N) {
    vector<pair<ll, ll>>res;
    for (ll a = 2; a * a <= N; a++) {
        if (N % a != 0)continue;
        ll ex = 0;
        while (N % a == 0) {
            ex++;
            N /= a;
        }
        res.push_back({ a,ex });
    }
    if (N != 1)res.push_back({ N,1 });
    return res;
}//素因数分解O(√N)(素因数,指数)のpairの配列生成
//const auto &res = prime_factorize(N);
const ll INF = 7000000000000000000;
const ll inf = 1000000000 + 7;
ll MOD = 998244353;
// 定数
bool IsPrime(ll num) {
    if (num < 2) return false;
    else if (num == 2) return true;
    else if (num % 2 == 0) return false;
    double sqrtNum = sqrt(num);
    for (int i = 3; i <= sqrtNum; i += 2) {
        if (num % i == 0)return false;
    }
    return true;
}

long long pow_mod(long long x, long long n) {
    x %= MOD;
    long long ret = 1;
    while (n > 0) {
        if (n & 1) ret = (ret * x) % MOD;
        x = x * x % MOD;
        n >>= 1;
    }
    return ret;
}//繰り返し二乗法
long long nCr_mod(long long n, long long r) {
    long long x = 1, y = 1;
    for (int i = 0; i < r; i++) {
        x = x * (n - i) % MOD;
        y = y * (i + 1) % MOD;
    }
    return x * pow_mod(y, MOD - 2) % MOD;
}//nCrをMODで割った余りO(N)?
long long modinv(long long a, long long m) {
    long long b = m, u = 1, v = 0;
    while (b) {
        long long t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}//割り算のMOD(逆元)
//aをbで割ったやつをmで割った余りは、
//(a%m)*modinv(b,m)%m;
//#include <atcoder/all>
//using namespace atcoder;
//priority_queue<int, vector<int>, greater<int>> pq;


int N;
double dp[310][310][301];
bool seen[310][310][301];
double f(int a, int b, int c) {
    if (a + b + c == 0)return 0;
    if (seen[a][b][c])return dp[a][b][c];
    seen[a][b][c] = true;
    double ret = 0; 
    ret += N;
    if (a > 0)ret += ((double)f(a - 1, b, c) * a);
    if (b > 0)ret += (double)(f(a + 1, b - 1, c) * b);
    if (c > 0)ret += (double)(f(a, b + 1, c - 1) * c);
    ret /= (double)(N - (double)(N - a - b - c));
   
    cout << ret << endl;
    return dp[a][b][c] = ret;
}

int main() {
    //cout << fixed << setprecision(15);
    int N; cin >> N;
    vector<string>S(N);
    map<string, int>m;
    rep(i, N) {
        cin >> S[i];
        m[S[i]]++;
    }

    for (int i = 0; i < N; i++) {
        ll ans = 0;
        string T = S[i];
        for (int j = 0; j < S[i].size(); j++) {
           
            for (int k = 0; k < 26; k++) {
               
                if (S[i][j] == char('a' + k))continue;
                T[j] = char('a' + k);
                ans += m[T];
                T[j] = S[i][j];
            }
        }
        cout << ans << endl;
    }
}
0