Submission #6419777
Source Code Expand
#include <bits/stdc++.h> #define INF LLONG_MAX #define Int long long #define rep(i,n) for(Int i=0; i<n; ++i) using namespace std; template<class T> inline bool chmin(T& a, T b) { if(a>b) {a=b; return true;} return false;} template<class T> inline bool chmas(T& a, T b) { if(a<b) {a=b; return true;} return false;} int main() { Int N; cin >> N; vector<Int> p(N); vector<vector<bool>> dp(N+1, vector<bool>(N*100+1, false)); rep(i,N) cin >> p[i]; dp[0][0] = true; rep(i,N) { rep(j, N*100+1) { if( dp[i][j] ) dp[i+1][j] = true; if( j>=p[i] && dp[i][j-p[i]]) dp[i+1][j] = true; } } Int cnt = 0; rep(i,N) { rep(j,N+10) { cout << dp[i][j] << " "; } cout << endl; } rep(i, N*100+1) if(dp[N][i]) cnt++; cout << cnt << endl; }
Submission Info
Submission Time | |
---|---|
Task | A - コンテスト |
User | yyatsuo |
Language | C++14 (GCC 5.4.1) |
Score | 0 |
Code Size | 811 Byte |
Status | WA |
Exec Time | 5 ms |
Memory | 384 KB |
Judge Result
Set Name | All | ||
---|---|---|---|
Score / Max Score | 0 / 2 | ||
Status |
|
Set Name | Test Cases |
---|---|
All | 00, 01, 02, 90, 91 |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
00 | WA | 1 ms | 256 KB |
01 | WA | 2 ms | 256 KB |
02 | WA | 5 ms | 384 KB |
90 | WA | 1 ms | 256 KB |
91 | WA | 1 ms | 256 KB |