Submission #3013431
Source Code Expand
#include <iostream> #include <algorithm> #include <array> using ll = long long; using namespace std; int main() { int n, m = 0; cin >> n; int a[100]; array<bool, 11000> dp{}; for (int i = 0; i < n; ++i) { cin >> a[i]; m += a[i]; } dp[0] = true; for (int i = 0; i < n; ++i) { for (int j = 10000-a[i]; j >= 0; --j) { dp[j+a[i]] = dp[j]|dp[j+a[i]]; } } cout << count(dp.begin(), dp.end(), true) << "\n"; return 0; }
Submission Info
Submission Time | |
---|---|
Task | A - コンテスト |
User | firiexp |
Language | C++14 (GCC 5.4.1) |
Score | 2 |
Code Size | 528 Byte |
Status | AC |
Exec Time | 2 ms |
Memory | 256 KB |
Judge Result
Set Name | All | ||
---|---|---|---|
Score / Max Score | 2 / 2 | ||
Status |
|
Set Name | Test Cases |
---|---|
All | 00, 01, 02, 90, 91 |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
00 | AC | 1 ms | 256 KB |
01 | AC | 1 ms | 256 KB |
02 | AC | 2 ms | 256 KB |
90 | AC | 1 ms | 256 KB |
91 | AC | 1 ms | 256 KB |