結果
| 問題 |
No.1443 Andd
|
| コンテスト | |
| ユーザー |
沙耶花
|
| 提出日時 | 2021-03-26 21:50:20 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 645 bytes |
| コンパイル時間 | 3,937 ms |
| コンパイル使用メモリ | 252,144 KB |
| 最終ジャッジ日時 | 2025-01-19 22:24:17 |
|
ジャッジサーバーID (参考情報) |
judge4 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 10 TLE * 10 |
ソースコード
#include <stdio.h>
#include <bits/stdc++.h>
#include <atcoder/all>
using namespace atcoder;
using mint = modint998244353;
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define Inf 1000000001
int main(){
int N;
cin>>N;
vector<int> A(N);
rep(i,N){
cin>>A[i];
}
vector<bool> dp(1024,false);
dp[0] = true;
bitset<21000000> B;
B[0] = true;
rep(i,N){
B <<= A[i];
rep(j,1024){
if(dp[j]){
B[j&A[i]] = true;
}
}
vector<bool> ndp(1024,false);
rep(j,1024){
if(dp[j])ndp[(j + A[i])%1024] = true;
if(B[j])ndp[j] = true;
}
swap(dp,ndp);
cout<<B.count()<<endl;
}
return 0;
}
沙耶花