Submission #6411862
Source Code Expand
#include <bits/stdc++.h> #define debug(x) cerr << #x << ": " << x << '\n'; using namespace std; using ll = long long; using P = pair<int, int>; const int INF = (int)1e9; int N; int p[100]; bool dp[100][10100]; int main(void){ cin >> N; for(int i = 0; i < N; i++) cin >> p[i]; dp[0][0] = true; dp[0][p[0]] = true; for(int i = 0; i < N-1; i++){ for(int j = 0; j <= 10000; j++){ if(dp[i][j]){ dp[i+1][j] = true; dp[i+1][j+p[i+1]] = true; } } } int res = 0; for(int i = 0; i <= 10000; i++){ if(dp[N-1][i]) res++; } cout << res << '\n'; return 0; }
Submission Info
Submission Time | |
---|---|
Task | A - コンテスト |
User | yna87 |
Language | C++14 (GCC 5.4.1) |
Score | 2 |
Code Size | 702 Byte |
Status | AC |
Exec Time | 2 ms |
Memory | 896 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 | 1 ms | 256 KB |
01 | AC | 2 ms | 512 KB |
02 | AC | 2 ms | 896 KB |
90 | AC | 1 ms | 256 KB |
91 | AC | 1 ms | 256 KB |