Submission #407205

#TimeUsernameProblemLanguageResultExecution timeMemory
407205FEDIKUSSemiexpress (JOI17_semiexpress)C++17
100 / 100
13 ms3540 KiB
#include <bits/stdc++.h> #define mp make_pair #define pb push_back #define pf push_front #define popb pop_back #define popf pop_front #define xx first #define yy second #define srt(a) sort(a.begin(),a.end()); #define srtg(a,int) sort(a.begin(),a.end(),greater<int>()) #define lb(a,x) lower_bound(a.begin(),a.end(),x) #define up(a,x) upper_bound(a.begin(),a.end(),x) #define fnd(a,x) find(a.begin(),a.end(),x) #define vstart auto startt=chrono::system_clock::now() #define vend auto endd=chrono::system_clock::now() #define vvreme chrono::duration<double> vremee=endd-startt #define ios ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0) using namespace std; typedef long long ll; typedef pair<int,int> pii; typedef pair<ll,ll> pll; typedef string str; const int maxm=3010; ll n,m,k,a,b,c; ll t; ll niz[maxm]; ll novi[maxm*maxm]; ll koliko=0; int uradi(ll l,ll r){ ll ret=0; ll tren=b*(l-1); ll gde=l; ll dodao=0; while(gde<r){ ll ostalo=t-tren; if(ostalo<0) break; ostalo/=a; ll sled=min(gde+ostalo+1,r); if(gde==l) ret=sled-l; else novi[koliko++]=sled-gde; tren+=c*(sled-gde); gde=sled; dodao++; if(dodao>k-m) break; } return ret; } void solve(){ cin>>n>>m>>k; cin>>a>>b>>c; cin>>t; for(ll i=0;i<m;i++){ cin>>niz[i]; } int res=0; for(int i=1;i<m;i++){ res+=uradi(niz[i-1],niz[i]); } sort(novi,novi+koliko,greater<int>()); for(int i=0;i<k-m;i++) res+=novi[i]; if(b*(niz[m-1]-1)<=t) res++; cout<<res-1; } int main(){ ios; int t=1; //cin>>t; while(t--) solve(); return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...