답안 #206488

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
206488 2020-03-03T12:56:30 Z opukittpceno_hhr Semiexpress (JOI17_semiexpress) C++17
48 / 100
1000 ms 70940 KB
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <fstream>
#include <cassert>
#include <cstring>
#include <unordered_set>
#include <unordered_map>
#include <numeric>
#include <ctime>
#include <bitset>
#include <complex>
#include <random>

using namespace std;

#define int long long

const int N = 3001;
const int INF = 1e18 + 239;

int dp[N][N];

int n, k;
int lc, ex, sm;
int t;

vector<int> proc(int sd, int len) {
	if (sd >= t) {
		return {0};
	}
	int wd = sd;
	int delta = t - sd;
	int can = delta / lc;
	vector<int> ret = {can};
	sd += (can) * sm;
	if (ret.back() < len) {
		for (int i = 0; i < k; i++) {
			sd += sm;
			if (sd > t) {
				break;
			}
			can = (t - sd) / lc;
			ret.push_back(ret.back() + can + 1);
			sd += can * sm;
			if (ret.back() > len) {
				ret.back() = len;
				break;
			}
		}
	} else {
		ret.back() = len;
	}
	for (auto &x : ret) {
		if (x < len && wd + len * ex <= t) {
			// cerr << "lol" << endl;
			x++;
		}
	}
	return ret;
}


signed main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	
	for (int i = 0; i < N; i++) {
		for (int j = 0; j < N; j++) {
			dp[i][j] = -INF;
		}
	}

	int m;
	cin >> n >> m >> k;
	k -= m;
	cin >> lc >> ex >> sm;
	cin >> t;
	vector<int> s(m);
	for (auto &x : s) {
		cin >> x;
		x--;
	}
	//0 5 10
	//4 7
	//6 7 8 9
	dp[0][0] = 0;
	for (int i = 1; i < m; i++) {
		int len = s[i] - s[i - 1];
		int sd = s[i - 1] * ex;
		auto nw = proc(sd, len);
		// if (i == 1) {
		// 	cerr << nw.size() << endl;
		// 	cerr << nw[0] << ' ' << nw[1] << endl;
		// 	exit(0);
		// }
		// if (i == 2) {

		// }
		for (int j = 0; j < N; j++) {
			for (int tk = 0; tk < (int)nw.size() && j + tk < N; tk++) {
				dp[i][j + tk] = max(dp[i][j + tk], dp[i - 1][j] + nw[tk]);
			}
		}
	}
	int ans = 0;
	for (int i = 0; i < N; i++) {
		for (int j = 0; j <= k; j++) {
			ans = max(ans, dp[i][j]);
		}
	}
	cout << ans << endl;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 41 ms 70776 KB Output is correct
2 Correct 41 ms 70776 KB Output is correct
3 Correct 44 ms 70648 KB Output is correct
4 Correct 42 ms 70904 KB Output is correct
5 Correct 43 ms 70776 KB Output is correct
6 Correct 43 ms 70940 KB Output is correct
7 Correct 43 ms 70776 KB Output is correct
8 Correct 43 ms 70776 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 41 ms 70776 KB Output is correct
2 Correct 41 ms 70776 KB Output is correct
3 Correct 44 ms 70648 KB Output is correct
4 Correct 42 ms 70904 KB Output is correct
5 Correct 43 ms 70776 KB Output is correct
6 Correct 43 ms 70940 KB Output is correct
7 Correct 43 ms 70776 KB Output is correct
8 Correct 43 ms 70776 KB Output is correct
9 Correct 47 ms 70904 KB Output is correct
10 Correct 43 ms 70904 KB Output is correct
11 Correct 44 ms 70904 KB Output is correct
12 Correct 43 ms 70904 KB Output is correct
13 Correct 44 ms 70776 KB Output is correct
14 Correct 44 ms 70904 KB Output is correct
15 Correct 42 ms 70904 KB Output is correct
16 Correct 42 ms 70776 KB Output is correct
17 Correct 44 ms 70776 KB Output is correct
18 Correct 43 ms 70776 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 41 ms 70776 KB Output is correct
2 Correct 41 ms 70776 KB Output is correct
3 Correct 44 ms 70648 KB Output is correct
4 Correct 42 ms 70904 KB Output is correct
5 Correct 43 ms 70776 KB Output is correct
6 Correct 43 ms 70940 KB Output is correct
7 Correct 43 ms 70776 KB Output is correct
8 Correct 43 ms 70776 KB Output is correct
9 Correct 47 ms 70904 KB Output is correct
10 Correct 43 ms 70904 KB Output is correct
11 Correct 44 ms 70904 KB Output is correct
12 Correct 43 ms 70904 KB Output is correct
13 Correct 44 ms 70776 KB Output is correct
14 Correct 44 ms 70904 KB Output is correct
15 Correct 42 ms 70904 KB Output is correct
16 Correct 42 ms 70776 KB Output is correct
17 Correct 44 ms 70776 KB Output is correct
18 Correct 43 ms 70776 KB Output is correct
19 Correct 53 ms 70904 KB Output is correct
20 Correct 57 ms 70904 KB Output is correct
21 Correct 50 ms 70904 KB Output is correct
22 Correct 107 ms 70904 KB Output is correct
23 Execution timed out 1090 ms 70904 KB Time limit exceeded
24 Halted 0 ms 0 KB -