Submission #595022

# Submission time Handle Problem Language Result Execution time Memory
595022 2022-07-13T09:09:31 Z piOOE Semiexpress (JOI17_semiexpress) C++17
48 / 100
232 ms 262144 KB
#include <bits/stdc++.h>

using namespace std;

using ll = long long;
#define int ll

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int n, m, k;
    cin >> n >> m >> k;
    int a, b, c;
    cin >> a >> b >> c; //slow, fast, middle
    ll t;
    cin >> t;
    vector<int> s(m);
    for (int i = 0; i < m; ++i) {
        cin >> s[i];
    }
    vector<pair<int, bool>> v;
    ll ans = 0;
    s.push_back(n + 1);
    for (int i = 0; i < (int)s.size() - 1; ++i) {
        ll dist = (s[i] - 1) * b;
        if (dist > t) {
            break;
        }
        ll x = s[i];
        while (x < s[i + 1] && dist <= t) {
            ll nxt = (t - dist) / a;
            if (x + nxt + 1 >= s[i + 1]) {
                nxt = s[i + 1] - x - 1;
            }
            v.push_back({nxt + 1, x != s[i]});
            dist += (nxt + 1) * c;
            x += nxt + 1;
        }
    }
    sort(v.begin(), v.end(), greater());
    int cnt = m;
    for (int i = 0; i < v.size(); ++i) {
        if (cnt + v[i].second <= k) {
            ans += v[i].first;
            cnt += v[i].second;
        }
    }
    cout << ans - 1;
    return 0;
}

Compilation message

semiexpress.cpp: In function 'int main()':
semiexpress.cpp:42:23: warning: comparison of integer expressions of different signedness: 'll' {aka 'long long int'} and 'std::vector<std::pair<long long int, bool> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   42 |     for (int i = 0; i < v.size(); ++i) {
      |                     ~~^~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 320 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 320 KB Output is correct
8 Correct 0 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 316 KB Output is correct
12 Correct 1 ms 212 KB Output is correct
13 Correct 0 ms 316 KB Output is correct
14 Correct 0 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
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 320 KB Output is correct
8 Correct 0 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 316 KB Output is correct
12 Correct 1 ms 212 KB Output is correct
13 Correct 0 ms 316 KB Output is correct
14 Correct 0 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 332 KB Output is correct
21 Runtime error 232 ms 262144 KB Execution killed with signal 9
22 Halted 0 ms 0 KB -