# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
299316 | 2020-09-14T17:35:15 Z | BeanZ | Semiexpress (JOI17_semiexpress) | C++14 | 23 ms | 2168 KB |
#include <bits/stdc++.h> using namespace std; #define ll long long #define endl '\n' const int N = 1e5 + 5; ll dp[305][305]; ll s[305], len[305], p[305], last[305]; int main(){ ios_base::sync_with_stdio(false); cin.tie(0); if (fopen("A.inp", "r")){ freopen("test.inp", "r", stdin); freopen("test.out", "w", stdout); } ll n, m, k; cin >> n >> m >> k; ll A, B, C; cin >> A >> B >> C; ll T; cin >> T; for (int i = 1; i <= m; i++) cin >> s[i]; len[1] = 0; ll cur = 1; for (int i = 1; i <= n; i++){ last[i] = cur; if ((cur + 1) <= m && s[cur + 1] <= i) cur++; len[i] = (s[cur] - 1) * B + (i - s[cur]) * C; ll dist = len[i]; if (dist <= T) p[i] = 1; else p[i] = 0; for (int j = i + 1; j <= n; j++){ dist = dist + A; if (dist > T) break; p[i]++; } //cout << last[i] << " " << p[i] << endl; } //cout << endl << endl; ll ans = 0; for (int i = 1; i <= n; i++){ for (int j = 0; j <= k; j++) dp[i][j] = -1e9; } dp[1][1] = p[1]; for (int i = 2; i <= n; i++){ for (int j = 1; j <= k; j++){ for (int t = s[last[i]]; t < i; t++){ dp[i][j] = max(dp[i][j], dp[t][j - 1] - p[t] + min((ll)(i - t), p[t]) + p[i]); ans = max(ans, dp[i][j]); cout << i << " " << j << " " << dp[i][j] << endl; } } } cout << ans - 1; } /* eraae */
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 23 ms | 2168 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 23 ms | 2168 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 23 ms | 2168 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |