結果
| 問題 | No.3851 Dreams |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2026-11-17 01:47:11 |
| 言語 | C++23 (gcc 15.3.0 + boost 1.92.0 + ACL) |
| 結果 |
AC
不安定
|
| 実行時間 | 1,392 ms / 2,000 ms |
| + 533µs | |
| コード長 | 1,442 bytes |
| 記録 | |
| コンパイル時間 | 2,562 ms |
| コンパイル使用メモリ | 346,740 KB |
| 実行使用メモリ | 9,900 KB |
| 最終ジャッジ日時 | 2026-12-04 21:09:54 |
| 合計ジャッジ時間 | 29,060 ms |
|
ジャッジサーバーID (参考情報) |
judge4_0 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 25 |
ソースコード
// TLE
#include <atcoder/modint.hpp>
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using mint = atcoder::modint998244353;
struct Skill {
ll X, Y, P, S;
};
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
int N, M;
cin >> N >> M;
vector<Skill> SK(N);
for (auto &s : SK) {
cin >> s.X >> s.Y >> s.P >> s.S;
}
vector<ll> E(M);
for (ll &t : E)
cin >> t;
const mint inv100 = mint(100).inv();
mint ans = 0;
for (ll t : E) {
vector<mint> no_active(N);
for (int i = 0; i < N; ++i) {
const auto &s = SK[i];
ll c = t / s.X - max(0LL, t - s.Y) / s.X;
mint fail = mint(1) - mint(s.P) * inv100;
no_active[i] = fail.pow(c);
}
mint r = 1;
for (mint p : no_active) {
r *= p;
}
mint score = r;
for (int i = 0; i < N; ++i) {
bool no_first = false;
for (int j = 0; j < i; ++j) {
if (SK[j].S == SK[i].S) {
no_first = true;
break;
}
}
if (no_first)
continue;
mint p_highest = 1;
mint p_notS = 1;
for (int j = 0; j < N; ++j) {
if (SK[j].S > SK[i].S) {
p_highest *= no_active[j];
} else if (SK[j].S == SK[i].S) {
p_notS *= no_active[j];
}
}
mint p_max = p_highest * (mint(1) - p_notS);
score += mint(SK[i].S) * p_max;
}
ans += score;
}
cout << ans.val() << '\n';
}