Submission #3045981
Source Code Expand
#include <bits/stdc++.h> using namespace std; #define ll long long #define int long long #define rep(i, a) for (int i = 0; i < (int) (a); i++) #define reps(i, a, b) for (int i = (int) (a); i < (int) (b); i++) #define rrep(i, a) for (int i = (int) a-1; i >= 0; i--) #define rreps(i, a, b) for (int i = (int) (a)-1; i >= (int) (b); i--) #define MP(a, b) make_pair((a), (b)) #define PB(a) push_back((a)) #define all(v) (v).begin(), (v).end() #define PRINT(f) if((f)){cout << (TRUE__) << endl;}else{cout << FALSE__ << endl;} #define TRUE__ "Yes" #define FALSE__ "No" #define PERM(v) next_permutation(all(v)) #define UNIQUE(v) sort(all(v));(v).erase(unique(all(v)), v.end()) #define CIN(type, x) type x;cin >> x #ifdef LOCAL #define lcout(a) cout << a; #define lcoutln(a) cout << a << endl; #define lcerr(a) cerr << a; #define lcerrln(a) cerr << a << endl; #else #define lcout(a) #define lcoutln(a) #define lcerr(a) #define lcerrln(a) #endif int N, P; int a[2]; ll C[51][51]; ll comb(int a, int b) { b = min(b, a - b); if (C[a][b]) return C[a][b]; return C[a][b] = comb(a-1, b-1) + comb(a-1, b); } ll culc() { ll res = 1 << a[0]; ll x = 1; for (int i = 2; i <= a[1]; i+=2) { x += comb(a[1], i); } return x * res; } signed main() { cin >> N >> P; rep(i, 51) { C[i][0] = 1; C[i][1] = i; } rep(i, N) { CIN(int, t); a[t % 2]++; } ll res = 0; if (P) { if (a[1] == 0) { cout << 0 << endl; return 0; } a[1]--; while (a[1] >= 0) { res += culc(); a[1] -= 1; } cout << res << endl; } else { cout << culc() << endl; } }
Submission Info
Submission Time | |
---|---|
Task | A - Biscuits |
User | spihill |
Language | C++ (GCC 5.4.1) |
Score | 0 |
Code Size | 1650 Byte |
Status | WA |
Exec Time | 1 ms |
Memory | 256 KB |
Judge Result
Set Name | Sample | All | ||||||
---|---|---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 0 / 200 | ||||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | sample1.txt, sample2.txt, sample3.txt, sample4.txt |
All | sample1.txt, sample2.txt, sample3.txt, sample4.txt, in1.txt, in2.txt, in3.txt, in4.txt, in5.txt, in6.txt, in7.txt, in8.txt, sample1.txt, sample2.txt, sample3.txt, sample4.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
in1.txt | AC | 1 ms | 256 KB |
in2.txt | AC | 1 ms | 256 KB |
in3.txt | WA | 1 ms | 256 KB |
in4.txt | WA | 1 ms | 256 KB |
in5.txt | AC | 1 ms | 256 KB |
in6.txt | AC | 1 ms | 256 KB |
in7.txt | AC | 1 ms | 256 KB |
in8.txt | AC | 1 ms | 256 KB |
sample1.txt | AC | 1 ms | 256 KB |
sample2.txt | AC | 1 ms | 256 KB |
sample3.txt | AC | 1 ms | 256 KB |
sample4.txt | AC | 1 ms | 256 KB |