結果
| 問題 | No.1444 !Andd | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2021-03-26 23:26:10 | 
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 112 ms / 2,000 ms | 
| コード長 | 695 bytes | 
| コンパイル時間 | 843 ms | 
| コンパイル使用メモリ | 71,616 KB | 
| 実行使用メモリ | 83,732 KB | 
| 最終ジャッジ日時 | 2024-11-29 01:42:33 | 
| 合計ジャッジ時間 | 2,848 ms | 
| ジャッジサーバーID (参考情報) | judge2 / judge4 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 20 | 
コンパイルメッセージ
main.cpp:8:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    8 | main()
      | ^~~~
            
            ソースコード
#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;
	}
}
            
            
            
        