Contest Duration: - (local time) (100 minutes) Back to Home

Submission #855020

Source Code Expand

Copy
```#include "bits/stdc++.h"
using namespace std;
#define FOR(i,j,k) for(int (i)=(j);(i)<(int)(k);++(i))
#define rep(i,j) FOR(i,0,j)
#define each(x,y) for(auto &(x):(y))
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define debug(x) cout<<#x<<": "<<(x)<<endl
#define smax(x,y) (x)=max((x),(y))
#define smin(x,y) (x)=min((x),(y))
#define MEM(x,y) memset((x),(y),sizeof (x))
#define sz(x) (int)(x).size()
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<ll> vll;

ll dp[51][51][2501];

int main(){
int N, A;
cin >> N >> A;
vi x(N);
rep(i, N)scanf("%d", &x[i]);

dp[0][0][0] = 1;
rep(i, N)rep(j, N)rep(k, 2501){
ll y = dp[i][j][k];
if(y == 0)continue;
dp[i + 1][j + 1][k + x[i]] += y;
dp[i + 1][j][k] += y;
}

ll ans = 0;
FOR(n, 1, N + 1)rep(sm, 2501){
if(sm%n == 0 && sm / n == A){
ans += dp[N][n][sm];
}
}
cout << ans << endl;
}```

Submission Info

Submission Time 2016-08-28 21:07:11+0900 C - Tak and Cards paruki C++14 (GCC 5.4.1) 300 1019 Byte AC 55 ms 9600 KB

Compile Error

```./Main.cpp: In function ‘int main()’:
./Main.cpp:24:32: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
rep(i, N)scanf("%d", &x[i]);
^
```

Judge Result

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
Case Name Status Exec Time Memory
example_01.txt AC 4 ms 256 KB
example_02.txt AC 4 ms 256 KB
example_03.txt AC 5 ms 384 KB
example_04.txt AC 23 ms 2560 KB
subtask1_01.txt AC 9 ms 896 KB
subtask1_02.txt AC 10 ms 896 KB
subtask1_03.txt AC 9 ms 896 KB
subtask1_04.txt AC 9 ms 896 KB
subtask1_05.txt AC 9 ms 1024 KB
subtask1_06.txt AC 4 ms 256 KB
subtask1_07.txt AC 4 ms 256 KB
subtask1_08.txt AC 9 ms 896 KB
subtask1_09.txt AC 8 ms 896 KB
subtask2_01.txt AC 48 ms 8320 KB
subtask2_02.txt AC 49 ms 8320 KB
subtask2_03.txt AC 52 ms 7808 KB
subtask2_04.txt AC 46 ms 5504 KB
subtask2_05.txt AC 46 ms 5504 KB
subtask2_06.txt AC 46 ms 5504 KB
subtask2_07.txt AC 55 ms 9600 KB
subtask2_08.txt AC 26 ms 3328 KB
subtask2_09.txt AC 27 ms 3456 KB
subtask2_10.txt AC 38 ms 5376 KB
subtask2_11.txt AC 41 ms 6144 KB