Submission #805697

# Submission time Handle Problem Language Result Execution time Memory
805697 2023-08-03T20:49:01 Z kirakaminski968 Semiexpress (JOI17_semiexpress) C++17
0 / 100
1 ms 212 KB
#include <bits/stdc++.h>
#define ll long long
using namespace std;

int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); 
    ll N,M,K; cin >> N >> M >> K;
    ll A,B,C; cin >> A >> B >> C;
    ll T; cin >> T;
    vector<ll> nxt(M,-1), stations(M);
    for(int i = 0;i<M;++i){
        cin >> stations[i];
        stations[i]--;
    }
    for(int i = 0;i<M;++i){
        if((T-stations[i]*B) > 0) nxt[i] = (T-stations[i]*B)/A;
        else nxt[i] = -1;
        if(i != M-1) nxt[i] = min(nxt[i],stations[i+1]-stations[i]-1);
        else nxt[i] = min(0ll,nxt[i]);
        //cout << nxt[i] << "\n";
    }
    for(int i = 0;i<K-M;++i){
        ll maxn = -1, pos = -1;
        for(int j = 0;j<M-1;++j){
            if(T-stations[j]*B-(nxt[j]+1)*C < 0) continue;
            ll cnt = (T-stations[j]*B-(nxt[j]+1)*C)/A + nxt[j]+1;
            cnt = min(cnt,stations[j+1]-stations[j]-1);
            if(cnt > maxn){
                maxn = cnt;
                pos = j;
            }
        }
        if(maxn != -1){
            nxt[pos] = maxn;
            //cout << stations[pos] << " " << nxt[pos] << " " << maxn << "\n";
        }
    }
    ll ans = 0;
    for(int i = 0;i<M;++i){
        ans += nxt[i]+1;
    }
    cout << ans-1 << "\n";
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Incorrect 0 ms 212 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Incorrect 0 ms 212 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Incorrect 0 ms 212 KB Output isn't correct
4 Halted 0 ms 0 KB -