Submission #856029


Source Code Expand

Copy
#include <iostream>
#include <cstdio>
#include <vector>
#include <cmath>
#include <cstring>
#include <numeric>
#include <algorithm>
#include <functional>
#include <array>
#include <map>
#include <queue>
#include <limits.h>
#include <set>
#include <stack>
#define REP(i,n) for(int i = 0; n > i; i++)
#define MOD 1000000007
#define accm(i) ( (i)%2 ? od[((i)-1)/2] : ev[(i)/2])
#define acc(i) ( i%2 ? cpod[(i-1)/2] : cpev[i/2])
using namespace std;
typedef vector<int> Ivec;
typedef pair<int, int> pii;

int f(int n) {
	return (n*n+4)/8;
}

int main(){
	int n, a;

	scanf("%d %d", &n, &a);
	vector<int> num(n);
	REP(i, n) {
		scanf("%d", &num[i]);
	}
	long long int dp[51][51][2501] = {};
	dp[0][0][0] = 1;
	REP(i, n) {
		REP(j, n) {
			REP(k, 2501) {
				if (dp[i][j][k]) {
					dp[i + 1][j + 1][k+num[i]]+= dp[i][j][k];
					dp[i + 1][j][k]+= dp[i][j][k];
				}
			}
		}
	}
	long long int ans = 0;
	for(int i = 1; n+1 > i; i++) {
		ans += dp[n][i][a*i];
	}

	printf("%lld\n", ans);
	return 0;
}

Submission Info

Submission Time
Task C - Tak and Cards
User Gear
Language C++14 (GCC 5.4.1)
Score 300
Code Size 1046 Byte
Status AC
Exec Time 95 ms
Memory 51072 KB

Compile Error

./Main.cpp: In function ‘int main()’:
./Main.cpp:30:24: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d %d", &n, &a);
                        ^
./Main.cpp:33:23: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d", &num[i]);
                       ^

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 74 ms 51072 KB
example_02.txt AC 84 ms 51072 KB
example_03.txt AC 74 ms 51072 KB
example_04.txt AC 89 ms 51072 KB
subtask1_01.txt AC 85 ms 51072 KB
subtask1_02.txt AC 85 ms 51072 KB
subtask1_03.txt AC 85 ms 51072 KB
subtask1_04.txt AC 75 ms 51072 KB
subtask1_05.txt AC 86 ms 51072 KB
subtask1_06.txt AC 74 ms 51072 KB
subtask1_07.txt AC 84 ms 51072 KB
subtask1_08.txt AC 85 ms 51072 KB
subtask1_09.txt AC 85 ms 51072 KB
subtask2_01.txt AC 95 ms 51072 KB
subtask2_02.txt AC 84 ms 51072 KB
subtask2_03.txt AC 95 ms 51072 KB
subtask2_04.txt AC 95 ms 51072 KB
subtask2_05.txt AC 94 ms 51072 KB
subtask2_06.txt AC 84 ms 51072 KB
subtask2_07.txt AC 95 ms 51072 KB
subtask2_08.txt AC 89 ms 51072 KB
subtask2_09.txt AC 89 ms 51072 KB
subtask2_10.txt AC 86 ms 51072 KB
subtask2_11.txt AC 83 ms 51072 KB