답안 #80890

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
80890 2018-10-22T17:24:37 Z Dat160601 Semiexpress (JOI17_semiexpress) C++17
100 / 100
3 ms 1336 KB
#include <bits/stdc++.h>
using namespace std;
#define mp make_pair
#define fi first
#define se second

int n, m, k, s[3007];
long long a, b, c, t, ans = 0;
priority_queue < pair < int , pair < int, int > > > pr;

int main(){
	ios_base::sync_with_stdio(0);
	cin >> n >> m >> k;
	cin >> a >> b >> c >> t;
	k -= m;
	for(int i = 1; i <= m; i++){
		cin >> s[i];
	}
	for(int i = 1; i < m; i++){
		long long cur = 1LL * (s[i] - 1) * b;
		if(cur > t) break;
		long long reach = min(1LL * s[i + 1] - 1, (s[i] + (t - cur) / a));
		ans += reach - s[i] + 1;
		if(reach != s[i + 1] - 1){
			reach++;
			int sv = reach;
			cur += 1LL * (reach - s[i]) * c;
			//cout << reach << " " << cur << endl;
			if(cur > t) continue;
			reach = min(1LL * s[i + 1] - 1, (reach + (t - cur) / a));
			pr.push(mp(reach - sv + 1, mp(i, reach + 1)));
		}
	}
	if(1LL * (n - 1) * b <= t) ans++;
	while(!pr.empty()){
		if(k == 0) break;
		k--;
		ans += pr.top().fi;
		int id = pr.top().se.fi;
		int pos = pr.top().se.se;
		pr.pop();
		if(pos >= s[id + 1]) continue;
		long long cur = 1LL * (s[id] - 1) * b + 1LL * (pos - s[id]) * c;
		if(cur > t) continue;
		long long reach = min(1LL * s[id + 1] - 1, (pos + (t - cur) / a));
		pr.push(mp(reach - pos + 1, mp(id, reach + 1)));
	}
	cout << ans - 1;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 504 KB Output is correct
2 Correct 2 ms 644 KB Output is correct
3 Correct 2 ms 820 KB Output is correct
4 Correct 2 ms 820 KB Output is correct
5 Correct 2 ms 820 KB Output is correct
6 Correct 2 ms 820 KB Output is correct
7 Correct 2 ms 880 KB Output is correct
8 Correct 2 ms 880 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 504 KB Output is correct
2 Correct 2 ms 644 KB Output is correct
3 Correct 2 ms 820 KB Output is correct
4 Correct 2 ms 820 KB Output is correct
5 Correct 2 ms 820 KB Output is correct
6 Correct 2 ms 820 KB Output is correct
7 Correct 2 ms 880 KB Output is correct
8 Correct 2 ms 880 KB Output is correct
9 Correct 2 ms 928 KB Output is correct
10 Correct 2 ms 928 KB Output is correct
11 Correct 2 ms 932 KB Output is correct
12 Correct 2 ms 952 KB Output is correct
13 Correct 2 ms 956 KB Output is correct
14 Correct 2 ms 960 KB Output is correct
15 Correct 2 ms 980 KB Output is correct
16 Correct 2 ms 984 KB Output is correct
17 Correct 2 ms 984 KB Output is correct
18 Correct 2 ms 1096 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 504 KB Output is correct
2 Correct 2 ms 644 KB Output is correct
3 Correct 2 ms 820 KB Output is correct
4 Correct 2 ms 820 KB Output is correct
5 Correct 2 ms 820 KB Output is correct
6 Correct 2 ms 820 KB Output is correct
7 Correct 2 ms 880 KB Output is correct
8 Correct 2 ms 880 KB Output is correct
9 Correct 2 ms 928 KB Output is correct
10 Correct 2 ms 928 KB Output is correct
11 Correct 2 ms 932 KB Output is correct
12 Correct 2 ms 952 KB Output is correct
13 Correct 2 ms 956 KB Output is correct
14 Correct 2 ms 960 KB Output is correct
15 Correct 2 ms 980 KB Output is correct
16 Correct 2 ms 984 KB Output is correct
17 Correct 2 ms 984 KB Output is correct
18 Correct 2 ms 1096 KB Output is correct
19 Correct 2 ms 1128 KB Output is correct
20 Correct 2 ms 1144 KB Output is correct
21 Correct 2 ms 1176 KB Output is correct
22 Correct 2 ms 1232 KB Output is correct
23 Correct 2 ms 1232 KB Output is correct
24 Correct 2 ms 1244 KB Output is correct
25 Correct 2 ms 1272 KB Output is correct
26 Correct 2 ms 1284 KB Output is correct
27 Correct 2 ms 1304 KB Output is correct
28 Correct 3 ms 1320 KB Output is correct
29 Correct 2 ms 1336 KB Output is correct
30 Correct 2 ms 1336 KB Output is correct