結果

問題 No.2506 Sum of Weighted Powers
ユーザー suisensuisen
提出日時 2023-03-31 21:39:14
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
RE  
実行時間 -
コード長 1,180 bytes
コンパイル時間 940 ms
コンパイル使用メモリ 76,452 KB
実行使用メモリ 6,008 KB
最終ジャッジ日時 2023-10-24 07:29:19
合計ジャッジ時間 7,634 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,348 KB
testcase_01 AC 2 ms
4,348 KB
testcase_02 AC 2 ms
4,348 KB
testcase_03 AC 32 ms
4,348 KB
testcase_04 AC 4 ms
4,348 KB
testcase_05 AC 2 ms
4,348 KB
testcase_06 AC 105 ms
4,348 KB
testcase_07 AC 19 ms
4,348 KB
testcase_08 AC 266 ms
4,348 KB
testcase_09 AC 55 ms
4,348 KB
testcase_10 AC 191 ms
4,348 KB
testcase_11 AC 216 ms
4,348 KB
testcase_12 AC 2 ms
4,348 KB
testcase_13 AC 18 ms
4,348 KB
testcase_14 AC 3 ms
4,348 KB
testcase_15 AC 4 ms
4,348 KB
testcase_16 AC 10 ms
4,348 KB
testcase_17 AC 30 ms
4,348 KB
testcase_18 AC 74 ms
4,348 KB
testcase_19 AC 8 ms
4,348 KB
testcase_20 AC 34 ms
4,348 KB
testcase_21 AC 205 ms
4,348 KB
testcase_22 AC 58 ms
4,348 KB
testcase_23 RE -
testcase_24 RE -
testcase_25 RE -
testcase_26 RE -
testcase_27 RE -
testcase_28 RE -
testcase_29 RE -
testcase_30 RE -
testcase_31 RE -
testcase_32 RE -
testcase_33 AC 2 ms
4,348 KB
testcase_34 AC 2 ms
4,348 KB
testcase_35 RE -
testcase_36 RE -
testcase_37 AC 2 ms
4,348 KB
testcase_38 AC 2 ms
4,348 KB
testcase_39 AC 2 ms
4,348 KB
testcase_40 AC 2 ms
4,348 KB
testcase_41 AC 3 ms
4,348 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>

#include <atcoder/modint>

using mint = atcoder::static_modint<943718401>;

namespace atcoder {
    std::istream& operator>>(std::istream& in, mint &a) {
        long long e; in >> e; a = e;
        return in;
    }
    
    std::ostream& operator<<(std::ostream& out, const mint &a) {
        out << a.val();
        return out;
    }
} // namespace atcoder

mint naive(const int n, const mint x, const std::vector<mint> &a, const std::vector<mint> &b, const std::vector<mint> &c) {
    mint ans = 0;
    for (long long i = 0; i <= n; ++i) for (long long j = 0; j <= i; ++j) {
        long long k = i - j;
        ans += a[i] * b[j] * c[k] * x.pow(i * j * k);
    }
    return ans;
}

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

    int n, x;
    std::cin >> n >> x;
    
    std::vector<mint> a(n + 1), b(n + 1), c(n + 1);
    for (int i = 0, v; i <= n; ++i) std::cin >> v, a[i] = v;
    for (int i = 0, v; i <= n; ++i) std::cin >> v, b[i] = v;
    for (int i = 0, v; i <= n; ++i) std::cin >> v, c[i] = v;

    assert(n <= 5000);

    std::cout << naive(n, x, a, b, c).val() << std::endl;
    return 0;
}
0