# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
749988 | guagua0407 | Semiexpress (JOI17_semiexpress) | C++17 | 46 ms | 33296 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
//#pragma GCC optimize("O3")
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pii pair<int,int>
#define f first
#define s second
#define all(x) x.begin(),x.end()
#define _ ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define pll pair<ll,ll>
void setIO(string s) {
freopen((s + ".in").c_str(), "r", stdin);
freopen((s + ".out").c_str(), "w", stdout);
}
struct node{
ll dif,cur,id,val;
bool operator<(const node &x)const{
return dif<x.dif;
}
};
const int mxn=3005;
ll S[mxn];
ll f[mxn][mxn];
ll dp[mxn][mxn];
int main() {_
int n,m,k;
cin>>n>>m>>k;
ll A,B,C;
cin>>A>>B>>C;
ll T;
cin>>T;
for(int i=0;i<m;i++){
cin>>S[i];
S[i]--;
}
ll ans=0;
priority_queue<ll> pq;
for(int i=1;i<m;i++){
if(B*S[i]<=T) ans++;
ll sum=T-B*S[i-1];
ll pos2;
int cnt=0;
for(ll pos=S[i-1];pos<S[i] and sum>=0 and cnt<=k;pos=pos2+1){
pos2=min(S[i]-1,pos+sum/A);
//cout<<pos<<' '<<pos2<<'\n';
if(cnt==0) ans+=pos2-pos;
else pq.push(pos2-pos+1);
cnt++;
sum-=(pos2-pos+1)*C;
}
}
for(int i=0;i<k-m and !pq.empty();i++){
ans+=pq.top();
//cout<<pq.top()<<' ';
pq.pop();
}
cout<<ans;
return 0;
}
//maybe its multiset not set
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |