Submission #1408973


Source Code Expand

Copy
#include<bits/stdc++.h>
#define pp pair<int,int>
#define MZ 1000000007
#define Pi acos(-1)
#define pq priority_queue

using namespace std;

long long ans=0,num[66];
long long c[55][55];

int main()
{
    int n,a=0,b=0,p,m;
    scanf("%d%d",&n,&p);
    for(int i=0;i<=n;i++)
    {
        c[i][0]=1;
        for(int j=1;j<=i;j++)
            c[i][j]=c[i-1][j-1]+c[i-1][j];
    }
    for(int i=0;i<n;i++)
    {
        scanf("%d",&m);
        if(m%2)
            a++;
        else
            b++;
    }
    num[0]=1;
    for(int i=1;i<=n;i++)
        num[i]=num[i-1]*2;
    if(p)
    {
        for(int i=1;i<=a;i+=2)
            ans+=c[a][i];
    }
    else
    {
        for(int i=0;i<=a;i+=2)
            ans+=c[a][i];
    }
    printf("%lld\n",ans*num[b]);
    return 0;
}

Submission Info

Submission Time
Task A - Biscuits
User TryMyEdge
Language C++14 (GCC 5.4.1)
Score 200
Code Size 820 Byte
Status
Exec Time 1 ms
Memory 256 KB

Compile Error

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

Judge Result

Set Name Score / Max Score Test Cases
Sample 0 / 0 sample1.txt, sample2.txt, sample3.txt, sample4.txt
All 200 / 200 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 1 ms 256 KB
in2.txt 1 ms 256 KB
in3.txt 1 ms 256 KB
in4.txt 1 ms 256 KB
in5.txt 1 ms 256 KB
in6.txt 1 ms 256 KB
in7.txt 1 ms 256 KB
in8.txt 1 ms 256 KB
sample1.txt 1 ms 256 KB
sample2.txt 1 ms 256 KB
sample3.txt 1 ms 256 KB
sample4.txt 1 ms 256 KB