답안 #252211

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
252211 2020-07-24T20:11:22 Z DS007 Semiexpress (JOI17_semiexpress) C++14
100 / 100
103 ms 33344 KB
#include <bits/stdc++.h>
using namespace std;
#define int long long

const int N = 1e9, M = 3005, K = 3005;
int n, m, k, a, b, c, t, ans, s[M];
vector<int> v;

int solveTestCase() {
    cin >> n >> m >> k >> a >> b >> c >> t;
    for (int i = 1; i <= m; i++)
        cin >> s[i];

    for (int i = 1; i < m; i++) {
        int time = (s[i] - 1) * b;
        if (time > t)
            break;

        int left = t - time;
        ans += min(left / a, s[i + 1] - s[i] - 1) + 1;
        if (i == 1)
            ans--;
        //cerr << ans << " ";
        int last = s[i] + left/ a;

        for (int j = 0; j < k; j++) {
            int start = last + 1;
            if (start >= s[i + 1])
                break;
            left = t - time - (start - s[i]) * c;
            if (left < 0)
                break;
            v.push_back(min(left / a, s[i + 1] - start - 1) + 1);
            last = last + 1 + left / a;
        }
    }

    if ((n - 1) * b <= t)
        ans++;

    //cerr<<"\n";
    //for (int i : v)
    //    cerr<<i<<" ";
    //cerr<<"\n";

    sort(v.begin(), v.end(), greater<>());
    for (int i = 0; i < min(k - m, (int)v.size()); i++)
        ans += v[i] >= 0 ? v[i]: 0;

    cout << ans;
}

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);

    int t = 1;
    //cin >> t;
    while (t--)
        solveTestCase();
}


Compilation message

semiexpress.cpp: In function 'long long int solveTestCase()':
semiexpress.cpp:51:1: warning: no return statement in function returning non-void [-Wreturn-type]
 }
 ^
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 384 KB Output is correct
2 Correct 0 ms 384 KB Output is correct
3 Correct 0 ms 384 KB Output is correct
4 Correct 0 ms 384 KB Output is correct
5 Correct 1 ms 384 KB Output is correct
6 Correct 0 ms 384 KB Output is correct
7 Correct 0 ms 384 KB Output is correct
8 Correct 0 ms 384 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 384 KB Output is correct
2 Correct 0 ms 384 KB Output is correct
3 Correct 0 ms 384 KB Output is correct
4 Correct 0 ms 384 KB Output is correct
5 Correct 1 ms 384 KB Output is correct
6 Correct 0 ms 384 KB Output is correct
7 Correct 0 ms 384 KB Output is correct
8 Correct 0 ms 384 KB Output is correct
9 Correct 0 ms 384 KB Output is correct
10 Correct 0 ms 384 KB Output is correct
11 Correct 0 ms 384 KB Output is correct
12 Correct 0 ms 384 KB Output is correct
13 Correct 0 ms 384 KB Output is correct
14 Correct 0 ms 384 KB Output is correct
15 Correct 0 ms 384 KB Output is correct
16 Correct 0 ms 384 KB Output is correct
17 Correct 0 ms 384 KB Output is correct
18 Correct 0 ms 384 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 384 KB Output is correct
2 Correct 0 ms 384 KB Output is correct
3 Correct 0 ms 384 KB Output is correct
4 Correct 0 ms 384 KB Output is correct
5 Correct 1 ms 384 KB Output is correct
6 Correct 0 ms 384 KB Output is correct
7 Correct 0 ms 384 KB Output is correct
8 Correct 0 ms 384 KB Output is correct
9 Correct 0 ms 384 KB Output is correct
10 Correct 0 ms 384 KB Output is correct
11 Correct 0 ms 384 KB Output is correct
12 Correct 0 ms 384 KB Output is correct
13 Correct 0 ms 384 KB Output is correct
14 Correct 0 ms 384 KB Output is correct
15 Correct 0 ms 384 KB Output is correct
16 Correct 0 ms 384 KB Output is correct
17 Correct 0 ms 384 KB Output is correct
18 Correct 0 ms 384 KB Output is correct
19 Correct 1 ms 384 KB Output is correct
20 Correct 1 ms 384 KB Output is correct
21 Correct 10 ms 2552 KB Output is correct
22 Correct 6 ms 1524 KB Output is correct
23 Correct 25 ms 8688 KB Output is correct
24 Correct 27 ms 4596 KB Output is correct
25 Correct 1 ms 384 KB Output is correct
26 Correct 1 ms 384 KB Output is correct
27 Correct 72 ms 17004 KB Output is correct
28 Correct 103 ms 33344 KB Output is correct
29 Correct 19 ms 4628 KB Output is correct
30 Correct 8 ms 2552 KB Output is correct