結果

問題 No.1444 !Andd
ユーザー kotatsugamekotatsugame
提出日時 2021-03-26 23:26:10
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 108 ms / 2,000 ms
コード長 695 bytes
コンパイル時間 720 ms
コンパイル使用メモリ 69,904 KB
実行使用メモリ 83,564 KB
最終ジャッジ日時 2023-08-19 10:15:17
合計ジャッジ時間 2,982 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 24 ms
22,052 KB
testcase_04 AC 17 ms
15,780 KB
testcase_05 AC 37 ms
40,208 KB
testcase_06 AC 19 ms
17,676 KB
testcase_07 AC 14 ms
15,676 KB
testcase_08 AC 41 ms
36,176 KB
testcase_09 AC 24 ms
23,920 KB
testcase_10 AC 25 ms
28,072 KB
testcase_11 AC 29 ms
34,088 KB
testcase_12 AC 50 ms
44,352 KB
testcase_13 AC 70 ms
60,876 KB
testcase_14 AC 45 ms
48,484 KB
testcase_15 AC 69 ms
56,676 KB
testcase_16 AC 102 ms
83,564 KB
testcase_17 AC 81 ms
83,464 KB
testcase_18 AC 103 ms
83,540 KB
testcase_19 AC 108 ms
83,500 KB
testcase_20 AC 104 ms
83,508 KB
testcase_21 AC 104 ms
83,428 KB
testcase_22 AC 102 ms
83,512 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp:8:1: 警告: ISO C++ では型の無い ‘main’ の宣言を禁止しています [-Wreturn-type]
    8 | main()
      | ^~~~

ソースコード

diff #

#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int N;
int A[20202];
int C[20202][1<<10];
main()
{
	cin>>N;
	for(int i=0;i<N;i++)cin>>A[i];
	bool zero=false,one=true,all=false;
	for(int i=0;i<N;i++)
	{
		if(A[i]==0)all=true;
		if(one)
		{
			if(A[i]&1);
			else one=false,zero=true;
			if(A[i]==0)zero=true;
			else if(A[i]==1)one=true;
			else C[i+1][A[i]]=1;
		}
		for(int j=0;j<1<<10;j++)if(C[i][j])
		{
			int k=j&A[i];
			if(k==0)zero=true;
			else if(k==1)one=true;
			else C[i+1][k]=1;
		}
		for(int j=0;j<1<<10;j++)
		{
			C[i+1][(j*A[i])&(1<<10)-1]+=C[i][j];
		}
		int ans=zero+one;
		for(int j=0;j<1<<10;j++)ans+=C[i+1][j];
		cout<<(all?1:ans)<<endl;
	}
}
0