이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
//#include<bits/extc++.h>
//__gnu_pbds
int main(){
ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
int n,m,k;cin>>n>>m>>k;
k-=m;
int a,b,c;cin>>a>>b>>c;
int T;cin>>T;
vector<ll> stop(m);
for(int i=0;i<m;i++){
cin>>stop[i];
stop[i]--;
}
priority_queue<pair<ll,ll>,vector<pair<ll,ll> >,greater<pair<ll,ll> > > pq;
ll ans = n;
for(int i=1;i<m;i++){
ll st = stop[i-1]*b;
ll dif = T-st;
pair<ll,ll> d;
d = {stop[i-1]+(dif/a)+1-(dif%a==0),stop[i]};
if(dif<=0) d = {stop[i-1],stop[i]};
if(d.second>d.first){
ans-=d.second-d.first;
pq.push(d);
}
}
if((n-1)*b>T) ans--;
for(int i=0;i<k;i++){
while(pq.size() && pq.top().first>=pq.top().second) pq.pop();
if(!pq.size()) break;
pair<ll,ll> d = pq.top();
// cout<<d.first<<" "<<d.second<<"\n";
pq.pop();
ll tt = d.first*c;
if(tt>T){k++;continue;}
pair<ll,ll> nd = {d.first+((T-tt)/a)+1-((T-tt)%a==0),d.second};
if(nd.first>=d.second) ans+=d.second-d.first;
else{
ans+=nd.first-d.first;
pq.push(nd);
}
}
cout<<ans<<"\n";
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |