답안 #20916

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
20916 2017-03-20T06:55:10 Z gs14004 Semiexpress (JOI17_semiexpress) C++11
100 / 100
16 ms 2064 KB
#include <bits/stdc++.h>
using namespace std;
typedef pair<int, int> pi;
typedef long long lint;

int n, m, k;
lint a, b, c, t, s[3005];
lint loc[3005];

int main(){
	cin >> n >> m >> k;
	cin >> a >> b >> c >> t;
	for(int i=1; i<=m; i++){
		cin >> s[i];
		s[i]--;
		if(t - b * s[i] < 0) loc[i] = -1;
		else loc[i] = (t - b * s[i]) / a;
	}
	for(int i=1; i<m; i++) loc[i] = min(loc[i], s[i+1] - s[i] - 1);
	loc[m] = min(loc[m], 0ll);
	for(int i=0; i<k-m; i++){
		lint val = 0, pos = -1;
		for(int j=1; j<m; j++){
			if(t - s[j] * b - (loc[j] + 1) * c < 0) continue;
			lint st = loc[j] + 1;
			lint ed = min(s[j+1] - s[j] - 1, 
					(t - s[j] * b - st * c) / a + st);
			if(val < ed - st + 1){
				val = ed - st + 1;
				pos = j;
			}
		}
		if(val > 0){
			loc[pos] += val;
		}
	}
	lint ans = 0;
	for(int i=1; i<=m; i++) ans += loc[i] + 1;
	cout << ans-1;
}

Compilation message


# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 2064 KB Output is correct
2 Correct 0 ms 2064 KB Output is correct
3 Correct 0 ms 2064 KB Output is correct
4 Correct 0 ms 2064 KB Output is correct
5 Correct 0 ms 2064 KB Output is correct
6 Correct 0 ms 2064 KB Output is correct
7 Correct 0 ms 2064 KB Output is correct
8 Correct 0 ms 2064 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 2064 KB Output is correct
2 Correct 0 ms 2064 KB Output is correct
3 Correct 0 ms 2064 KB Output is correct
4 Correct 0 ms 2064 KB Output is correct
5 Correct 0 ms 2064 KB Output is correct
6 Correct 0 ms 2064 KB Output is correct
7 Correct 0 ms 2064 KB Output is correct
8 Correct 0 ms 2064 KB Output is correct
9 Correct 0 ms 2064 KB Output is correct
10 Correct 0 ms 2064 KB Output is correct
11 Correct 0 ms 2064 KB Output is correct
12 Correct 0 ms 2064 KB Output is correct
13 Correct 0 ms 2064 KB Output is correct
14 Correct 0 ms 2064 KB Output is correct
15 Correct 0 ms 2064 KB Output is correct
16 Correct 0 ms 2064 KB Output is correct
17 Correct 0 ms 2064 KB Output is correct
18 Correct 0 ms 2064 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 2064 KB Output is correct
2 Correct 0 ms 2064 KB Output is correct
3 Correct 0 ms 2064 KB Output is correct
4 Correct 0 ms 2064 KB Output is correct
5 Correct 0 ms 2064 KB Output is correct
6 Correct 0 ms 2064 KB Output is correct
7 Correct 0 ms 2064 KB Output is correct
8 Correct 0 ms 2064 KB Output is correct
9 Correct 0 ms 2064 KB Output is correct
10 Correct 0 ms 2064 KB Output is correct
11 Correct 0 ms 2064 KB Output is correct
12 Correct 0 ms 2064 KB Output is correct
13 Correct 0 ms 2064 KB Output is correct
14 Correct 0 ms 2064 KB Output is correct
15 Correct 0 ms 2064 KB Output is correct
16 Correct 0 ms 2064 KB Output is correct
17 Correct 0 ms 2064 KB Output is correct
18 Correct 0 ms 2064 KB Output is correct
19 Correct 3 ms 2064 KB Output is correct
20 Correct 6 ms 2064 KB Output is correct
21 Correct 0 ms 2064 KB Output is correct
22 Correct 0 ms 2064 KB Output is correct
23 Correct 16 ms 2064 KB Output is correct
24 Correct 0 ms 2064 KB Output is correct
25 Correct 0 ms 2064 KB Output is correct
26 Correct 0 ms 2064 KB Output is correct
27 Correct 0 ms 2064 KB Output is correct
28 Correct 0 ms 2064 KB Output is correct
29 Correct 3 ms 2064 KB Output is correct
30 Correct 3 ms 2064 KB Output is correct