Submission #992132

#TimeUsernameProblemLanguageResultExecution timeMemory
992132irmuunSemiexpress (JOI17_semiexpress)C++17
100 / 100
8 ms4752 KiB
#include<bits/stdc++.h> using namespace std; #define ll long long #define pb push_back #define ff first #define ss second #define all(s) s.begin(),s.end() #define rall(s) s.rbegin(),s.rend() ll N,M,K,A,B,C,T; const ll maxn=3e3+5; ll nums[maxn*maxn],cur=0,cnt0=0; void f(ll l,ll r){ ll t=B*(l-1); if(t>T) return; ll R=l,q=0; while(R<r){ if(T-t<0) break; ll nxt=R+(T-t)/A; nxt=min(nxt,r-1); if(R==l) cnt0+=nxt-R+1; else nums[cur++]=nxt-R+1; t+=C*(nxt-R+1); R=nxt+1; q++; if(q>K-M) break; } } int main(){ ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); cin>>N>>M>>K; cin>>A>>B>>C; cin>>T; ll s[M+5]; for(ll i=1;i<=M;i++){ cin>>s[i]; } for(ll i=1;i<M;i++){ f(s[i],s[i+1]); } if((N-1)*B<=T) cnt0++; sort(nums,nums+cur); reverse(nums,nums+cur); for(ll i=0;i<min(K-M,cur);i++){ cnt0+=nums[i]; } cout<<cnt0-1; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...