이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<iostream>
#include<vector>
#include<algorithm>
#include<map>
#include<set>
#include<queue>
using namespace std;
#define ll long long
#define pii pair<ll,ll>
#define endl "\n"
#define out(x) cout<< #x << " = " << x << endl
#define mp make_pair
#define mt(a,b,c,d) mp(mp(a,b),mp(c,d))
ll n,m,k;
ll a,b,c,t,arr[3005],ans;
vector<ll> v[3005];
signed main(){
ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
cin>>n>>m>>k>>a>>b>>c>>t;
for (int i=1;i<=m;i++) cin>>arr[i];
if (b * arr[m] - b <= t) ans++;
for (int i=1;i<m;i++){
ll bt = b * (arr[i] - 1);
if (bt > t) break;
ll okstations = min((t-bt)/a + 1, arr[i+1] - arr[i]);
ans += okstations;
if (okstations == (arr[i+1] - arr[i])) continue;
ll nowstation = arr[i] + okstations;
bt += okstations * c;
for (int j=1;j<=k-m;j++){
if (bt > t) break;
okstations = min((t-bt)/a + 1, arr[i+1] - nowstation);
v[i].push_back(okstations);
if (okstations == (arr[i+1] - nowstation)) break;
nowstation += okstations;
bt += okstations * c;
}
}
priority_queue<ll,vector<ll> > pq;
for (int i=1;i<m;i++){
//cout<<i<<" : ";
for (ll u:v[i]) pq.push(u);//, cout<<u<<" ";
//cout<<endl;
}
for (int i=1;i<=k-m;i++) if (pq.size()) ans += pq.top(),pq.pop();
cout<<ans-1<<endl;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |