Submission #11376566


Source Code Expand

/// hi_im_manh :D
#include <bits/stdc++.h>
#define reset(a,n) memset(a,0,(n+1)*sizeof(int))
#define endl "\n"
#define llmin LLONG_MIN
#define llmax LLONG_MAX
#define intmax INT_MAX
#define intmin INT_MIN
#define ll long long
#define fast ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL)

#define duckman "TASK"

#define input freopen(duckman".inp", "r", stdin);
#define output freopen(duckman".out", "w", stdout);

#define nmax 22000
using namespace std;


int main()
{
    fast;
//    input;
//    output;

    ll n;
    cin >> n;
    ll a[n];
    ll s = 0;
    for (ll i = 0; i < n; ++i) {
        cin >> a[i];
        s += a[i];
    }
    bool dp[s+1] = {0};
    dp[0] = 1;
    for (ll i = 0; i < n; ++i) {
        for (ll j = s; j >= a[i]; --j) {
            dp[j] = dp[j] || dp[j-a[i]];
        }
    }
    ll ans = 0;
    for (ll i = 0; i <= s; ++i) {
        ans += dp[i];
    }
    cout << ans;

    return 0;
}
/*

*/

Submission Info

Submission Time
Task A - コンテスト
User duckman
Language C++14 (GCC 5.4.1)
Score 0
Code Size 992 Byte
Status WA
Exec Time 2 ms
Memory 256 KB

Judge Result

Set Name All
Score / Max Score 0 / 2
Status
WA × 5
Set Name Test Cases
All 00, 01, 02, 90, 91
Case Name Status Exec Time Memory
00 WA 1 ms 256 KB
01 WA 1 ms 256 KB
02 WA 2 ms 256 KB
90 WA 1 ms 256 KB
91 WA 1 ms 256 KB