Submission #19426935


Source Code Expand

Copy
/*** author: yuji9511 ***/
#include <bits/stdc++.h>
// #include <atcoder/all>
// using namespace atcoder;
using namespace std;
using ll = long long;
using lpair = pair<ll, ll>;
using vll = vector<ll>;
const ll MOD = 1e9+7;
const ll INF = 1e18;
#define rep(i,m,n) for(ll i=(m);i<(n);i++)
#define rrep(i,m,n) for(ll i=(m);i>=(n);i--)
ostream& operator<<(ostream& os, lpair& h){ os << "(" << h.first << ", " << h.second << ")"; return os;}
#define printa(x,n) for(ll i=0;i<n;i++){cout<<(x[i])<<" \n"[i==n-1];};
void print() {}
template <class H,class... T>
void print(H&& h, T&&... t){cout<<h<<" \n"[sizeof...(t)==0];print(forward<T>(t)...);}

void solve(){
    ll N;
    cin >> N;
    vll p(N);
    rep(i,0,N) cin >> p[i];
    vll dp(10001,0);
    dp[0] = 1;
    rep(i,0,N){
        rrep(j,10000,p[i]){
            dp[j] += dp[j-p[i]];
        }
    }
    ll ans = 0;
    rep(i,0,10001) ans += (dp[i] > 0);
    print(ans);
    

}

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

Submission Info

Submission Time
Task A - コンテスト
User yuji9511
Language C++ (GCC 9.2.1)
Score 0
Code Size 1046 Byte
Status WA
Exec Time 7 ms
Memory 3624 KB

Judge Result

Set Name All
Score / Max Score 0 / 2
Status
AC × 4
WA × 1
Set Name Test Cases
All 00, 01, 02, 90, 91
Case Name Status Exec Time Memory
00 AC 7 ms 3492 KB
01 AC 3 ms 3624 KB
02 WA 4 ms 3584 KB
90 AC 2 ms 3508 KB
91 AC 2 ms 3600 KB