답안 #262873

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
262873 2020-08-13T10:22:10 Z sahil_k Semiexpress (JOI17_semiexpress) C++14
0 / 100
1 ms 384 KB
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int 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<k-m; i++) {
		o += opts[i];
	}
	cout << o-1 << endl;
}
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 384 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 384 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 384 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -