結果

問題 No.2215 Slide Subset Sum
ユーザー tailstails
提出日時 2024-04-30 17:48:27
言語 C90
(gcc 11.4.0)
結果
AC  
実行時間 103 ms / 3,000 ms
コード長 1,456 bytes
コンパイル時間 538 ms
コンパイル使用メモリ 26,880 KB
実行使用メモリ 81,500 KB
最終ジャッジ日時 2024-04-30 17:48:34
合計ジャッジ時間 5,082 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 12 ms
6,816 KB
testcase_01 AC 55 ms
6,812 KB
testcase_02 AC 96 ms
6,940 KB
testcase_03 AC 103 ms
7,908 KB
testcase_04 AC 98 ms
8,792 KB
testcase_05 AC 1 ms
6,940 KB
testcase_06 AC 1 ms
6,940 KB
testcase_07 AC 1 ms
6,940 KB
testcase_08 AC 1 ms
6,940 KB
testcase_09 AC 1 ms
6,940 KB
testcase_10 AC 1 ms
6,940 KB
testcase_11 AC 0 ms
6,944 KB
testcase_12 AC 1 ms
6,940 KB
testcase_13 AC 1 ms
6,944 KB
testcase_14 AC 1 ms
6,940 KB
testcase_15 AC 1 ms
6,940 KB
testcase_16 AC 1 ms
6,944 KB
testcase_17 AC 76 ms
42,168 KB
testcase_18 AC 74 ms
36,952 KB
testcase_19 AC 97 ms
6,944 KB
testcase_20 AC 58 ms
45,396 KB
testcase_21 AC 92 ms
14,932 KB
testcase_22 AC 61 ms
46,936 KB
testcase_23 AC 52 ms
74,708 KB
testcase_24 AC 51 ms
75,608 KB
testcase_25 AC 55 ms
69,464 KB
testcase_26 AC 59 ms
48,520 KB
testcase_27 AC 4 ms
6,940 KB
testcase_28 AC 5 ms
15,192 KB
testcase_29 AC 7 ms
6,940 KB
testcase_30 AC 41 ms
6,940 KB
testcase_31 AC 18 ms
33,624 KB
testcase_32 AC 10 ms
6,944 KB
testcase_33 AC 56 ms
14,164 KB
testcase_34 AC 36 ms
35,924 KB
testcase_35 AC 7 ms
7,900 KB
testcase_36 AC 11 ms
18,008 KB
testcase_37 AC 49 ms
81,500 KB
testcase_38 AC 18 ms
80,468 KB
testcase_39 AC 56 ms
6,940 KB
testcase_40 AC 3 ms
6,940 KB
testcase_41 AC 1 ms
6,940 KB
testcase_42 AC 79 ms
45,748 KB
testcase_43 AC 98 ms
10,956 KB
testcase_44 AC 98 ms
11,444 KB
testcase_45 AC 55 ms
64,712 KB
testcase_46 AC 56 ms
66,008 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: In function ‘main’:
main.c:62:17: warning: implicit declaration of function ‘write’ [-Wimplicit-function-declaration]
   62 |                 write(1,wbuf,wp-wbuf);
      |                 ^~~~~
main.c:64:9: warning: implicit declaration of function ‘_exit’ [-Wimplicit-function-declaration]
   64 |         _exit(0);
      |         ^~~~~
main.c:64:9: warning: incompatible implicit declaration of built-in function ‘_exit’ [-Wbuiltin-declaration-mismatch]

ソースコード

diff #

#pragma GCC optimize("Ofast")
#pragma GCC target("avx2")

#define rd_init() char*rp=({char*mmap();mmap(0l,1l<<25,1,2,0,0ll);})
#define rd() ({int _v=0,_c;while(_c=*rp++-48,_c>=0)_v=_v*10+_c;_v;})
#define WTHI(v) {unsigned _z=v,_n=0;ulong _d=0;while(++_n,_d=_d<<8|0x30|_z%10,_z/=10);*(ulong*)wp=_d;wp+=_n;}
#define WTLO(v) {unsigned _z=v,_n=8;ulong _d=0;while(_d=_d<<8|0x30|_z%10,_z/=10,--_n);*(ulong*)wp=_d;wp+=8;}
#define wt(v) if(v>=100000000){*wp++=v/100000000+'0';WTLO(v);}else{WTHI(v);}
#define rep(v,e) for(typeof(e) v=0;v<e;++v)
#define reps(v,s,e) for(typeof(e) v=s;v<e;++v)
#define rrep(v,e) for(typeof(e) v=e;v--;)
#define aaa(x) ({unsigned _r=x;_r-(_r<MD?0:MD);})
#define aaa2(x,m) ({unsigned _r=x;_r-(_r<m?0:m);})
#define MD 998244353

typedef unsigned long ulong;

char wbuf[1<<25];
unsigned n,m,k;
unsigned a[200000];
unsigned s[200002][100];

int main(){
	{
		rd_init();
		n=rd();
		m=rd();
		k=rd();
		rep(i,n){
			a[i]=rd();
		}
	}
	s[0][0]=s[m+1][0]=1;
	{
		char*wp=wbuf;
		unsigned r=0;
		rep(j,n-m+1){
			if(r){
				rep(i,k){
					s[r][i]=aaa(s[r-1][i]+s[r-1][aaa2(i+a[m-1+j],k)]);
				}
			}else{
				rrep(h,m){
					rep(i,k){
						s[h+1][i]=aaa(s[h+2][i]+s[h+2][aaa2(i+a[j+h],k)]);
					}
				}
			}
			ulong z=(ulong)s[r][0]*s[r+1][0]-1;
			reps(i,1,k){
				z+=(ulong)s[r][i]*s[r+1][k-i];
				if(!(k-i-1&15)){
					z%=MD;
				}
			}
			if(++r==m){
				r=0;
			}
			wt(z);
			*wp++='\n';
		}
		write(1,wbuf,wp-wbuf);
	}
	_exit(0);
}
0