結果
| 問題 |
No.1444 !Andd
|
| コンテスト | |
| ユーザー |
たたき@競プロ
|
| 提出日時 | 2023-09-05 05:20:59 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,001 bytes |
| コンパイル時間 | 5,581 ms |
| コンパイル使用メモリ | 308,408 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-06-23 01:51:13 |
| 合計ジャッジ時間 | 7,516 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 WA * 1 |
| other | AC * 15 WA * 5 |
ソースコード
#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";
}
}
たたき@競プロ