Submission #647932

# Submission time Handle Problem Language Result Execution time Memory
647932 2022-10-04T16:34:35 Z Koful123 Semiexpress (JOI17_semiexpress) C++17
48 / 100
1000 ms 6088 KB
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define double long double
#define endl "\n"
#define pb push_back
#define ff first
#define ss second
#define mod 1000000007
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

const int N = 3e3 + 3;
int dp[N][N];

void solve(){

	int n,m,k,a,b,c,t;
	cin >> n >> m >> k >> a >> b >> c >> t;

	vector<int> v(m+1);
	for(int i=1;i<=m;i++){
		cin >> v[i];
	}

	for(int i=1;i<m;i++){
		for(int j=0;j<=k-m;j++){
			int time = t - (v[i]-1)*b,last = 0;
			for(int q=0;q<=j;q++){
				if(time - last*c < 0 || last >= v[i+1]) break;
				int cur = (time - last*c) / a,len = v[i+1] - v[i];
				dp[i][j] = max(dp[i][j],dp[i-1][j-q] + min(len,last + cur + 1));
				last += cur+1;
			}
		}
	}

	int ans = 0;
	for(int i=1;i<m;i++){
		ans = max(ans,dp[i][k-m]);
	}

	cout << ans - ((v[m]-1)*b > t) << endl;
}

signed main(){

	ios::sync_with_stdio(0);
	cin.tie(0);

	int t = 1;
//	cin >> t;

	while(t--)
		solve();

	return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 1 ms 596 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 2 ms 340 KB Output is correct
7 Correct 1 ms 332 KB Output is correct
8 Correct 1 ms 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 1 ms 596 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 2 ms 340 KB Output is correct
7 Correct 1 ms 332 KB Output is correct
8 Correct 1 ms 340 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 1 ms 340 KB Output is correct
11 Correct 1 ms 212 KB Output is correct
12 Correct 1 ms 340 KB Output is correct
13 Correct 1 ms 340 KB Output is correct
14 Correct 1 ms 340 KB Output is correct
15 Correct 1 ms 340 KB Output is correct
16 Correct 1 ms 340 KB Output is correct
17 Correct 1 ms 212 KB Output is correct
18 Correct 1 ms 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 1 ms 596 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 2 ms 340 KB Output is correct
7 Correct 1 ms 332 KB Output is correct
8 Correct 1 ms 340 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 1 ms 340 KB Output is correct
11 Correct 1 ms 212 KB Output is correct
12 Correct 1 ms 340 KB Output is correct
13 Correct 1 ms 340 KB Output is correct
14 Correct 1 ms 340 KB Output is correct
15 Correct 1 ms 340 KB Output is correct
16 Correct 1 ms 340 KB Output is correct
17 Correct 1 ms 212 KB Output is correct
18 Correct 1 ms 340 KB Output is correct
19 Correct 31 ms 2340 KB Output is correct
20 Correct 8 ms 2896 KB Output is correct
21 Correct 2 ms 852 KB Output is correct
22 Correct 11 ms 1292 KB Output is correct
23 Execution timed out 1070 ms 6088 KB Time limit exceeded
24 Halted 0 ms 0 KB -