Submission #670057

# Submission time Handle Problem Language Result Execution time Memory
670057 2022-12-08T01:36:32 Z Darren0724 Semiexpress (JOI17_semiexpress) C++17
100 / 100
7 ms 4556 KB
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define all(x) x.begin(),x.end()
const int INF=1e18;
signed main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int L,n,k;cin>>L>>n>>k;
    k=k-n;
    int a,b,c;cin>>a>>b>>c;
    int t;cin>>t;
    vector<int> v(n+1);
    for(int i=0;i<n;i++){
        cin>>v[i];
    }
    v[n]=L+1;
    priority_queue<int> pq;
    int ans=0;
    for(int i=0;i<n;i++){
        int t1=t-b*(v[i]-1);
        //cout<<t1<<endl;
        int last=v[i]+(t1/a);
        last=min(last,v[i+1]-1);
        if(t1<0){
            break;
        }
        ans+=(last-v[i]+1);
        //cout<<ans<<endl;
        int rec=last;
        for(int j=1;j<=k;j++){
            int t2=t1-(last+1-v[i])*c;
            if(t2<0){
                break;
            }
            last=last+t2/a+1;
            last=min(v[i+1]-1,last);
            if(last<=rec){
                break;
            }
            pq.push(last-rec);
            rec=last;
        }
    }
    for(int i=0;i<k;i++){
        if(pq.size()==0){
            break;
        }
        //cout<<pq.top()<<endl;
        ans+=pq.top();
        pq.pop();
    }
    cout<<ans-1<<endl;

    return 0;
}

# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 320 KB Output is correct
5 Correct 1 ms 316 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 320 KB Output is correct
5 Correct 1 ms 316 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 0 ms 320 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Correct 0 ms 212 KB Output is correct
14 Correct 0 ms 212 KB Output is correct
15 Correct 0 ms 212 KB Output is correct
16 Correct 1 ms 320 KB Output is correct
17 Correct 1 ms 320 KB Output is correct
18 Correct 1 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 320 KB Output is correct
5 Correct 1 ms 316 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 0 ms 320 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Correct 0 ms 212 KB Output is correct
14 Correct 0 ms 212 KB Output is correct
15 Correct 0 ms 212 KB Output is correct
16 Correct 1 ms 320 KB Output is correct
17 Correct 1 ms 320 KB Output is correct
18 Correct 1 ms 212 KB Output is correct
19 Correct 1 ms 340 KB Output is correct
20 Correct 1 ms 340 KB Output is correct
21 Correct 1 ms 328 KB Output is correct
22 Correct 1 ms 596 KB Output is correct
23 Correct 7 ms 4556 KB Output is correct
24 Correct 1 ms 332 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 336 KB Output is correct
29 Correct 6 ms 4556 KB Output is correct
30 Correct 3 ms 2512 KB Output is correct