Submission #205575

# Submission time Handle Problem Language Result Execution time Memory
205575 2020-02-29T08:30:53 Z Kastanda Semiexpress (JOI17_semiexpress) C++11
100 / 100
20 ms 2540 KB
// In The Name Of The Queen
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 3003;
int n, m, k, P[N];
ll A, B, C, T;
int main()
{
    scanf("%d%d%d", &n, &m, &k);
    scanf("%lld%lld%lld", &A, &B, &C);
    scanf("%lld", &T);
    for (int i = 1; i <= m; i ++)
        scanf("%d", &P[i]);
    int tot = 0;
    for (int h = 2; h <= m; h ++)
        if ((P[h] - 1) * B <= T)
            tot ++;
    vector < int > vec;
    for (int h = 1; h < m; h ++)
        if ((P[h] - 1) * B < T)
        {
            ll ri = P[h + 1];
            ll Tm = T - (P[h] - 1) * B;
            ll now = P[h];
            ll tobe = min(now + Tm / A + 1, ri);
            tot += tobe - now - 1;
            int cur = 0;
            while (now < ri && Tm >= (tobe - now) * C && cur < k - m)
            {
                cur ++;
                Tm -= (tobe - now) * C;
                now = tobe;
                tobe = min(now + Tm / A + 1, ri);
                vec.push_back(tobe - now);
            }
        }
    sort(vec.begin(), vec.end());
    reverse(vec.begin(), vec.end());
    for (int i = 0; i < min(k - m, (int)vec.size()); i ++)
        tot += vec[i];
    return !printf("%d\n", tot);
}

Compilation message

semiexpress.cpp: In function 'int main()':
semiexpress.cpp:10:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d%d%d", &n, &m, &k);
     ~~~~~^~~~~~~~~~~~~~~~~~~~~~
semiexpress.cpp:11:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%lld%lld%lld", &A, &B, &C);
     ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
semiexpress.cpp:12:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%lld", &T);
     ~~~~~^~~~~~~~~~~~
semiexpress.cpp:14:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d", &P[i]);
         ~~~~~^~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 5 ms 256 KB Output is correct
2 Correct 5 ms 256 KB Output is correct
3 Correct 5 ms 256 KB Output is correct
4 Correct 5 ms 128 KB Output is correct
5 Correct 5 ms 376 KB Output is correct
6 Correct 5 ms 256 KB Output is correct
7 Correct 5 ms 256 KB Output is correct
8 Correct 5 ms 376 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 256 KB Output is correct
2 Correct 5 ms 256 KB Output is correct
3 Correct 5 ms 256 KB Output is correct
4 Correct 5 ms 128 KB Output is correct
5 Correct 5 ms 376 KB Output is correct
6 Correct 5 ms 256 KB Output is correct
7 Correct 5 ms 256 KB Output is correct
8 Correct 5 ms 376 KB Output is correct
9 Correct 5 ms 256 KB Output is correct
10 Correct 5 ms 256 KB Output is correct
11 Correct 5 ms 256 KB Output is correct
12 Correct 5 ms 376 KB Output is correct
13 Correct 5 ms 256 KB Output is correct
14 Correct 5 ms 256 KB Output is correct
15 Correct 5 ms 376 KB Output is correct
16 Correct 5 ms 256 KB Output is correct
17 Correct 5 ms 376 KB Output is correct
18 Correct 5 ms 256 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 256 KB Output is correct
2 Correct 5 ms 256 KB Output is correct
3 Correct 5 ms 256 KB Output is correct
4 Correct 5 ms 128 KB Output is correct
5 Correct 5 ms 376 KB Output is correct
6 Correct 5 ms 256 KB Output is correct
7 Correct 5 ms 256 KB Output is correct
8 Correct 5 ms 376 KB Output is correct
9 Correct 5 ms 256 KB Output is correct
10 Correct 5 ms 256 KB Output is correct
11 Correct 5 ms 256 KB Output is correct
12 Correct 5 ms 376 KB Output is correct
13 Correct 5 ms 256 KB Output is correct
14 Correct 5 ms 256 KB Output is correct
15 Correct 5 ms 376 KB Output is correct
16 Correct 5 ms 256 KB Output is correct
17 Correct 5 ms 376 KB Output is correct
18 Correct 5 ms 256 KB Output is correct
19 Correct 5 ms 376 KB Output is correct
20 Correct 5 ms 376 KB Output is correct
21 Correct 5 ms 376 KB Output is correct
22 Correct 7 ms 504 KB Output is correct
23 Correct 20 ms 2540 KB Output is correct
24 Correct 5 ms 376 KB Output is correct
25 Correct 5 ms 376 KB Output is correct
26 Correct 6 ms 376 KB Output is correct
27 Correct 5 ms 376 KB Output is correct
28 Correct 5 ms 376 KB Output is correct
29 Correct 13 ms 2536 KB Output is correct
30 Correct 10 ms 1520 KB Output is correct