結果

問題 No.1444 !Andd
ユーザー たたき@競プロたたき@競プロ
提出日時 2023-09-05 05:20:59
言語 C++23
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,001 bytes
コンパイル時間 5,486 ms
コンパイル使用メモリ 306,236 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-05 05:21:08
合計ジャッジ時間 8,714 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 WA -
testcase_03 AC 25 ms
4,380 KB
testcase_04 AC 17 ms
4,380 KB
testcase_05 WA -
testcase_06 AC 18 ms
4,380 KB
testcase_07 AC 15 ms
4,384 KB
testcase_08 AC 43 ms
4,376 KB
testcase_09 AC 26 ms
4,380 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 AC 53 ms
4,376 KB
testcase_13 AC 73 ms
4,376 KB
testcase_14 WA -
testcase_15 AC 69 ms
4,376 KB
testcase_16 AC 124 ms
4,380 KB
testcase_17 WA -
testcase_18 AC 104 ms
4,376 KB
testcase_19 AC 105 ms
4,376 KB
testcase_20 AC 104 ms
4,380 KB
testcase_21 AC 104 ms
4,376 KB
testcase_22 AC 104 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;
       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