Submission #856364


Source Code Expand

Copy
#include<bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
int d[1<<20];
int N;
int A;
int y[20];
long long dp(long long x){
    if(d[x]!=0)return 0;
    //cout<<x<<endl;
    d[x]=1;
    long long ans=0;
    REP(i,N){
        long long s=x;
        if((s>>i)!=1)ans+=dp(s|1<<i);
    }
    long long z=0;
    REP(i,N){
        long long s=x;
        if(s>>i&1){
           z+=y[i];
           //cout<<s<<" "<<i<<" "<<z<<endl;
        }
    }

    if(z==0){
       ans++;
       //cout<<x<<endl;
    }
    return ans;
}

int main(){
        memset(d,0,sizeof(d));
	cin>>N>>A;
	REP(i,N){
	    cin>>y[i];
	    y[i]-=A;
	}
	long long ans=0;
	REP(i,N){
	    ans+=dp(1<<i);
	}
        cout<<ans<<endl;
	return(0);
}

Submission Info

Submission Time
Task C - Tak and Cards
User rapurasu
Language C++14 (GCC 5.4.1)
Score 200
Code Size 922 Byte
Status WA
Exec Time 606 ms
Memory 4352 KB

Judge Result

Set Name Sample Subtask1 All
Score / Max Score 0 / 0 200 / 200 0 / 100
Status
AC × 3
WA × 1
AC × 12
AC × 13
WA × 3
RE × 8
Set Name Test Cases
Sample example_01.txt, example_02.txt, example_03.txt, example_04.txt
Subtask1 example_01.txt, example_02.txt, example_03.txt, subtask1_01.txt, subtask1_02.txt, subtask1_03.txt, subtask1_04.txt, subtask1_05.txt, subtask1_06.txt, subtask1_07.txt, subtask1_08.txt, subtask1_09.txt
All example_01.txt, example_02.txt, example_03.txt, example_04.txt, subtask1_01.txt, subtask1_02.txt, subtask1_03.txt, subtask1_04.txt, subtask1_05.txt, subtask1_06.txt, subtask1_07.txt, subtask1_08.txt, subtask1_09.txt, subtask2_01.txt, subtask2_02.txt, subtask2_03.txt, subtask2_04.txt, subtask2_05.txt, subtask2_06.txt, subtask2_07.txt, subtask2_08.txt, subtask2_09.txt, subtask2_10.txt, subtask2_11.txt
Case Name Status Exec Time Memory
example_01.txt AC 11 ms 4352 KB
example_02.txt AC 11 ms 4352 KB
example_03.txt AC 11 ms 4352 KB
example_04.txt WA 10 ms 4352 KB
subtask1_01.txt AC 22 ms 4352 KB
subtask1_02.txt AC 22 ms 4352 KB
subtask1_03.txt AC 22 ms 4352 KB
subtask1_04.txt AC 22 ms 4352 KB
subtask1_05.txt AC 22 ms 4352 KB
subtask1_06.txt AC 10 ms 4352 KB
subtask1_07.txt AC 10 ms 4352 KB
subtask1_08.txt AC 22 ms 4352 KB
subtask1_09.txt AC 16 ms 4352 KB
subtask2_01.txt WA 12 ms 4352 KB
subtask2_02.txt RE 606 ms 4352 KB
subtask2_03.txt RE 199 ms 4352 KB
subtask2_04.txt RE 198 ms 4352 KB
subtask2_05.txt RE 198 ms 4352 KB
subtask2_06.txt AC 11 ms 4352 KB
subtask2_07.txt RE 199 ms 4352 KB
subtask2_08.txt RE 204 ms 4352 KB
subtask2_09.txt RE 198 ms 4352 KB
subtask2_10.txt RE 202 ms 4352 KB
subtask2_11.txt WA 13 ms 4352 KB