이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pll;
#define fastio ios::sync_with_stdio(false), cin.tie(0)
#define pb push_back
#define eb emplace_back
#define f first
#define s second
#define lowbit(x) x&-x
const int N = 998244353;
const int maxn = 2e5 + 5;
struct info{
	ll get, pos, tl, id;
	info(){}
	info(ll _get, ll _pos, ll _tl, ll _id) : get(_get), pos(_pos), tl(_tl), id(_id){}
	bool operator < (const info& other) const{
		return get < other.get;
	}
};
int main(void){
	fastio;
	ll n, m, k;
	cin>>n>>m>>k;
	ll a, b, c;
	cin>>a>>b>>c;
	ll t;
	cin>>t;
	vector<ll> s(m + 1);
	for(int i = 0; i < m; i++) cin>>s[i];
	ll ans = 0;
	priority_queue<info> q;
	for(int i = 1; i < m; i++){
		ll tlf = t - b * (s[i - 1] - 1);
		if(tlf < 0) break;
		ll get = min(s[i] - s[i - 1], tlf / a + 1);
		ans += get;
		if(get < s[i] - s[i - 1]){
			ll loc = s[i - 1] + tlf / a + 1;
			ll ntlf = tlf - c * (loc - s[i - 1]);
			if(ntlf >= 0 && loc < s[i]){
				q.push({min(s[i] - loc, ntlf / a + 1), loc, ntlf, i});
			}
		}
	}
	if(b * (n - 1) > t) ans -= 1;
	k -= m;
	while(k && !q.empty()){
		auto [get, loc, tl, id] = q.top(); q.pop();
		k--;
		ans += get;
		ll nloc = loc + tl / a + 1;
		ll ntl = tl - c * (nloc - loc);
		if(ntl >= 0 && loc < s[id]){
			q.push({min(s[id] - nloc, ntl / a + 1), nloc, ntl, id});
		}
	}
	cout<<ans<<"\n";
}
| # | Verdict  | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict  | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict  | Execution time | Memory | Grader output | 
|---|
| Fetching results... |