Submission #262890

# Submission time Handle Problem Language Result Execution time Memory
262890 2020-08-13T10:35:39 Z sahil_k Semiexpress (JOI17_semiexpress) C++14
100 / 100
100 ms 33340 KB
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
long long n, m, k;
long long a, b, c;
long long t;
long long pos[3005];
long long o = 0;
vector<long long> opts;
int main () {
	cin >> n >> m >> k;
	cin >> a >> b >> c;
	cin >> t;
	for (int i=0; i<m; i++) {
		cin >> pos[i];
		pos[i]--;
	}
	for (int i=0; i<m-1; i++) {
		long long dist = pos[i]*b;
		if (dist > t) break;
		long long temp = min(pos[i+1]-pos[i], (t-dist)/a+1);
		o += max(0ll, temp);
		long long nxt = pos[i]+temp;
		dist += temp*c;
		for (int j=1; j<=k; j++) {
			if (nxt >= pos[i+1] || dist > t) break;
			long long temp = min(pos[i+1]-nxt, (t-dist)/a+1);
			opts.push_back(temp);
			nxt += temp;
			dist += temp*c;
		}
	}
	if ((n-1)*b <= t) o++;
	sort(opts.begin(), opts.end(), greater<long long>());
	for (int i=0; i<min((long long)opts.size(), k-m); i++) {
		o += opts[i];
	}
	cout << o-1 << endl;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 256 KB Output is correct
2 Correct 0 ms 256 KB Output is correct
3 Correct 1 ms 256 KB Output is correct
4 Correct 0 ms 256 KB Output is correct
5 Correct 0 ms 376 KB Output is correct
6 Correct 1 ms 256 KB Output is correct
7 Correct 1 ms 384 KB Output is correct
8 Correct 0 ms 256 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 256 KB Output is correct
2 Correct 0 ms 256 KB Output is correct
3 Correct 1 ms 256 KB Output is correct
4 Correct 0 ms 256 KB Output is correct
5 Correct 0 ms 376 KB Output is correct
6 Correct 1 ms 256 KB Output is correct
7 Correct 1 ms 384 KB Output is correct
8 Correct 0 ms 256 KB Output is correct
9 Correct 1 ms 256 KB Output is correct
10 Correct 0 ms 256 KB Output is correct
11 Correct 0 ms 256 KB Output is correct
12 Correct 1 ms 384 KB Output is correct
13 Correct 0 ms 256 KB Output is correct
14 Correct 0 ms 256 KB Output is correct
15 Correct 1 ms 256 KB Output is correct
16 Correct 0 ms 256 KB Output is correct
17 Correct 1 ms 256 KB Output is correct
18 Correct 1 ms 256 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 256 KB Output is correct
2 Correct 0 ms 256 KB Output is correct
3 Correct 1 ms 256 KB Output is correct
4 Correct 0 ms 256 KB Output is correct
5 Correct 0 ms 376 KB Output is correct
6 Correct 1 ms 256 KB Output is correct
7 Correct 1 ms 384 KB Output is correct
8 Correct 0 ms 256 KB Output is correct
9 Correct 1 ms 256 KB Output is correct
10 Correct 0 ms 256 KB Output is correct
11 Correct 0 ms 256 KB Output is correct
12 Correct 1 ms 384 KB Output is correct
13 Correct 0 ms 256 KB Output is correct
14 Correct 0 ms 256 KB Output is correct
15 Correct 1 ms 256 KB Output is correct
16 Correct 0 ms 256 KB Output is correct
17 Correct 1 ms 256 KB Output is correct
18 Correct 1 ms 256 KB Output is correct
19 Correct 2 ms 384 KB Output is correct
20 Correct 2 ms 384 KB Output is correct
21 Correct 7 ms 2548 KB Output is correct
22 Correct 6 ms 1528 KB Output is correct
23 Correct 33 ms 8684 KB Output is correct
24 Correct 33 ms 4592 KB Output is correct
25 Correct 1 ms 384 KB Output is correct
26 Correct 2 ms 384 KB Output is correct
27 Correct 81 ms 16872 KB Output is correct
28 Correct 100 ms 33340 KB Output is correct
29 Correct 20 ms 4584 KB Output is correct
30 Correct 8 ms 2548 KB Output is correct