結果

問題 No.2215 Slide Subset Sum
ユーザー 沙耶花沙耶花
提出日時 2023-02-10 22:52:40
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 912 bytes
コンパイル時間 5,033 ms
コンパイル使用メモリ 264,728 KB
実行使用メモリ 89,812 KB
最終ジャッジ日時 2023-09-22 00:01:31
合計ジャッジ時間 21,215 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 AC 2 ms
4,380 KB
testcase_06 AC 2 ms
4,376 KB
testcase_07 WA -
testcase_08 AC 2 ms
4,376 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 AC 2 ms
4,380 KB
testcase_12 AC 1 ms
4,380 KB
testcase_13 AC 2 ms
4,380 KB
testcase_14 AC 2 ms
4,380 KB
testcase_15 AC 2 ms
4,380 KB
testcase_16 AC 3 ms
4,380 KB
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 367 ms
47,016 KB
testcase_21 WA -
testcase_22 AC 353 ms
50,456 KB
testcase_23 AC 252 ms
80,888 KB
testcase_24 AC 249 ms
81,460 KB
testcase_25 AC 278 ms
72,720 KB
testcase_26 AC 351 ms
50,680 KB
testcase_27 WA -
testcase_28 AC 18 ms
6,104 KB
testcase_29 WA -
testcase_30 WA -
testcase_31 AC 77 ms
32,236 KB
testcase_32 WA -
testcase_33 WA -
testcase_34 WA -
testcase_35 WA -
testcase_36 AC 57 ms
15,700 KB
testcase_37 AC 219 ms
89,812 KB
testcase_38 AC 46 ms
14,884 KB
testcase_39 WA -
testcase_40 WA -
testcase_41 AC 1 ms
4,380 KB
testcase_42 WA -
testcase_43 WA -
testcase_44 WA -
testcase_45 AC 293 ms
68,336 KB
testcase_46 AC 293 ms
68,340 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <stdio.h>
#include <bits/stdc++.h>
#include <atcoder/all>
using namespace atcoder;
using mint = modint998244353;
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define Inf32 1000000001
#define Inf64 1000000000000000001


int main(){
	int N,M,K;
	cin>>N>>M>>K;
	vector<int> a(N);
	rep(i,N)cin>>a[i];
	for(int i=M-1;i<N;i+=M){
		
		vector ldp(M+1,vector<mint>(K,0));
		ldp[0][0] = 1;
		rep(j,M){
			int A = a[i-j];
			rep(k,K){
				ldp[j+1][k] += ldp[j][k];
				ldp[j+1][(k+A)%K] += ldp[j][k];
			}
		}
				
		
		vector<mint> rdp(K,0);
		rdp[0] = 1;
		int cur = i+1;
		while(ldp.size()>0){
			mint ans = 0;
			rep(j,K){
				ans += ldp.back()[j] * rdp[(K-j)%K];
			}
			cout<<(ans-1).val()<<endl;
			ldp.pop_back();
			if(cur>=N)break;
			vector<mint> ndp(K,0);
			rep(j,K){
				ndp[j] += rdp[j];
				ndp[(j+a[cur])%K] += rdp[j];
			}
			swap(ndp,rdp);
			cur++;
		}
	}
	
	return 0;
}
0