結果
問題 |
No.2561 みんな大好きmod 998
|
ユーザー |
![]() |
提出日時 | 2023-12-03 16:23:27 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 513 bytes |
コンパイル時間 | 1,409 ms |
コンパイル使用メモリ | 165,580 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-09-26 22:11:27 |
合計ジャッジ時間 | 3,713 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 25 WA * 19 |
ソースコード
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) long long A[28],B[28]; int n,k,p1=998,p2=998244352,t; void f(int i,int l,long long ans,long long ans1){ if(l==k){if(ans>=ans1){t++;t%=p1;}} else{ for(int j=i+1;j<n;j++){ f(j,l+1, (ans+A[j])%p1 , (ans+B[j])%p2 ); } } } int main(){cin>>n>>k; rep(i,n){cin>>A[i];B[i]=A[i]%p2;A[i]%=p1;} for(int i=0;i<=n-k;i++){ f(i,1,A[i],B[i]); } cout<<t<<endl; }