結果

問題 No.1444 !Andd
ユーザー たたき@競プロたたき@競プロ
提出日時 2023-09-05 05:21:50
言語 C++23
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 96 ms / 2,000 ms
コード長 1,023 bytes
コンパイル時間 6,092 ms
コンパイル使用メモリ 306,208 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-05 05:21:58
合計ジャッジ時間 7,654 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,384 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 23 ms
4,384 KB
testcase_04 AC 15 ms
4,384 KB
testcase_05 AC 35 ms
4,380 KB
testcase_06 AC 17 ms
4,380 KB
testcase_07 AC 15 ms
4,380 KB
testcase_08 AC 38 ms
4,384 KB
testcase_09 AC 23 ms
4,384 KB
testcase_10 AC 24 ms
4,380 KB
testcase_11 AC 29 ms
4,380 KB
testcase_12 AC 47 ms
4,380 KB
testcase_13 AC 65 ms
4,380 KB
testcase_14 AC 42 ms
4,380 KB
testcase_15 AC 63 ms
4,384 KB
testcase_16 AC 96 ms
4,380 KB
testcase_17 AC 76 ms
4,380 KB
testcase_18 AC 93 ms
4,384 KB
testcase_19 AC 94 ms
4,380 KB
testcase_20 AC 94 ms
4,384 KB
testcase_21 AC 93 ms
4,380 KB
testcase_22 AC 94 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
#include <atcoder/all>
using namespace atcoder;
using mint=modint998244353; //1000000007;
using ll=long long;
using pp=pair<ll,ll>;
#define sr string 
#define vc vector
#define fi first
#define se second
#define rep(i,n) for(ll i=0;i<(ll)n;i++)
#define pb push_back
#define all(v) v.begin(),v.end()
#define pque priority_queue
#define bpc(a) __builtin_popcount(a)
int main(){
   ll n;cin>>n;
   ll b=1<<10;
   vc<ll>dp(b,0),dx(b,0); dp[1]=1; ll over=0;
   rep(i,n){
     ll a;cin>>a;
     vc<ll>pre(b,0),prex(b,0); swap(pre,dp); swap(prex,dx);
     if(a==0){
       dp[0]=1; over=0;
       cout<<1<<"\n";
       continue;
     }
     rep(j,b){
       ll nj=j&a;
       if(pre[j]||prex[j])dp[nj]=1;
       nj=j*a;
       if(nj>=b){
         if(pre[j])over++;
         if(pre[j]||prex[j])dx[nj&(b-1)]=1;
       }
       else{
         if(pre[j])dp[nj]=1;
         if(prex[j])dx[nj]=1;
       }
     }
     ll ans=over;
     rep(j,b)ans+=dp[j];
     cout<<ans<<"\n";
   }
}
       
0