結果

問題 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  
実行時間 54 ms / 2,000 ms
コード長 313 bytes
コンパイル時間 467 ms
コンパイル使用メモリ 64,244 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-23 20:39:50
合計ジャッジ時間 1,601 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 1 ms
5,376 KB
testcase_02 AC 1 ms
5,376 KB
testcase_03 AC 1 ms
5,376 KB
testcase_04 AC 2 ms
5,376 KB
testcase_05 AC 1 ms
5,376 KB
testcase_06 AC 2 ms
5,376 KB
testcase_07 AC 1 ms
5,376 KB
testcase_08 AC 23 ms
5,376 KB
testcase_09 AC 2 ms
5,376 KB
testcase_10 AC 53 ms
5,376 KB
testcase_11 AC 15 ms
5,376 KB
testcase_12 AC 12 ms
5,376 KB
testcase_13 AC 15 ms
5,376 KB
testcase_14 AC 16 ms
5,376 KB
testcase_15 AC 37 ms
5,376 KB
testcase_16 AC 8 ms
5,376 KB
testcase_17 AC 9 ms
5,376 KB
testcase_18 AC 34 ms
5,376 KB
testcase_19 AC 14 ms
5,376 KB
testcase_20 AC 1 ms
5,376 KB
testcase_21 AC 27 ms
5,376 KB
testcase_22 AC 1 ms
5,376 KB
testcase_23 AC 1 ms
5,376 KB
testcase_24 AC 1 ms
5,376 KB
testcase_25 AC 54 ms
5,376 KB
testcase_26 AC 54 ms
5,376 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