結果

問題 No.3851 Dreams
コンテスト
ユーザー Nzt3
提出日時 2026-11-17 01:52:00
言語 C++23
(gcc 15.3.0 + boost 1.92.0 + ACL)
コンパイル:
g++-15 -O2 -fplugin=/usr/lib/yukicoder/noavx512-gcc15.so -lm -std=c++23 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
TLE  
実行時間 -
コード長 1,207 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 2,792 ms
コンパイル使用メモリ 346,156 KB
実行使用メモリ 6,400 KB
最終ジャッジ日時 2026-12-04 21:09:46
合計ジャッジ時間 13,932 ms
ジャッジサーバーID
(参考情報)
judge3_0 / judge6_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample -- * 3
other TLE * 1 -- * 24
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

// naive
#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> skills(n);
  for (auto &skill : skills) {
    cin >> skill.x >> skill.y >> skill.p >> skill.s;
  }
  sort(skills.begin(), skills.end(),
       [](const Skill &a, const Skill &b) { return a.s > b.s; });

  vector<ll> event_times(m);
  for (ll &t : event_times)
    cin >> t;

  const mint inv100 = mint(100).inv();
  mint answer = 0;

  for (ll t : event_times) {
    mint no_higher_boost = 1;

    for (const auto &skill : skills) {
      ll first_k = max(1LL, (t - skill.y) / skill.x + 1);
      ll last_k = t / skill.x;

      mint no_active_boost = 1;
      const mint no_success = mint(1) - mint(skill.p) * inv100;
      for (ll k = first_k; k <= last_k; ++k) {
        no_active_boost *= no_success;
      }

      answer += mint(skill.s) * no_higher_boost * (mint(1) - no_active_boost);
      no_higher_boost *= no_active_boost;
    }

    answer += no_higher_boost;
  }

  cout << answer.val() << '\n';
}
0