제출 #1179756

#제출 시각아이디문제언어결과실행 시간메모리
1179756user736482Semiexpress (JOI17_semiexpress)C++20
48 / 100
3 ms3780 KiB
#pragma GCC optimize("O3") #include <bits/stdc++.h> using namespace std; #define ll long long #define ld long double #define pb push_back #define ff first #define ss second #define MOD 1000000009 #define INF 1000000019 #define INFL 1000000000000000099LL ll n,q,s,t,a,b,c,d,ans,k,m; vector<ll>szy,zna,dod; void calculate(ll ile,ll lim,bool bl){ ll ak=lim/a+1; // cout<<lim<<" "; if(lim<0)return; if(ak>=ile){ //cout<<"xd"; if(bl){ k--; ans+=ile; } else dod.pb(ile); //cout<<ile<<"d "; } else{ if(bl){ k--; ans+=ak; } else zna.pb(ak); //cout<<ak<<"z "; calculate(ile-ak,lim-(ak)*c,0); } } int main() { ios_base::sync_with_stdio(0);cin.tie(0); cin>>n>>m>>k>>a>>b>>c>>t; ll K=k; for(ll i=0;i<m;i++){ cin>>d; d--; szy.pb(d); if(i)calculate(szy[i]-szy[i-1],t-b*szy[i-1],1); if(zna.size()>=K)break; } for(ll i : dod)zna.pb(i); sort(zna.begin(),zna.end()); k--; while(zna.size() && k){ k--; ans+=zna.back(); zna.pop_back(); } if((n-1)*b>t)ans--; cout<<ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...