結果

問題 No.1482 Swap Many Permutations
ユーザー 👑 tatyam
提出日時 2021-03-06 14:45:13
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 605 bytes
コンパイル時間 1,849 ms
コンパイル使用メモリ 198,308 KB
最終ジャッジ日時 2025-01-19 12:23:52
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1 WA * 1
other AC * 5 WA * 40
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#include <atcoder/modint>
using namespace std;
using Modint = atcoder::modint998244353;

Modint fact(int x){
    Modint ans = 1;
    while(x > 1) ans *= Modint::raw(x--);
    return ans;
}
int main(){
    int N, M;
    cin >> N >> M;
    vector<pair<int, int>> A(2);
    for(auto& [B, C] : A) cin >> B >> C;
    puts("1");
    if(A[0] == A[1]) puts("0");
    else cout << fact(M).val() << '\n';
    Modint ans = Modint(2).inv(), x = Modint(M) * (M - 1);
    ans *= x--;
    ans *= x--;
    for(int i = 2; i < N; i++){
        ans *= x--;
        cout << ans.val() << '\n';
    }
}
0