답안 #365509

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
365509 2021-02-11T19:03:10 Z hackermub Semiexpress (JOI17_semiexpress) C++17
100 / 100
48 ms 33340 KB
#include<bits/stdc++.h>
using namespace std;

#define int long long
#define pii pair<int,int>
#define float long double
#define fi first
#define se second
#define pb push_back
#define all(v) v.begin(),v.end()
#define sz(v) (int)v.size()
#define uid uniform_int_distribution<int>
//mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
const int MOD = 1e9+7;//998244353;
const int64_t INF = 1e18;


int32_t main(){
    ios_base::sync_with_stdio(false);cin.tie();
    //If you hack my code , You are gay
    int n,m,k,a,b,c,t;
    cin>>n>>m>>k>>a>>b>>c>>t;
    int s[m];
    for(int i=0;i<m;i++) cin>>s[i];
    priority_queue<int> pq;
    int ans=0;
    for(int i=1;i<m;i++){
        int et = (s[i-1]-1)*b;
        if(et>t) break;
        int nxt = min(s[i]-1,s[i-1] + (t-et)/a);
        ans+= nxt-s[i-1]+1;
        int tot=0;
        while(tot<k && nxt+1<s[i]){
            int st = (nxt-s[i-1]+1)*c + et;
            if(st>t) break;
            int tmp = min(s[i]-1,nxt+1+(t-st)/a);
            pq.push(tmp-nxt);
            nxt=tmp;
            tot++;
        }
    }
    if((n-1)*b<=t) ans++;
    while(pq.size() && k>m){
        ans+=pq.top(); pq.pop();
        k--;
    }
    cout<<ans-1;
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 0 ms 364 KB Output is correct
3 Correct 0 ms 364 KB Output is correct
4 Correct 0 ms 364 KB Output is correct
5 Correct 1 ms 384 KB Output is correct
6 Correct 0 ms 364 KB Output is correct
7 Correct 1 ms 364 KB Output is correct
8 Correct 1 ms 364 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 0 ms 364 KB Output is correct
3 Correct 0 ms 364 KB Output is correct
4 Correct 0 ms 364 KB Output is correct
5 Correct 1 ms 384 KB Output is correct
6 Correct 0 ms 364 KB Output is correct
7 Correct 1 ms 364 KB Output is correct
8 Correct 1 ms 364 KB Output is correct
9 Correct 1 ms 364 KB Output is correct
10 Correct 1 ms 364 KB Output is correct
11 Correct 1 ms 364 KB Output is correct
12 Correct 0 ms 364 KB Output is correct
13 Correct 0 ms 364 KB Output is correct
14 Correct 1 ms 364 KB Output is correct
15 Correct 1 ms 364 KB Output is correct
16 Correct 1 ms 364 KB Output is correct
17 Correct 1 ms 364 KB Output is correct
18 Correct 0 ms 364 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 0 ms 364 KB Output is correct
3 Correct 0 ms 364 KB Output is correct
4 Correct 0 ms 364 KB Output is correct
5 Correct 1 ms 384 KB Output is correct
6 Correct 0 ms 364 KB Output is correct
7 Correct 1 ms 364 KB Output is correct
8 Correct 1 ms 364 KB Output is correct
9 Correct 1 ms 364 KB Output is correct
10 Correct 1 ms 364 KB Output is correct
11 Correct 1 ms 364 KB Output is correct
12 Correct 0 ms 364 KB Output is correct
13 Correct 0 ms 364 KB Output is correct
14 Correct 1 ms 364 KB Output is correct
15 Correct 1 ms 364 KB Output is correct
16 Correct 1 ms 364 KB Output is correct
17 Correct 1 ms 364 KB Output is correct
18 Correct 0 ms 364 KB Output is correct
19 Correct 1 ms 364 KB Output is correct
20 Correct 1 ms 364 KB Output is correct
21 Correct 4 ms 2536 KB Output is correct
22 Correct 2 ms 1516 KB Output is correct
23 Correct 13 ms 8672 KB Output is correct
24 Correct 9 ms 4580 KB Output is correct
25 Correct 1 ms 364 KB Output is correct
26 Correct 1 ms 364 KB Output is correct
27 Correct 33 ms 16988 KB Output is correct
28 Correct 48 ms 33340 KB Output is correct
29 Correct 9 ms 4580 KB Output is correct
30 Correct 4 ms 2536 KB Output is correct