結果
問題 | No.1443 Andd |
ユーザー |
|
提出日時 | 2021-03-26 23:22:13 |
言語 | C++14 (gcc 12.3.0 + boost 1.83.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 862 bytes |
コンパイル時間 | 986 ms |
コンパイル使用メモリ | 98,340 KB |
実行使用メモリ | 84,244 KB |
最終ジャッジ日時 | 2024-11-29 01:37:24 |
合計ジャッジ時間 | 10,853 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 2 ms
6,816 KB |
testcase_01 | AC | 2 ms
6,816 KB |
testcase_02 | AC | 2 ms
6,816 KB |
testcase_03 | WA | - |
testcase_04 | WA | - |
testcase_05 | WA | - |
testcase_06 | WA | - |
testcase_07 | WA | - |
testcase_08 | WA | - |
testcase_09 | WA | - |
testcase_10 | WA | - |
testcase_11 | WA | - |
testcase_12 | WA | - |
testcase_13 | WA | - |
testcase_14 | WA | - |
testcase_15 | WA | - |
testcase_16 | WA | - |
testcase_17 | WA | - |
testcase_18 | WA | - |
testcase_19 | WA | - |
testcase_20 | WA | - |
testcase_21 | WA | - |
testcase_22 | WA | - |
ソースコード
#include <iostream> #include <string> #include <algorithm> #include <vector> #include <iomanip> #include <cmath> #include <stdio.h> #include <queue> #include <deque> #include <cstdio> #include <set> #include <map> #include <bitset> #include <stack> #include <cctype> using namespace std; int a[20020]; int dp[20020][1030]; int main() { int n; cin >> n; int sum = 0; for (int i = 1; i <= n; i++) { cin >> a[i]; sum += a[i]; } dp[0][0] = 1; for (int i = 1; i <= n; i++) { for (int j = 0; j < 1024; j++) { dp[i][(j & a[i])] += dp[i - 1][j]; dp[i][((j + a[i]) & 1023)] += dp[i - 1][j]; } } for (int i = 1; i <= n; i++) { set<int> st; int co = 0; for (int j = 0; j < 1024; j++) { if (dp[i][j] != 0 && j + sum >= 1024) { st.insert(j + sum); } else if (dp[i][j] != 0) { co++; } } cout << co + st.size() << endl; } }