답안 #33323

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
33323 2017-10-23T13:33:33 Z minhtung0404 Semiexpress (JOI17_semiexpress) C++14
0 / 100
0 ms 2040 KB
#include<bits/stdc++.h>
const long long N = 3005;
using namespace std;

typedef pair <long long, long long> ii;
typedef pair <ii, long long> iii;
priority_queue <iii> mq;

long long n, m, k, a, b, c, s[N], ans, T;

long long cal(long long pos, long long pre){
    long long val = T - (s[pre]-1)*b - (pos-s[pre])*c;
    if (val < 0) return 0;
    return 1 + val/a;
}

int main(){
    cin >> n >> m >> k >> a >> b >> c >> T; k-=m;
    for (long long i = 1; i <= m; i++) cin >> s[i];
    if (n*b > T) ans = -1;
    for (long long i = 1; i <  m; i++){
        long long pos = s[i], pre = i, val = cal(pos, pre);
        if (pos + val > s[pre+1]) val = s[pre+1]-pos;
        ans += val; pos += val; if (pos == s[pre+1]) continue;
        val = cal(pos, pre);
        if (pos + val > s[pre+1]) val = s[pre+1]-pos;
        mq.push(iii(ii(val, pos), pre));
    }
    for (long long i = 1; i <= k && mq.size(); i++){
        iii z = mq.top(); mq.pop();
        long long pos = z.first.second, val = z.first.first, pre = z.second;
        ans += val; pos += val; if (pos == s[pre+1]) continue;
        val = cal(pos, pre);
        if (pos + val > s[pre+1]) val = s[pre+1] - pos;
        mq.push(iii(ii(val, pos), pre));
    }
    cout << ans;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 2040 KB Output is correct
2 Correct 0 ms 2040 KB Output is correct
3 Correct 0 ms 2040 KB Output is correct
4 Correct 0 ms 2040 KB Output is correct
5 Correct 0 ms 2040 KB Output is correct
6 Correct 0 ms 2040 KB Output is correct
7 Incorrect 0 ms 2040 KB Output isn't correct
8 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 2040 KB Output is correct
2 Correct 0 ms 2040 KB Output is correct
3 Correct 0 ms 2040 KB Output is correct
4 Correct 0 ms 2040 KB Output is correct
5 Correct 0 ms 2040 KB Output is correct
6 Correct 0 ms 2040 KB Output is correct
7 Incorrect 0 ms 2040 KB Output isn't correct
8 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 2040 KB Output is correct
2 Correct 0 ms 2040 KB Output is correct
3 Correct 0 ms 2040 KB Output is correct
4 Correct 0 ms 2040 KB Output is correct
5 Correct 0 ms 2040 KB Output is correct
6 Correct 0 ms 2040 KB Output is correct
7 Incorrect 0 ms 2040 KB Output isn't correct
8 Halted 0 ms 0 KB -