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

Submission #856281

Source Code Expand

Copy
```#include <bits/stdc++.h>

using namespace std;

int main() {
int N, A, x[50];

scanf("%d %d", &N, &A);
//cout << N << " " << A << endl;
for (int i = 0; i < N; i++) {
scanf("%d", &x[i]);
//cout << x[i] << " ";
}
//cout << endl;

// Try all possible 2^N subsets
long long ans = 0, sum, count; // Answer may not fit into 32-bit integer
for (int i = 0; i < (1 << min(25,N)); i++) {
sum = 0, count = 0;
for (int j = 0; j < N; j++) {
if ((1 << j) & i) {
//cout << "i, j : " << i << "," << j << endl;
sum += x[j];
count++;
}
}
if (A == 0 && count == 0) {
ans++;
} else if (A != 0 && count != 0 && sum == A * count) {
ans++;
}
//cout << i << " : " << sum << " " << count << " " <<  ans << endl;
}

printf("%lld\n", ans);

return 0;
}
```

#### Submission Info

Submission Time 2016-08-28 21:56:08+0900 C - Tak and Cards sozos C++14 (GCC 5.4.1) 200 824 Byte TLE 2105 ms 256 KB

#### Compile Error

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

#### Judge Result

Score / Max Score 0 / 0 200 / 200 0 / 100
Status
 AC × 3 TLE × 1
 AC × 12
 AC × 12 TLE × 12
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 4 ms 256 KB
example_04.txt TLE 2101 ms 256 KB
subtask1_01.txt AC 9 ms 256 KB
subtask1_02.txt AC 9 ms 256 KB
subtask1_03.txt AC 9 ms 256 KB
subtask1_04.txt AC 9 ms 256 KB
subtask1_05.txt AC 9 ms 256 KB
subtask1_06.txt AC 4 ms 256 KB
subtask1_07.txt AC 4 ms 256 KB
subtask1_08.txt AC 9 ms 256 KB
subtask1_09.txt AC 6 ms 256 KB
subtask2_01.txt TLE 2101 ms 256 KB
subtask2_02.txt TLE 2101 ms 256 KB
subtask2_03.txt TLE 2101 ms 256 KB
subtask2_04.txt TLE 2101 ms 256 KB
subtask2_05.txt TLE 2105 ms 256 KB
subtask2_06.txt TLE 2101 ms 256 KB
subtask2_07.txt TLE 2101 ms 256 KB
subtask2_08.txt TLE 2101 ms 256 KB
subtask2_09.txt TLE 2105 ms 256 KB
subtask2_10.txt TLE 2101 ms 256 KB
subtask2_11.txt TLE 2101 ms 256 KB