Submission #5127160


Source Code Expand

#include<bits/stdc++.h>
using namespace std;
using ll = long long;

#define FOR(i,a,b) for(ll i=(a);i<(b);++i)
#define ALL(v) (v).begin(), (v).end()
#define p(s) cout<<(s)<<endl
#define p2(s, t) cout << (s) << " " << (t) << endl
#define br() p("")
#define pn(s) cout << (#s) << " " << (s) << endl

bool dp[10010];

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);

    // input
    ll N;
    cin >> N;

    vector<ll> A(N);
    FOR(i, 0, N){
        cin >> A.at(i);
    }

    dp[0] = true;

    for(ll a : A){
        for(int i=10009; i>=0; i--){
            if(dp[i]){
                dp[i+a] = true;
            }
        }
    }

    ll ans = 0;
    FOR(i, 0, 10010){
        if(dp[i]) ans++;
    }
    p(ans);
    
    return 0;
}

Submission Info

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

Judge Result

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