Submission #252208

# Submission time Handle Problem Language Result Execution time Memory
252208 2020-07-24T20:00:27 Z DS007 Semiexpress (JOI17_semiexpress) C++14
0 / 100
1 ms 384 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;
        //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;
        }
    }

    //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:46:1: warning: no return statement in function returning non-void [-Wreturn-type]
 }
 ^
# Verdict Execution time Memory Grader output
1 Correct 1 ms 384 KB Output is correct
2 Incorrect 0 ms 384 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 384 KB Output is correct
2 Incorrect 0 ms 384 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 384 KB Output is correct
2 Incorrect 0 ms 384 KB Output isn't correct
3 Halted 0 ms 0 KB -