結果
問題 | No.1443 Andd |
ユーザー | 沙耶花 |
提出日時 | 2021-03-26 21:50:20 |
言語 | C++17 (gcc 12.3.0 + boost 1.83.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 645 bytes |
コンパイル時間 | 4,593 ms |
コンパイル使用メモリ | 263,772 KB |
実行使用メモリ | 13,884 KB |
最終ジャッジ日時 | 2024-05-06 15:17:33 |
合計ジャッジ時間 | 20,920 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 6 ms
13,884 KB |
testcase_01 | AC | 11 ms
6,812 KB |
testcase_02 | AC | 20 ms
6,940 KB |
testcase_03 | AC | 951 ms
6,940 KB |
testcase_04 | AC | 1,482 ms
6,940 KB |
testcase_05 | AC | 1,062 ms
6,944 KB |
testcase_06 | AC | 918 ms
6,944 KB |
testcase_07 | AC | 1,447 ms
6,944 KB |
testcase_08 | AC | 1,305 ms
6,940 KB |
testcase_09 | AC | 182 ms
6,944 KB |
testcase_10 | AC | 1,748 ms
6,940 KB |
testcase_11 | AC | 1,559 ms
6,944 KB |
testcase_12 | AC | 1,530 ms
6,940 KB |
testcase_13 | TLE | - |
testcase_14 | -- | - |
testcase_15 | -- | - |
testcase_16 | -- | - |
testcase_17 | -- | - |
testcase_18 | -- | - |
testcase_19 | -- | - |
testcase_20 | -- | - |
testcase_21 | -- | - |
testcase_22 | -- | - |
ソースコード
#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; }