結果
問題 | No.2171 OR Assignment |
ユーザー | hotman78 |
提出日時 | 2022-12-23 07:32:38 |
言語 | C++17 (gcc 12.3.0 + boost 1.83.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 1,175 bytes |
コンパイル時間 | 2,826 ms |
コンパイル使用メモリ | 228,320 KB |
実行使用メモリ | 311,680 KB |
最終ジャッジ日時 | 2024-04-29 05:59:18 |
合計ジャッジ時間 | 18,694 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 2 ms
10,752 KB |
testcase_01 | AC | 2 ms
5,376 KB |
testcase_02 | AC | 2 ms
5,376 KB |
testcase_03 | AC | 2 ms
5,376 KB |
testcase_04 | AC | 2 ms
5,376 KB |
testcase_05 | AC | 2 ms
5,376 KB |
testcase_06 | AC | 2 ms
5,376 KB |
testcase_07 | AC | 2 ms
5,376 KB |
testcase_08 | AC | 2 ms
5,376 KB |
testcase_09 | AC | 3 ms
5,376 KB |
testcase_10 | AC | 2 ms
5,376 KB |
testcase_11 | AC | 2 ms
5,376 KB |
testcase_12 | AC | 602 ms
93,440 KB |
testcase_13 | AC | 597 ms
93,568 KB |
testcase_14 | AC | 603 ms
93,440 KB |
testcase_15 | AC | 105 ms
43,136 KB |
testcase_16 | AC | 162 ms
52,352 KB |
testcase_17 | AC | 140 ms
52,352 KB |
testcase_18 | TLE | - |
testcase_19 | TLE | - |
testcase_20 | TLE | - |
testcase_21 | -- | - |
testcase_22 | -- | - |
testcase_23 | -- | - |
testcase_24 | -- | - |
testcase_25 | -- | - |
testcase_26 | -- | - |
testcase_27 | -- | - |
testcase_28 | -- | - |
testcase_29 | -- | - |
testcase_30 | -- | - |
testcase_31 | -- | - |
ソースコード
#pragma optimize("Ofast") #pragma target("avx2") #include<bits/stdc++.h> using namespace std; #include<atcoder/modint.hpp> using mint=atcoder::static_modint<998244353>; #define endl '\n' int main(){ cin.tie(0)->sync_with_stdio(0); int n; cin>>n; vector<int>a(n); for(int i=0;i<n;++i)cin>>a[i]; vector<set<int>>ss(n+1); vector<vector<int>>s(n+1); vector<map<int,mint>>dp(n+1); ss[0].emplace(0); for(int i=0;i<n;++i){ for(auto e:ss[i]){ ss[i+1].emplace(e|a[i]); } ss[i+1].emplace(a[i]); ss[i+1].emplace(0); } for(int i=0;i<n;++i)s[i]=vector(ss[i].begin(),ss[i].end()); ss=vector<set<int>>(); mint ans=0; dp[0][0]=1; for(int i=0;i<n;++i){ for(auto [d,c]:dp[i]){ unordered_set<long long>used; for(auto e:s[i]){ if(d<e)break; if(used.count(d*(1LL<<31)+(e|a[i])))continue; if((d|e)==d){ dp[i+1][e|a[i]]+=c; used.emplace(d*(1LL<<31)+(e|a[i])); } } } } for(auto [e,c]:dp[n])ans+=c; cout<<ans.val()<<endl; }