Submission #205575

#TimeUsernameProblemLanguageResultExecution timeMemory
205575KastandaSemiexpress (JOI17_semiexpress)C++11
100 / 100
20 ms2540 KiB
// 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 (stderr)

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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...