結果
問題 | No.3004 ヤング図形 |
ユーザー |
![]() |
提出日時 | 2025-01-23 14:43:41 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 553 ms / 4,000 ms |
コード長 | 1,832 bytes |
コンパイル時間 | 2,311 ms |
コンパイル使用メモリ | 198,912 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2025-01-23 14:43:59 |
合計ジャッジ時間 | 6,531 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 25 |
ソースコード
#include <bits/stdc++.h>using namespace std;void fast_io() {ios_base::sync_with_stdio(false);cin.tie(nullptr);}#include <atcoder/modint>using mint = atcoder::modint998244353;mint pre[] = {1, 295201906, 160030060, 957629942, 545208507, 213689172, 760025067,939830261, 506268060, 39806322, 808258749, 440133909, 686156489, 741797144,390377694, 12629586, 544711799, 104121967, 495867250, 421290700, 117153405,57084755, 202713771, 675932866, 79781699, 956276337, 652678397, 35212756,655645460, 468129309, 761699708, 533047427, 287671032, 206068022, 50865043,144980423, 111276893, 259415897, 444094191, 593907889, 573994984, 892454686,566073550, 128761001, 888483202, 251718753, 548033568, 428105027, 742756734,546182474, 62402409, 102052166, 826426395, 159186619, 926316039, 176055335,51568171, 414163604, 604947226, 681666415, 511621808, 924112080, 265769800,955559118, 763148293, 472709375, 19536133, 860830935, 290471030, 851685235,242726978, 169855231, 612759169, 599797734, 961628039, 953297493, 62806842,37844313, 909741023, 689361523, 887890124, 380694152, 669317759, 367270918,806951470, 843736533, 377403437, 945260111, 786127243, 80918046, 875880304,};const int per = 1e7;mint calc_fact(int n) {if (n >= 998244353) {return 0;}mint res = pre[n / per];for (int i = n / per * per + 1; i <= n; i++) {res *= i;}return res;}int main() {fast_io();int k;cin >> k;vector<int> l(k), m(k);int n = 0;for (int i = 0; i < k; i++) {cin >> l[i] >> m[i];n += l[i] * m[i];}mint ans = calc_fact(n);for (int i = 0; i < k; i++) {ans /= calc_fact(m[i]) * calc_fact(l[i]).pow(m[i]);}cout << ans.val() << endl;}