Submission #6349251
Source Code Expand
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int,int> P; typedef vector<int> VI; template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; } template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; } #define _overload3(_1,_2,_3,name,...) name #define _rep(i,n) repi(i,0,n) #define repi(i,a,b) for(int i=int(a);i<int(b);++i) #define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__) #define all(x) (x).begin(),(x).end() const int mod=1e9+7; int main(){ int n;cin>>n; int p[n];rep(i,n)cin>>p[i]; int dp[101][10001]={}; dp[0][0]=1; rep(i,n){ rep(j,10001){ if(dp[i][j])dp[i+1][j]=1; if(j+p[i]<=10000){ dp[i+1][j+p[i]]=dp[i][j]&1; } } } int ans=0; rep(i,10001)if(dp[n][i])ans++; cout<<ans<<endl; }
Submission Info
Submission Time | |
---|---|
Task | A - コンテスト |
User | meimon |
Language | C++14 (GCC 5.4.1) |
Score | 2 |
Code Size | 934 Byte |
Status | AC |
Exec Time | 4 ms |
Memory | 4224 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 | 3 ms | 4224 KB |
01 | AC | 3 ms | 4224 KB |
02 | AC | 4 ms | 4224 KB |
90 | AC | 3 ms | 4224 KB |
91 | AC | 3 ms | 4224 KB |