Submission #931158

#TimeUsernameProblemLanguageResultExecution timeMemory
931158De3b0oSemiexpress (JOI17_semiexpress)C++14
48 / 100
1 ms348 KiB
#include<bits/stdc++.h> #define ll long long #define F first #define S second #define in insert #define er erase #define pb push_back #define ppb pop_back() #define ph push #define pp pop() #define d3 ios::sync_with_stdio(0);cin.tie(0);cout.tie(0); #define cans cout << ans << "\n"; #define yes cout << "YES" << "\n"; #define no cout << "NO" << "\n"; #define pll pair<ll,ll> #define lin cout << "\n"; #define sqr 340 #define mod 1000000007 #define mid (l+r)/2 using namespace std; int main() { d3 ll n , m , k; cin >> n >> m >> k; ll a , b , c; cin >> a >> b >> c; ll t; cin >> t; ll exp[m]; for(int i = 0 ; m>i ; i++) cin >> exp[i]; ll ans = 0; multiset<ll> semi; ll y = 3*(k-m); for(int i = 0 ; m-1>i ; i++) { if((exp[i]-1)*b>t) break; ll l = exp[i]+1; ll r = exp[i+1]-1; while(l<=r) { if((mid-exp[i])*a+(exp[i]-1)*b>t) r=mid-1; else l=mid+1; } ans+=(l-1-exp[i]+1); ll x = l; while(x<exp[i+1]&&y) { l = x; r = exp[i+1]-1; while(l<=r) { if((exp[i]-1)*b + (x-exp[i])*c + (mid-x)*a >t) r=mid-1; else l=mid+1; } if(l-1==x-1) break; y--; semi.in(l-1-x+1); x=l; } } ll x = k-m; while(x--&&!semi.empty()) { auto it = semi.end(); it--; //cout << *it << "\n"; ans+=*it; semi.erase(it); } if((n-1)*b<=t) ans++; ans--; cans }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...