이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#define ll long long
using namespace std;
int express[3005],endpos[3005];
int main()
{
ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
int N,M,K; cin >> N >> M >> K;
int A,B,C; cin >> A >> B >> C;
int T; cin >> T;
for(int i = 1;i<=M;++i){
cin >> express[i];
express[i]--;
endpos[i] = (T-express[i]*B)/A;
if(endpos[i] < 0) endpos[i] = -1;
}
for(int i = 1;i<M;++i) endpos[i] = min(endpos[i],express[i+1]-express[i]-1);
endpos[M] = min(endpos[M],0);
for(int i = 0;i<K-M;++i){
int maxn = 0, pos = -1;
for(int j = 1;j<M;++j){
if((T-express[j]*B-(endpos[j]+1)*C)/A < 0) continue;
int p = endpos[j]+1;
int chec = min(express[j+1]-express[j]-1,(T-express[j]*B-p*C)/A+p);
if(chec-p+1 > maxn){
maxn = chec-p+1;
pos = j;
}
}
if(maxn > 0){
endpos[pos] += maxn;
}
}
ll ans = 0;
for(int i = 1;i<=M;++i) ans += endpos[i]+1;
ans--;
cout << ans << "\n";
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |