結果
問題 | No.1443 Andd |
ユーザー | nikkukun |
提出日時 | 2021-03-29 10:22:47 |
言語 | C++14 (gcc 12.3.0 + boost 1.83.0) |
結果 |
AC
|
実行時間 | 125 ms / 2,000 ms |
コード長 | 1,111 bytes |
コンパイル時間 | 1,422 ms |
コンパイル使用メモリ | 163,868 KB |
実行使用メモリ | 55,808 KB |
最終ジャッジ日時 | 2023-08-19 16:03:56 |
合計ジャッジ時間 | 3,714 ms |
ジャッジサーバーID (参考情報) |
judge11 / judge15 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 2 ms
5,404 KB |
testcase_01 | AC | 2 ms
5,408 KB |
testcase_02 | AC | 2 ms
5,516 KB |
testcase_03 | AC | 5 ms
7,804 KB |
testcase_04 | AC | 7 ms
7,916 KB |
testcase_05 | AC | 5 ms
7,884 KB |
testcase_06 | AC | 5 ms
7,728 KB |
testcase_07 | AC | 7 ms
7,864 KB |
testcase_08 | AC | 6 ms
7,848 KB |
testcase_09 | AC | 3 ms
5,492 KB |
testcase_10 | AC | 8 ms
7,980 KB |
testcase_11 | AC | 7 ms
7,904 KB |
testcase_12 | AC | 7 ms
8,092 KB |
testcase_13 | AC | 33 ms
19,616 KB |
testcase_14 | AC | 32 ms
19,620 KB |
testcase_15 | AC | 35 ms
19,632 KB |
testcase_16 | AC | 33 ms
19,680 KB |
testcase_17 | AC | 33 ms
19,616 KB |
testcase_18 | AC | 125 ms
55,808 KB |
testcase_19 | AC | 123 ms
55,632 KB |
testcase_20 | AC | 124 ms
55,604 KB |
testcase_21 | AC | 125 ms
55,612 KB |
testcase_22 | AC | 125 ms
55,624 KB |
ソースコード
// #include <bits/stdc++.h> using namespace std; #define fi first #define se second #define all(x) x.begin(), x.end() #define lch (o << 1) #define rch (o << 1 | 1) typedef double db; typedef long long ll; typedef unsigned int ui; typedef pair<int, int> pint; typedef tuple<int, int, int> tint; const int N = 2e4; const int M = (1 << 10) + 5; const int INF = 0x3f3f3f3f; const ll INF_LL = 0x3f3f3f3f3f3f3f3f; bool f[N][M][2]; bool cnt[N * M]; int a[N], s[N]; int main() { ios::sync_with_stdio(0); int upp = 1 << 10; int n; cin >> n; for (int i = 1; i <= n; i++) cin >> a[i]; for (int i = n; i >= 0; i--) s[i] = s[i + 1] + a[i]; f[0][0][1] = 1; cnt[s[0]] = 1; int ans = 1; for (int i = 0; i < n; i++) { for (int j = 0; j < upp; j++) { for (int k = 0; k <= 1; k++) { if (!f[i][j][k]) continue; // add f[i + 1][(j + a[i + 1]) & (upp - 1)][0] = 1; // and f[i + 1][j & a[i + 1]][1] = 1; } } for (int j = 0; j < upp; j++) { if (f[i + 1][j][1] && cnt[j + s[i + 2]] == 0) { cnt[j + s[i + 2]] = 1; ans++; } } cout << ans << endl; } return 0; }