답안 #651693

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
651693 2022-10-19T19:16:49 Z four_specks Semiexpress (JOI17_semiexpress) C++17
100 / 100
13 ms 4556 KB
#include <bits/stdc++.h>

using namespace std;

inline namespace
{
} // namespace

void solve(int _test_ = -1)
{
    long n;
    int m, k;
    cin >> n >> m >> k;

    long a, b, c, t;
    cin >> a >> b >> c >> t;

    vector<long> s(m);
    for (long &x : s)
        cin >> x, --x;

    long cnt = 0;
    vector<long> can;
    for (int i = 0; i < m - 1; i++)
    {
        if (b * s[i] <= t)
        {
            long x = min(s[i + 1], s[i] + (t - b * s[i]) / a + 1);
            cnt += x - s[i];
            for (int j = 0; j < k - m && x < s[i + 1]; j++)
            {
                if (b * s[i] + c * (x - s[i]) <= t)
                {
                    long y = min(s[i + 1], x + (t - (b * s[i] + c * (x - s[i]))) / a + 1);
                    can.push_back(y - x);
                    x = y;
                }
                else
                    break;
            }
        }
        else
            break;
    }
    if (b * s[m - 1] > t)
        cnt--;
    sort(can.begin(), can.end(), greater<>());

    for (int i = 0; i < min(k - m, (int)can.size()); i++)
        cnt += can[i];

    cout << cnt << '\n';
}

int main()
{
    ios_base::sync_with_stdio(false), cin.tie(NULL);

    int T_ = 1;
    // cin >> T_;

    for (int t_ = 0; t_ < T_; t_++)
        solve(t_);

    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 1 ms 288 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 1 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 1 ms 288 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 1 ms 212 KB Output is correct
9 Correct 1 ms 320 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 1 ms 212 KB Output is correct
12 Correct 1 ms 320 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 1 ms 212 KB Output is correct
18 Correct 1 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 1 ms 288 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 1 ms 212 KB Output is correct
9 Correct 1 ms 320 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 1 ms 212 KB Output is correct
12 Correct 1 ms 320 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 1 ms 212 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 340 KB Output is correct
22 Correct 2 ms 588 KB Output is correct
23 Correct 13 ms 4544 KB Output is correct
24 Correct 1 ms 328 KB Output is correct
25 Correct 1 ms 212 KB Output is correct
26 Correct 1 ms 332 KB Output is correct
27 Correct 1 ms 340 KB Output is correct
28 Correct 1 ms 340 KB Output is correct
29 Correct 9 ms 4556 KB Output is correct
30 Correct 6 ms 2512 KB Output is correct