Submission #2225319


Source Code Expand

# include <iostream>
# include <algorithm>
# include <vector>
# include <string>
# include <set>
# include <map>
# include <cmath>
# include <iomanip>
# include <functional>
# include <utility>
# include <stack>
# include <queue>
# include <list>
# include <tuple>
# include <unordered_map>
# include <numeric>
# include <complex>
# include <bitset>
# include <random>
# include <chrono>
using namespace std;
using LL = long long;
using ULL = unsigned long long;
typedef pair<LL, LL> P;
constexpr int INF = 2000000000;
constexpr int HINF = INF / 2;
constexpr double DINF = 100000000000000000.0;
constexpr long long LINF = 9223372036854775807;
constexpr long long HLINF = 4500000000000000000;
const double PI = acos(-1);
int dx[4] = { 0,1,0,-1 }, dy[4] = { 1,0,-1,0 };
# define ALL(x)      (x).begin(),(x).end()
# define UNIQ(c)     (c).erase(unique(ALL((c))),(c).end())
# define mp          make_pair
# define eb          emplace_back
# define FOR(i,a,b)  for(int i=(a);i<(b);i++)
# define RFOR(i,a,b) for(int i=(a);i>=(b);i--)
# define REP(i,n)    FOR(i,0,n)
# define INIT        std::ios::sync_with_stdio(false);std::cin.tie(0)

int n, a, x[550];
LL dp[55][55][2550];

int main() {
	cin >> n >> a;
	REP(i, n)cin >> x[i];
	dp[0][0][0]=1;
	REP(i, n) {
		REP(j, n) {
			REP(k, 2500) {
				dp[i + 1][j + 1][k + x[i]] += dp[i][j][k];
				dp[i + 1][j][k] += dp[i][j][k];
			}
		}
	}
	LL ans = 0;
	REP(i, n+1) {
		if(i)ans += dp[n][i][i*a];
	}
	cout << ans << endl;
}

Submission Info

Submission Time
Task C - Tak and Cards
User M3_cp
Language C++14 (GCC 5.4.1)
Score 300
Code Size 1522 Byte
Status AC
Exec Time 23 ms
Memory 56448 KB

Judge Result

Set Name Sample Subtask1 All
Score / Max Score 0 / 0 200 / 200 100 / 100
Status
AC × 4
AC × 12
AC × 24
Set Name Test Cases
Sample example_01.txt, example_02.txt, example_03.txt, example_04.txt
Subtask1 example_01.txt, example_02.txt, example_03.txt, subtask1_01.txt, subtask1_02.txt, subtask1_03.txt, subtask1_04.txt, subtask1_05.txt, subtask1_06.txt, subtask1_07.txt, subtask1_08.txt, subtask1_09.txt
All example_01.txt, example_02.txt, example_03.txt, example_04.txt, subtask1_01.txt, subtask1_02.txt, subtask1_03.txt, subtask1_04.txt, subtask1_05.txt, subtask1_06.txt, subtask1_07.txt, subtask1_08.txt, subtask1_09.txt, subtask2_01.txt, subtask2_02.txt, subtask2_03.txt, subtask2_04.txt, subtask2_05.txt, subtask2_06.txt, subtask2_07.txt, subtask2_08.txt, subtask2_09.txt, subtask2_10.txt, subtask2_11.txt
Case Name Status Exec Time Memory
example_01.txt AC 2 ms 4480 KB
example_02.txt AC 2 ms 2432 KB
example_03.txt AC 3 ms 8576 KB
example_04.txt AC 13 ms 35712 KB
subtask1_01.txt AC 6 ms 17024 KB
subtask1_02.txt AC 6 ms 17024 KB
subtask1_03.txt AC 6 ms 17024 KB
subtask1_04.txt AC 6 ms 17024 KB
subtask1_05.txt AC 6 ms 17024 KB
subtask1_06.txt AC 1 ms 256 KB
subtask1_07.txt AC 1 ms 256 KB
subtask1_08.txt AC 6 ms 17024 KB
subtask1_09.txt AC 5 ms 16896 KB
subtask2_01.txt AC 23 ms 56448 KB
subtask2_02.txt AC 23 ms 56448 KB
subtask2_03.txt AC 22 ms 54400 KB
subtask2_04.txt AC 23 ms 56448 KB
subtask2_05.txt AC 23 ms 56448 KB
subtask2_06.txt AC 23 ms 56448 KB
subtask2_07.txt AC 23 ms 56448 KB
subtask2_08.txt AC 13 ms 35712 KB
subtask2_09.txt AC 13 ms 35712 KB
subtask2_10.txt AC 17 ms 46208 KB
subtask2_11.txt AC 19 ms 48256 KB