結果
問題 |
No.1621 Sequence Inversions
|
ユーザー |
|
提出日時 | 2021-07-30 11:46:59 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 500 bytes |
コンパイル時間 | 750 ms |
コンパイル使用メモリ | 71,212 KB |
最終ジャッジ日時 | 2025-01-23 10:19:38 |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 WA * 2 |
other | AC * 8 WA * 18 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:11:7: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 11 | scanf("%d%d",&n,&m); | ~~~~~^~~~~~~~~~~~~~
ソースコード
#include<iostream> #include<cstring> #include<algorithm> using namespace std; const int N = 1e3+10,mod = 998244353; typedef long long LL; LL f[N][N]; LL sum[N]; int main(){ int n,m; scanf("%d%d",&n,&m); f[1][0]=1; for(int i=2;i<=n;i++){ sum[0]=f[i-1][0]; for(int j=0;j<=m;j++){ sum[j]=(sum[j-1]+f[i-1][j])%mod; } for(int j=0;j<=m;j++){ int last=j-(i-1)-1; f[i][j]+=sum[j]; if(last>=0)f[i][j]=(f[i][j]-sum[last]+mod)%mod; f[i][j]%=mod; } } cout<<f[n][m]; return 0; }