Submission #1109317

# Submission time Handle Problem Language Result Execution time Memory
1109317 2024-11-06T12:44:27 Z mariaclara Semiexpress (JOI17_semiexpress) C++17
100 / 100
12 ms 3700 KB
#include<bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef tuple<ll,ll,ll> trio;
typedef pair<int,int> pii;
const int MAXN = 2e5+5;
const ll INF = 1e9;
#define all(x) x.begin(), x.end()
#define sz(x) (int)x.size()
#define mk make_pair
#define pb push_back
#define fr first
#define sc second

int n, m, k, v[3005], ans;
ll t, A, B, C;
int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);

    cin >> n >> m >> k >> A >> B >> C >> t;
    k -= m;

    for(int i = 1; i <= m; i++)
        cin >> v[i];

    vector<int> val;

    v[m+1] = n+1;
    for(int i = 1; i <= m; i++) {
        ll tempo = (v[i] - 1) * B;
        if(tempo > t) break;

        int qtd = (t - tempo)/A;
        qtd = min(qtd, v[i+1] - v[i] - 1);
        ans += qtd+1;

        for(int j = 1, at = qtd + v[i] + 1; j <= k and at < v[i+1]; j++) {
            tempo = (v[i] - 1) * B + (at - v[i]) * C;
            if(tempo > t) break;

            qtd = (t - tempo)/A;
            qtd = min(qtd,  v[i+1] - at - 1);
            val.pb(qtd + 1);
            at += qtd + 1;
        }
    }

    sort(all(val));
    reverse(all(val));

    for(int i = 0; i < min(k, sz(val)); i++) ans += val[i];

    cout << ans-1 << "\n";
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 1 ms 336 KB Output is correct
3 Correct 1 ms 592 KB Output is correct
4 Correct 1 ms 336 KB Output is correct
5 Correct 1 ms 336 KB Output is correct
6 Correct 1 ms 336 KB Output is correct
7 Correct 1 ms 336 KB Output is correct
8 Correct 1 ms 336 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 1 ms 336 KB Output is correct
3 Correct 1 ms 592 KB Output is correct
4 Correct 1 ms 336 KB Output is correct
5 Correct 1 ms 336 KB Output is correct
6 Correct 1 ms 336 KB Output is correct
7 Correct 1 ms 336 KB Output is correct
8 Correct 1 ms 336 KB Output is correct
9 Correct 1 ms 336 KB Output is correct
10 Correct 1 ms 336 KB Output is correct
11 Correct 1 ms 504 KB Output is correct
12 Correct 1 ms 336 KB Output is correct
13 Correct 1 ms 336 KB Output is correct
14 Correct 1 ms 336 KB Output is correct
15 Correct 1 ms 336 KB Output is correct
16 Correct 1 ms 336 KB Output is correct
17 Correct 1 ms 336 KB Output is correct
18 Correct 1 ms 336 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 1 ms 336 KB Output is correct
3 Correct 1 ms 592 KB Output is correct
4 Correct 1 ms 336 KB Output is correct
5 Correct 1 ms 336 KB Output is correct
6 Correct 1 ms 336 KB Output is correct
7 Correct 1 ms 336 KB Output is correct
8 Correct 1 ms 336 KB Output is correct
9 Correct 1 ms 336 KB Output is correct
10 Correct 1 ms 336 KB Output is correct
11 Correct 1 ms 504 KB Output is correct
12 Correct 1 ms 336 KB Output is correct
13 Correct 1 ms 336 KB Output is correct
14 Correct 1 ms 336 KB Output is correct
15 Correct 1 ms 336 KB Output is correct
16 Correct 1 ms 336 KB Output is correct
17 Correct 1 ms 336 KB Output is correct
18 Correct 1 ms 336 KB Output is correct
19 Correct 1 ms 336 KB Output is correct
20 Correct 1 ms 336 KB Output is correct
21 Correct 2 ms 336 KB Output is correct
22 Correct 2 ms 592 KB Output is correct
23 Correct 12 ms 3700 KB Output is correct
24 Correct 1 ms 336 KB Output is correct
25 Correct 1 ms 336 KB Output is correct
26 Correct 1 ms 336 KB Output is correct
27 Correct 1 ms 508 KB Output is correct
28 Correct 1 ms 336 KB Output is correct
29 Correct 9 ms 3532 KB Output is correct
30 Correct 6 ms 1488 KB Output is correct