Submission #19427813


Source Code Expand

Copy
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
#define rep(i,s,n) for(int i = s; i < (int)(n); i++)

int main() {
	int n;
	cin >> n;
	vector<int>p(n);
	rep(i, 0, n) cin >> p[i];
	vector<vector<bool>>dp(n + 1, vector<bool>(100 * n + 101));
	dp[0][0] = 1;
	rep(i, 0, n) rep(j, 0, 100 * n + 1) {
		if (!dp[i][j]) continue;
		dp[i + 1][j] = 1;
		dp[i + 1][j + p[i]] = 1;
	}
	int ans = 0;
	rep(i, 0, 100 * n + 1) ans += dp[n][i];
	cout << ans << endl;
}

Submission Info

Submission Time
Task A - コンテスト
User okake
Language C++ (GCC 9.2.1)
Score 2
Code Size 516 Byte
Status AC
Exec Time 7 ms
Memory 3624 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 7 ms 3464 KB
01 AC 4 ms 3436 KB
02 AC 6 ms 3536 KB
90 AC 2 ms 3604 KB
91 AC 2 ms 3624 KB