結果
| 問題 | No.1443 Andd | 
| コンテスト | |
| ユーザー |  たたき@競プロ | 
| 提出日時 | 2023-09-05 05:14:49 | 
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 103 ms / 2,000 ms | 
| コード長 | 938 bytes | 
| コンパイル時間 | 5,625 ms | 
| コンパイル使用メモリ | 309,660 KB | 
| 実行使用メモリ | 5,376 KB | 
| 最終ジャッジ日時 | 2024-06-23 01:46:03 | 
| 合計ジャッジ時間 | 7,436 ms | 
| ジャッジサーバーID (参考情報) | judge3 / judge5 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 20 | 
ソースコード
#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[0]=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);
     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";
   }
}
       
            
            
            
        