Submission #854578

#TimeUsernameProblemLanguageResultExecution timeMemory
854578becaidoSemiexpress (JOI17_semiexpress)C++17
100 / 100
49 ms604 KiB
#pragma GCC optimize("O3,unroll-loops") #pragma GCC target("avx,popcnt,sse4,abm") #include <bits/stdc++.h> using namespace std; #ifdef WAIMAI #define debug(HEHE...) cout << "[" << #HEHE << "] : ", dout(HEHE) void dout() {cout << '\n';} template<typename T, typename...U> void dout (T t, U...u) {cout << t << (sizeof... (u) ? ", " : ""), dout (u...);} #else #define debug(...) 7122 #endif #define ll long long #define Waimai ios::sync_with_stdio(false), cin.tie(0) #define FOR(x,a,b) for (int x = a, I = b; x <= I; x++) #define pb emplace_back #define F first #define S second const int SIZE = 3005; int n, m, k; int a, b, c; ll t; int p[SIZE], dp[2][SIZE]; void solve() { cin >> n >> m >> k; cin >> a >> b >> c >> t; FOR (i, 1, m) cin >> p[i], p[i]--; // D1*B + D2*C + D3*A k -= m; FOR (i, 1, m - 1) { int f = i & 1, pos = p[i]; FOR (j, 0, k) dp[f][j] = dp[!f][j]; ll cur = t - 1ll * p[i] * b; for (int j = 0; j <= k && cur >= 0; j++) { int can = min((ll) p[i + 1] - pos, cur / a + 1); pos += can; cur -= 1ll * c * can; FOR (x, j, k) dp[f][x] = max(dp[f][x], dp[!f][x - j] + pos - p[i]); } } int ans = dp[!(m & 1)][k] - 1; ans += 1ll * p[m] * b <= t; cout << ans << '\n'; } int main() { Waimai; solve(); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...