結果
| 問題 |
No.2506 Sum of Weighted Powers
|
| コンテスト | |
| ユーザー |
emthrm
|
| 提出日時 | 2023-03-29 00:15:48 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 1,346 bytes |
| コンパイル時間 | 1,409 ms |
| コンパイル使用メモリ | 124,588 KB |
| 実行使用メモリ | 11,556 KB |
| 最終ジャッジ日時 | 2024-10-02 20:38:38 |
| 合計ジャッジ時間 | 8,541 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 23 TLE * 1 -- * 18 |
ソースコード
#include <algorithm>
#include <cstdint>
#include <functional>
#include <iostream>
#include <iterator>
#include <numeric>
#include <vector>
#include <atcoder/modint>
using mint = atcoder::static_modint<943718401>;
// <嘘解法 (TLE)>
int main() {
std::cin.tie(nullptr);
std::ios_base::sync_with_stdio(false);
int n, x;
std::cin >> n >> x;
std::vector<int> a(n + 1), b(n + 1), c(n + 1);
std::ranges::for_each(a, [](int& e) -> void { std::cin >> e; });
std::ranges::for_each(b, [](int& e) -> void { std::cin >> e; });
std::ranges::for_each(c, [](int& e) -> void { std::cin >> e; });
if (x == 0) {
const mint s =
std::inner_product(a.begin(), a.end(), b.begin(), mint::raw(0),
std::plus<mint>(), std::multiplies<std::int64_t>())
* mint::raw(c[0])
+ std::inner_product(std::next(a.begin()), a.end(),
std::next(c.begin()), mint::raw(0),
std::plus<mint>(), std::multiplies<std::int64_t>())
* mint::raw(b[0]);
std::cout << s.val() << '\n';
return 0;
}
mint s = 0;
for (int j = 0; j <= n; ++j) {
for (int k = 0; j + k <= n; ++k) {
s += mint::raw(x).pow(std::int64_t{j + k} * j * k)
* a[j + k] * b[j] * c[k];
}
}
std::cout << s.val() << '\n';
return 0;
}
emthrm