40622023-03-12 16:52:06horvathabelLádapakolás raktárban (50)cpp17Wrong answer 29/5048ms6616 KiB
#include <bits/stdc++.h>
using namespace std;

int main() {
	int n, k;
	cin>>n>>k;
	vector<int> t={k+1};
	vector<int> a={k+1}; 
	vector<int> m={k+1};
	for (int i=0; i<n;i++){
		int x;
		 cin>>x;
		 t.push_back(x);
		 a.push_back(x);
		 m.push_back(x);
	}
	int ans=0; 
	t.push_back(k+1);
	t.push_back(k+1);
	m.push_back(k+1);
	for (int i=1; i<=n;i++){
		if (a[i]<t[i-1] && m[i]+m[i-1]<k){
			ans++;
			m[i]+=m[i-1];
		}
		else{
			if (a[i]<t[i+1] && m[i]+m[i+1]<k){
				ans++;
				m[i+1]+=m[i];
			}
		}
	}
	cout<<ans; 
}
SubtaskSumTestVerdictTimeMemory
base29/50
1Accepted0/03ms1812 KiB
2Wrong answer0/04ms2440 KiB
3Accepted2/23ms2268 KiB
4Wrong answer0/23ms2348 KiB
5Accepted2/23ms2600 KiB
6Accepted2/23ms2688 KiB
7Accepted2/23ms2912 KiB
8Accepted2/22ms2984 KiB
9Accepted3/33ms3384 KiB
10Accepted2/23ms3500 KiB
11Accepted2/23ms3436 KiB
12Wrong answer0/23ms3656 KiB
13Accepted3/34ms3648 KiB
14Wrong answer0/34ms3784 KiB
15Accepted3/36ms3920 KiB
16Wrong answer0/229ms6020 KiB
17Wrong answer0/339ms6280 KiB
18Accepted3/348ms6336 KiB
19Accepted3/329ms6168 KiB
20Wrong answer0/332ms6280 KiB
21Wrong answer0/329ms6420 KiB
22Wrong answer0/334ms6616 KiB