Submission #855133


Source Code Expand

Copy
#include <iostream>
#include <vector>
#include <string>
#include <sstream>
#include <utility>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <istream>
#include <ostream>

#include <cstdlib>
#include <cmath>
#include <cstdio>

using namespace std;

#define fi first
#define se second
#define mkp make_pair
#define all(x) (x).begin(), (x).end()
#define pb push_back
#define rep(i,n) for(ll i=0; i < (n); ++i)
#define rrep(i,n) for(ll i=((n)-1); i >= 0; --i)

#define OPLT(T) bool operator<(const T & lop_, const T & rop_)
#define OPEQ(T) bool operator==(const T & lop_, const T & rop_)

typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

istream& operator>>(istream& istr, __float128& obj) { double d; istr >> d; obj = d; return istr; };
ostream& operator<<(ostream& ostr, __float128& obj) { ostr << static_cast<double>(obj); return ostr; };

ll dp[60][60][3000];

int main() {
	int N, A;
	cin >> N >> A;
	vector<int> x(N);
	rep(i,N)
		cin >> x[i];
	sort(x.begin(), x.end());
	dp[0][0][0] = 1;
	rep(i,N) {
		rep(j,N) {
			rep(k,3000) {
				dp[i+1][j][k] += dp[i][j][k];
				if(x[i] + k < 3000)
					dp[i+1][j+1][k+x[i]] += dp[i][j][k];
			}
		}
	}

	ll res = 0;
	rep(i,N) {
		res += dp[N][i+1][A*(i+1)];
	}
	cout << res << endl;
	return 0;
}

Submission Info

Submission Time
Task C - Tak and Cards
User konjo
Language C++14 (GCC 5.4.1)
Score 300
Code Size 1375 Byte
Status AC
Exec Time 101 ms
Memory 60160 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 5 ms 768 KB
example_02.txt AC 4 ms 512 KB
example_03.txt AC 7 ms 1920 KB
example_04.txt AC 47 ms 26624 KB
subtask1_01.txt AC 15 ms 6656 KB
subtask1_02.txt AC 14 ms 6656 KB
subtask1_03.txt AC 17 ms 6656 KB
subtask1_04.txt AC 15 ms 6656 KB
subtask1_05.txt AC 15 ms 6656 KB
subtask1_06.txt AC 4 ms 256 KB
subtask1_07.txt AC 4 ms 256 KB
subtask1_08.txt AC 14 ms 6656 KB
subtask1_09.txt AC 13 ms 5888 KB
subtask2_01.txt AC 101 ms 60160 KB
subtask2_02.txt AC 99 ms 60160 KB
subtask2_03.txt AC 96 ms 57856 KB
subtask2_04.txt AC 101 ms 60160 KB
subtask2_05.txt AC 101 ms 60160 KB
subtask2_06.txt AC 100 ms 60160 KB
subtask2_07.txt AC 100 ms 60160 KB
subtask2_08.txt AC 47 ms 26624 KB
subtask2_09.txt AC 53 ms 26624 KB
subtask2_10.txt AC 77 ms 40704 KB
subtask2_11.txt AC 84 ms 44800 KB