Submission #1408478


Source Code Expand

#include<cstdio>
#include<queue>
#include<algorithm>
#define ld long double
#define MN 21000000
using namespace std;

int read_p,read_ca;
inline int read(){
    read_p=0;read_ca=getchar();
    while(read_ca<'0'||read_ca>'9') read_ca=getchar();
    while(read_ca>='0'&&read_ca<='9') read_p=read_p*10+read_ca-48,read_ca=getchar();
    return read_p;
}
int n,p,a;
long long mmh[2];
int main(){
	mmh[0]=1;
	n=read();p=read();
	while(n--){
		a=read()&1;
		if (a&1){
			mmh[0]=mmh[1]=mmh[1]+mmh[0];
		}else mmh[0]<<=1,mmh[1]<<=1;
	}
	printf("%lld\n",mmh[p]);
}

Submission Info

Submission Time
Task A - Biscuits
User swm_sxt
Language C++14 (GCC 5.4.1)
Score 200
Code Size 580 Byte
Status AC
Exec Time 0 ms
Memory 128 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 200 / 200
Status
AC × 4
AC × 16
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 0 ms 128 KB
in2.txt AC 0 ms 128 KB
in3.txt AC 0 ms 128 KB
in4.txt AC 0 ms 128 KB
in5.txt AC 0 ms 128 KB
in6.txt AC 0 ms 128 KB
in7.txt AC 0 ms 128 KB
in8.txt AC 0 ms 128 KB
sample1.txt AC 0 ms 128 KB
sample2.txt AC 0 ms 128 KB
sample3.txt AC 0 ms 128 KB
sample4.txt AC 0 ms 128 KB