답안 #854602

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
854602 2023-09-28T06:41:29 Z AaW Semiexpress (JOI17_semiexpress) C++14
0 / 100
0 ms 600 KB
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pii pair<int,int>
#define AI(x) begin(x),end(x)
#define endl '\n'

signed main() {
	ll n, m, k; 
	cin >> n >> m >> k;
	ll a, b, c;
	cin >> a >> b >> c;
	vector<bool> fast(n+5);

	ll t; cin >> t;

	for (int i = 0; i < m; ++i) {
		int s; cin >> s;
		fast[s] = 1;
	}

	priority_queue<int> pq;
	int cnt = 0;
	int lb = 1;
	for (int i = 2; i <= n; ++i) {
		if (fast[i]) lb = i;
		if (i * a <= t || lb*b + (i-lb)*a <= t){
			cnt++;
			// cerr << "RRR " << i << endl;
			continue;
		} 
		ll cc = 0;
		for (int j = i; j <= n; ++j) {
			if (fast[j]) break;
			if (lb*b + (i-lb)*c + (j-i)*a > t) break;
			cc++;
		}
		// cerr << "i, cc = " << i << " " << cc << endl;
		pq.push(cc);
	}

	for (int i = 0; i < k - m; ++i) {
		if (pq.empty()) break;
		cnt += pq.top();
		pq.pop();
	}
	cout << cnt << endl;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 600 KB Output is correct
3 Incorrect 0 ms 348 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 600 KB Output is correct
3 Incorrect 0 ms 348 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 600 KB Output is correct
3 Incorrect 0 ms 348 KB Output isn't correct
4 Halted 0 ms 0 KB -