답안 #794352

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
794352 2023-07-26T13:09:21 Z kirakaminski968 Semiexpress (JOI17_semiexpress) C++17
100 / 100
7 ms 368 KB
#include <bits/stdc++.h>
#define ll long long
using namespace std;
ll express[3005],endpos[3005];
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;
    for(int i = 1;i<=M;++i){
        cin >> express[i];
        express[i]--;
       if(T-express[i]*B < 0) endpos[i] = -1;
       else endpos[i] = (T-express[i]*B)/A; 
    }
    for(int i = 1;i<M;++i) endpos[i] = min(endpos[i],express[i+1]-express[i]-1);
    endpos[M] = min(endpos[M],0ll);
    for(int i = 0;i<K-M;++i){
        ll maxn = 0, pos = -1;
        for(int j = 1;j<M;++j){
            if((T-express[j]*B-(endpos[j]+1)*C) < 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;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 1 ms 324 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 1 ms 324 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 1 ms 212 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 1 ms 212 KB Output is correct
15 Correct 1 ms 212 KB Output is correct
16 Correct 1 ms 212 KB Output is correct
17 Correct 0 ms 212 KB Output is correct
18 Correct 0 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 1 ms 324 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 1 ms 212 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 1 ms 212 KB Output is correct
15 Correct 1 ms 212 KB Output is correct
16 Correct 1 ms 212 KB Output is correct
17 Correct 0 ms 212 KB Output is correct
18 Correct 0 ms 212 KB Output is correct
19 Correct 2 ms 340 KB Output is correct
20 Correct 4 ms 336 KB Output is correct
21 Correct 1 ms 340 KB Output is correct
22 Correct 1 ms 340 KB Output is correct
23 Correct 7 ms 368 KB Output is correct
24 Correct 0 ms 340 KB Output is correct
25 Correct 1 ms 340 KB Output is correct
26 Correct 1 ms 340 KB Output is correct
27 Correct 1 ms 340 KB Output is correct
28 Correct 1 ms 340 KB Output is correct
29 Correct 2 ms 340 KB Output is correct
30 Correct 2 ms 212 KB Output is correct