Submission #3572000
Source Code Expand
#include <iostream> #include <string.h> #include <stdio.h> #include <map> #include <vector> #include <math.h> #include <algorithm> #include <queue> #include <set> #include <tuple> #include <bitset> using namespace std; #define rep(i,a) for(int i=0; i<a; i++) #define rrep(i,a) for(int i=a; i>=0; i--) #define rep1(i,a) for(int i=1; i<=a; i++) #define cout1(a) cout << a << endl; #define cout2(a,b) cout << a << " " << b << endl; #define cout3(a,b,c) cout << a << " " << b << " " << c << endl; #define cout4(a,b,c,d) cout << a << " " << b << " " << c << " " << d << endl; #define mem(a,n) memset( a, n, sizeof(a)) #define all(a) a.begin(),a.end() typedef long long ll; typedef long double ld; typedef pair<int,int> pii; typedef vector<int> V; typedef vector<V> VV; typedef vector<VV> VVV; const int INF = 1e9; const int MOD = 1e9+7; const ll LLINF = 1e18; static const double pi = 3.141592653589793; int N, K; int nums[5009]; bitset<8192> L[5009], R[5009]; ll LT[5009], RT[5009]; int main() { cin.tie(0); ios::sync_with_stdio(false); cin>>N>>K; rep(i,N) cin>>nums[i]; L[0][0]=1; R[N+1][0]=1; rep(i,N){ bitset<8192> T=L[i]; T<<=nums[i]; if(L[i].count()!=T.count()) L[i+1][8191]=1; LT[i+1]=LT[i]+nums[i]; } rrep(i,N-1){ bitset<8192> T=R[i+2]; T<<=nums[i]; R[i+1]=R[i+2]|T; if(R[i+2].count()!=T.count()) R[i+1][8191]=1; RT[i+1]=RT[i+2]+nums[i]; } int ret=0; rep(i,N){ ll LB=max(0,K-nums[i]); ll RB=K-1; deque<int> AA,BB; rep(x,8192) if(R[i+2][x]) AA.push_back(x); int hoge=1; rep(x,8192) if(L[i][x]){ ll LB2=LB-x, RB2=RB-x; while(AA.size()&&AA.back()>=LB2) BB.push_front(AA.back()), AA.pop_back(); while(BB.size()&&BB.back()>RB2) BB.pop_back(); if(BB.size()){ hoge=0; break; } } ret+=hoge; } cout1(ret); }
Submission Info
Submission Time | |
---|---|
Task | D - No Need |
User | mensan_fukuhara |
Language | C++14 (GCC 5.4.1) |
Score | 0 |
Code Size | 2085 Byte |
Status | WA |
Exec Time | 289 ms |
Memory | 10368 KB |
Judge Result
Set Name | Sample | Subtask | All | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 0 / 300 | 0 / 300 | ||||||||||||
Status |
|
|
|
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 | WA | 2 ms | 2304 KB |
0_001.txt | AC | 2 ms | 2304 KB |
0_002.txt | WA | 2 ms | 2304 KB |
1_003.txt | AC | 2 ms | 2304 KB |
1_004.txt | AC | 2 ms | 2304 KB |
1_005.txt | AC | 2 ms | 2304 KB |
1_006.txt | AC | 2 ms | 2304 KB |
1_007.txt | WA | 2 ms | 2304 KB |
1_008.txt | WA | 9 ms | 2688 KB |
1_009.txt | AC | 10 ms | 2688 KB |
1_010.txt | WA | 9 ms | 2688 KB |
1_011.txt | WA | 9 ms | 2688 KB |
1_012.txt | WA | 10 ms | 2688 KB |
1_013.txt | WA | 9 ms | 2688 KB |
1_014.txt | WA | 14 ms | 2816 KB |
1_015.txt | WA | 14 ms | 2816 KB |
1_016.txt | AC | 2 ms | 2304 KB |
1_017.txt | WA | 2 ms | 2304 KB |
1_018.txt | AC | 2 ms | 2304 KB |
1_019.txt | WA | 11 ms | 2816 KB |
1_020.txt | WA | 10 ms | 2688 KB |
1_021.txt | WA | 14 ms | 2816 KB |
1_022.txt | WA | 6 ms | 2560 KB |
1_023.txt | WA | 4 ms | 2432 KB |
1_024.txt | WA | 12 ms | 2816 KB |
1_025.txt | WA | 12 ms | 2816 KB |
2_026.txt | AC | 2 ms | 2304 KB |
2_027.txt | WA | 2 ms | 2304 KB |
2_028.txt | WA | 2 ms | 2304 KB |
2_029.txt | WA | 116 ms | 6400 KB |
2_030.txt | AC | 115 ms | 6400 KB |
2_031.txt | WA | 97 ms | 10368 KB |
2_032.txt | WA | 97 ms | 10368 KB |
2_033.txt | WA | 96 ms | 6400 KB |
2_034.txt | WA | 96 ms | 6400 KB |
2_035.txt | WA | 157 ms | 6400 KB |
2_036.txt | WA | 157 ms | 6400 KB |
2_037.txt | AC | 2 ms | 2304 KB |
2_038.txt | WA | 2 ms | 2304 KB |
2_039.txt | AC | 2 ms | 2304 KB |
2_040.txt | WA | 105 ms | 6400 KB |
2_041.txt | WA | 157 ms | 6400 KB |
2_042.txt | WA | 157 ms | 6400 KB |
2_043.txt | WA | 98 ms | 6400 KB |
2_044.txt | WA | 134 ms | 6400 KB |
2_045.txt | WA | 289 ms | 9472 KB |
2_046.txt | WA | 116 ms | 6400 KB |
2_047.txt | WA | 125 ms | 6400 KB |
2_048.txt | WA | 132 ms | 6400 KB |
2_049.txt | WA | 132 ms | 6400 KB |
2_050.txt | WA | 132 ms | 6400 KB |