結果

問題 No.1066 #いろいろな色 / Red and Blue and more various colors (Easy)
ユーザー kotatsugamekotatsugame
提出日時 2020-05-29 21:40:15
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 61 ms / 2,000 ms
コード長 313 bytes
コンパイル時間 551 ms
コンパイル使用メモリ 65,600 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-11-06 02:57:47
合計ジャッジ時間 1,895 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,816 KB
testcase_01 AC 2 ms
6,820 KB
testcase_02 AC 2 ms
6,820 KB
testcase_03 AC 2 ms
6,816 KB
testcase_04 AC 2 ms
6,816 KB
testcase_05 AC 2 ms
6,816 KB
testcase_06 AC 2 ms
6,816 KB
testcase_07 AC 2 ms
6,816 KB
testcase_08 AC 26 ms
6,816 KB
testcase_09 AC 2 ms
6,816 KB
testcase_10 AC 59 ms
6,816 KB
testcase_11 AC 17 ms
6,816 KB
testcase_12 AC 14 ms
6,820 KB
testcase_13 AC 17 ms
6,820 KB
testcase_14 AC 19 ms
6,816 KB
testcase_15 AC 42 ms
6,816 KB
testcase_16 AC 9 ms
6,816 KB
testcase_17 AC 11 ms
6,816 KB
testcase_18 AC 39 ms
6,816 KB
testcase_19 AC 17 ms
6,820 KB
testcase_20 AC 2 ms
6,820 KB
testcase_21 AC 31 ms
6,820 KB
testcase_22 AC 2 ms
6,820 KB
testcase_23 AC 2 ms
6,816 KB
testcase_24 AC 2 ms
6,816 KB
testcase_25 AC 61 ms
6,816 KB
testcase_26 AC 60 ms
6,816 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp:6:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    6 | main()
      | ^~~~

ソースコード

diff #

#include<iostream>
using namespace std;
const long mod=998244353;
int N,Q;
long dp[6060];
main()
{
	cin>>N>>Q;
	dp[0]=1;
	for(int i=0;i<N;i++)
	{
		int A;cin>>A;
		for(int j=i;j>=0;j--)
		{
			(dp[j+1]+=dp[j])%=mod;
			dp[j]=dp[j]*(A-1)%mod;
		}
	}
	for(int i=0;i<Q;i++)
	{
		int B;cin>>B;cout<<dp[B]<<endl;
	}
}
0