Submission #1443302


Source Code Expand

// ORZ YJZ
#include <bits/stdc++.h>
#define ll long long
#define pii pair<int, int>
#define rep(i,a,b) for(int (i) = (a); (i) <= (b); i++)
#define repd(i,a,b) for(int (i) = (a); (i) >= (b); i--)
#define foreach(it,c) for(__typeof((c).begin()) it=(c).begin(); it!=(c).end(); it++)
#define mp make_pair
#define pb push_back
using namespace std;
#define is_digit(c) ((c) >= '0' && (c) <= '9')
#define is_upper(c) ((c) >= 'A' && (c) <= 'Z')
#define is_lower(c) ((c) >= 'a' && (c) <= 'z')
#define readchar() ((char)fgetc(stdin))
#define printchar(c) fputc((c), stdout)
void readline(char *s) {int len=0;char c;for(c=readchar(); c!='\n'; s[len++]=c, c=readchar());s[len]=0;}
void readstr(char *s) {int len=0;char c;for(c=readchar(); c!=' '&&c!='\n'; s[len++]=c, c=readchar());s[len]=0;}
void printstr(const char *s) {int len=strlen(s);rep(i,0,len-1) printchar(s[i]);}
void to_lower(char *s, int L, int R) {rep(i,L,R) if (is_upper(s[i])) s[i]=s[i]-'A'+'a';}
void to_upper(char *s, int L, int R) {rep(i,L,R) if (is_lower(s[i])) s[i]=s[i]-'a'+'A';}
ll readll() {
	char c;ll ans=0, x=1;for (c=readchar(); !is_digit(c)&&c!='-'; c=readchar());
	if (c=='-') x=-1, c=readchar();for (; is_digit(c); ans=ans*10+c-'0', c=readchar());return ans*x;
}
void printll(ll x) {
	int a[25], cnt=0;if (x==0) { printchar('0'); return; }if (x<0) printchar('-'), x=-x;
	for (; x; a[cnt++]=x-x/10*10, x/=10);repd(i,cnt-1,0) printchar(a[i]+'0');
}
#define readint() ((int)readll())
#define printint(x) printll((ll)(x))
int n, K, a[405];
vector<ll> dp[405];
int main() {
	n=readint();K=readint();
	rep(i,1,n) a[i]=readint();
	int ans=0;
	dp[0].pb(0);
	rep(i,1,n) {
		rep(j,1,n) dp[j]=vector<ll>();
		rep(j,1,n) {
			rep(k,0,(int)dp[j-1].size()-1) {
				dp[j].pb(dp[j-1][k]);
				if (j!=i) dp[j].pb(dp[j-1][k]+a[j]);
			}
		}
		bool f=false;
		rep(j,0,dp[n].size()-1) if (dp[n][j]>=K-a[i]&&dp[n][j]<K) {
			f=true;break;
		}
		if (!f) ans++;
	}
	printint(ans);
	return 0;
}

Submission Info

Submission Time
Task D - No Need
User denverjin
Language C++14 (GCC 5.4.1)
Score 0
Code Size 1994 Byte
Status RE
Exec Time 2120 ms
Memory 8484 KB

Judge Result

Set Name Sample Subtask All
Score / Max Score 0 / 0 0 / 300 0 / 300
Status
AC × 3
AC × 11
TLE × 15
AC × 18
WA × 4
TLE × 15
RE × 14
Set Name Test Cases
Sample 0_000.txt, 0_001.txt, 0_002.txt
Subtask 0_000.txt, 0_001.txt, 0_002.txt, 1_003.txt, 1_004.txt, 1_005.txt, 1_006.txt, 1_007.txt, 1_008.txt, 1_009.txt, 1_010.txt, 1_011.txt, 1_012.txt, 1_013.txt, 1_014.txt, 1_015.txt, 1_016.txt, 1_017.txt, 1_018.txt, 1_019.txt, 1_020.txt, 1_021.txt, 1_022.txt, 1_023.txt, 1_024.txt, 1_025.txt
All 0_000.txt, 0_001.txt, 0_002.txt, 1_003.txt, 1_004.txt, 1_005.txt, 1_006.txt, 1_007.txt, 1_008.txt, 1_009.txt, 1_010.txt, 1_011.txt, 1_012.txt, 1_013.txt, 1_014.txt, 1_015.txt, 1_016.txt, 1_017.txt, 1_018.txt, 1_019.txt, 1_020.txt, 1_021.txt, 1_022.txt, 1_023.txt, 1_024.txt, 1_025.txt, 2_026.txt, 2_027.txt, 2_028.txt, 2_029.txt, 2_030.txt, 2_031.txt, 2_032.txt, 2_033.txt, 2_034.txt, 2_035.txt, 2_036.txt, 2_037.txt, 2_038.txt, 2_039.txt, 2_040.txt, 2_041.txt, 2_042.txt, 2_043.txt, 2_044.txt, 2_045.txt, 2_046.txt, 2_047.txt, 2_048.txt, 2_049.txt, 2_050.txt
Case Name Status Exec Time Memory
0_000.txt AC 1 ms 256 KB
0_001.txt AC 1 ms 256 KB
0_002.txt AC 1 ms 256 KB
1_003.txt AC 1 ms 256 KB
1_004.txt AC 1 ms 256 KB
1_005.txt AC 1 ms 256 KB
1_006.txt AC 2 ms 508 KB
1_007.txt AC 2 ms 508 KB
1_008.txt TLE 2118 ms -2090076 KB
1_009.txt TLE 2120 ms -1834404 KB
1_010.txt TLE 2120 ms -1832740 KB
1_011.txt TLE 2120 ms -1834404 KB
1_012.txt TLE 2119 ms -1834404 KB
1_013.txt TLE 2119 ms -1833252 KB
1_014.txt TLE 2117 ms -1833508 KB
1_015.txt TLE 2117 ms -1833124 KB
1_016.txt AC 6 ms 768 KB
1_017.txt AC 1 ms 256 KB
1_018.txt AC 1 ms 256 KB
1_019.txt TLE 2117 ms -1833000 KB
1_020.txt TLE 2117 ms -1834020 KB
1_021.txt TLE 2117 ms -1833508 KB
1_022.txt TLE 2117 ms -1833508 KB
1_023.txt TLE 2116 ms -1833636 KB
1_024.txt TLE 2117 ms -1833380 KB
1_025.txt TLE 2117 ms -1833124 KB
2_026.txt AC 1 ms 256 KB
2_027.txt AC 67 ms 8468 KB
2_028.txt AC 67 ms 8484 KB
2_029.txt AC 1 ms 256 KB
2_030.txt WA 1 ms 256 KB
2_031.txt RE 405 ms 256 KB
2_032.txt RE 96 ms 256 KB
2_033.txt RE 96 ms 256 KB
2_034.txt RE 96 ms 256 KB
2_035.txt RE 96 ms 256 KB
2_036.txt RE 95 ms 256 KB
2_037.txt AC 1 ms 256 KB
2_038.txt AC 2 ms 384 KB
2_039.txt AC 2 ms 384 KB
2_040.txt RE 96 ms 256 KB
2_041.txt RE 96 ms 256 KB
2_042.txt RE 102 ms 256 KB
2_043.txt WA 1 ms 256 KB
2_044.txt RE 97 ms 256 KB
2_045.txt RE 95 ms 256 KB
2_046.txt WA 1 ms 256 KB
2_047.txt RE 96 ms 256 KB
2_048.txt WA 1 ms 256 KB
2_049.txt RE 96 ms 256 KB
2_050.txt RE 95 ms 256 KB