이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
template<typename T>
void out(T x) { cout << x << endl; exit(0); }
#define watch(x) cout << (#x) << " is " << (x) << endl
using ll = long long;
ll n,m,k;
ll a,b,c;
ll t;
vector<ll> s;
vector<ll> w;
ll solve(ll l, ll r) {
ll res = 0;
ll cnt = 0;
ll at = l;
ll time = b*l;
while (at<r && cnt<=k-m) {
if (t-time<0) break;
ll dist = (t-time)/a;
ll to = min(r,at+dist+1);
if (l==at) {
res = to-at;
} else {
w.push_back(to-at);
}
cnt++;
time += (to-at)*c;
at = to;
}
return res;
}
int main() {
ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
cin>>n>>m>>k;
cin>>a>>b>>c;
cin>>t;
s.resize(m);
for (int i=0; i<m; i++) {
cin>>s[i];
--s[i];
}
ll res = 0;
if (b*s[m-1] <= t) res=1;
for (int i=0; i+1<m; i++) {
res += solve(s[i],s[i+1]);
}
sort(w.rbegin(), w.rend());
for (int i=0; i<k-m && i<(int)w.size(); i++) {
res += w[i];
}
res--; //except station 1
cout<<res<<endl;
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... |