Submission #365507

#TimeUsernameProblemLanguageResultExecution timeMemory
365507hackermubSemiexpress (JOI17_semiexpress)C++17
48 / 100
368 ms262148 KiB
#include<bits/stdc++.h> using namespace std; #define int long long #define pii pair<int,int> #define float long double #define fi first #define se second #define pb push_back #define all(v) v.begin(),v.end() #define sz(v) (int)v.size() #define uid uniform_int_distribution<int> //mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count()); const int MOD = 1e9+7;//998244353; const int64_t INF = 1e18; int32_t main(){ ios_base::sync_with_stdio(false);cin.tie(); //If you hack my code , You are gay int n,m,k,a,b,c,t; cin>>n>>m>>k>>a>>b>>c>>t; int s[m]; for(int i=0;i<m;i++) cin>>s[i]; priority_queue<int> pq; int ans=0; for(int i=1;i<m;i++){ int et = (s[i-1]-1)*b; if(et>t) break; int nxt = min(s[i]-1,s[i-1] + (t-et)/a); ans+= nxt-s[i-1]+1; while(nxt+1<s[i]){ int st = (nxt-s[i-1]+1)*c + et; if(st>t) break; int tmp = min(s[i]-1,nxt+1+(t-st)/a); pq.push(tmp-nxt); nxt=tmp; } } if((n-1)*b<=t) ans++; while(pq.size() && k>m){ ans+=pq.top(); pq.pop(); k--; } cout<<ans-1; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...