Submission #647932

#TimeUsernameProblemLanguageResultExecution timeMemory
647932Koful123Semiexpress (JOI17_semiexpress)C++17
48 / 100
1070 ms6088 KiB
#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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...