Submission #854997


Source Code Expand

Copy
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>	
#include<map>
#include<set>
#include<utility>
#include<cmath>
#include<cstring>
#include<queue>
#include<cstdio>
#include<sstream>
#include<iomanip>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define mp make_pair
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
using namespace std;
//kaewasuretyuui
typedef long long ll;
typedef pair<int,int> pii;
typedef vector<ll> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef pair<int,pii> pip;
typedef vector<pip>vip;
const double PI=acos(-1);
const double EPS=1e-8;
const int inf=1e8;
int main(){
	int n,m;
	cin>>n>>m;
	vi in(n);
	rep(i,n)cin>>in[i];
	vvi dp(n+1,vi(3000));
	dp[0][0]=1;
	rep(k,n)for(int i=n-1;i>=0;i--)rep(j,3000)if(dp[i][j]){
		dp[i+1][j+in[k]]+=dp[i][j];
	}
	ll out=0;
	rep(i,n)out+=dp[i+1][m*(i+1)];
	cout<<out<<endl;
}
 
 





Submission Info

Submission Time
Task C - Tak and Cards
User ixmel_rd
Language C++14 (GCC 5.4.1)
Score 300
Code Size 1030 Byte
Status AC
Exec Time 15 ms
Memory 1408 KB

Judge Result

Set Name Sample Subtask1 All
Score / Max Score 0 / 0 200 / 200 100 / 100
Status
AC × 4
AC × 12
AC × 24
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 4 ms 384 KB
example_02.txt AC 4 ms 384 KB
example_03.txt AC 4 ms 512 KB
example_04.txt AC 9 ms 1024 KB
subtask1_01.txt AC 6 ms 640 KB
subtask1_02.txt AC 6 ms 640 KB
subtask1_03.txt AC 6 ms 640 KB
subtask1_04.txt AC 5 ms 640 KB
subtask1_05.txt AC 6 ms 640 KB
subtask1_06.txt AC 4 ms 256 KB
subtask1_07.txt AC 4 ms 256 KB
subtask1_08.txt AC 6 ms 640 KB
subtask1_09.txt AC 6 ms 640 KB
subtask2_01.txt AC 15 ms 1408 KB
subtask2_02.txt AC 15 ms 1408 KB
subtask2_03.txt AC 15 ms 1408 KB
subtask2_04.txt AC 15 ms 1408 KB
subtask2_05.txt AC 15 ms 1408 KB
subtask2_06.txt AC 15 ms 1408 KB
subtask2_07.txt AC 15 ms 1408 KB
subtask2_08.txt AC 9 ms 1024 KB
subtask2_09.txt AC 9 ms 1024 KB
subtask2_10.txt AC 13 ms 1280 KB
subtask2_11.txt AC 14 ms 1280 KB