# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
749988 | guagua0407 | Semiexpress (JOI17_semiexpress) | C++17 | 46 ms | 33296 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
//#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
컴파일 시 표준 에러 (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... |