結果

問題 No.412 花火大会
ユーザー kotatsugamekotatsugame
提出日時 2020-02-23 07:29:57
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 457 bytes
コンパイル時間 624 ms
コンパイル使用メモリ 64,372 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-18 08:24:07
合計ジャッジ時間 1,499 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 2 ms
5,376 KB
testcase_04 AC 1 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 2 ms
5,376 KB
testcase_09 AC 2 ms
5,376 KB
testcase_10 AC 2 ms
5,376 KB
testcase_11 AC 2 ms
5,376 KB
testcase_12 AC 2 ms
5,376 KB
testcase_13 AC 2 ms
5,376 KB
testcase_14 AC 1 ms
5,376 KB
testcase_15 AC 2 ms
5,376 KB
testcase_16 AC 2 ms
5,376 KB
testcase_17 AC 1 ms
5,376 KB
testcase_18 AC 2 ms
5,376 KB
testcase_19 AC 2 ms
5,376 KB
testcase_20 AC 2 ms
5,376 KB
testcase_21 AC 2 ms
5,376 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp:5:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    5 | main()
      | ^~~~

ソースコード

diff #

#include<iostream>
using namespace std;
long dp[31][8];
int B,C,D,N;
main()
{
	cin>>B>>C>>D>>N;
	if(B>C)B^=C^=B^=C;
	if(C>D)C^=D^=C^=D;
	if(B>C)B^=C^=B^=C;
	dp[0][0]=1;
	for(int i=0;i<N;i++)
	{
		int E;cin>>E;
		for(int j=0;j<8;j++)
		{
			dp[i+1][j]+=dp[i][j];
			if(~j&4&&D<=E)dp[i+1][j|4]+=dp[i][j];
			else if(~j&2&&C<=E)dp[i+1][j|2]+=dp[i][j];
			else if(~j&1&&B<=E)dp[i+1][j|1]+=dp[i][j];
			else dp[i+1][j]+=dp[i][j];
		}
	}
	cout<<dp[N][7]<<endl;
}
0