CSES - Datatähti 2023 loppu - Results
Submission details
Task:Unirytmi
Sender:vgtcross
Submission time:2023-01-21 16:07:12 +0200
Language:C++11
Status:READY
Result:13
Feedback
groupverdictscore
#1ACCEPTED13
#20
#30
#40
Test results
testverdicttimegroup
#1ACCEPTED0.00 s1, 2, 3, 4details
#2ACCEPTED0.00 s1, 2, 3, 4details
#30.00 s2, 4details
#4ACCEPTED0.00 s1, 2, 3, 4details
#50.00 s3, 4details
#60.00 s2, 3, 4details
#70.00 s4details
#80.00 s4details
#9ACCEPTED0.01 s1, 2, 3, 4details
#100.00 s2, 4details
#110.00 s3, 4details
#12ACCEPTED0.00 s1, 2, 3, 4details
#13ACCEPTED0.00 s1, 2, 3, 4details
#140.00 s2, 4details
#150.00 s2, 3, 4details
#160.00 s4details
#170.00 s2, 4details
#180.00 s2, 4details

Code

#include <bits/stdc++.h>

#define MODE 0

#if MODE == 1
#define debug(x) cout << #x << ": " << x << endl
#define log(x) cout << x << endl
#else
#define debug(x)
#define log(x)
#endif

using namespace std;
using ll = long long;
using pii = pair<int, int>;

void solve() {
    int n, a, b, c;

    cin >> n >> a >> b >> c;

    vector<bool> evs(310, 0);
    for (int i = 0; i < n; ++i) {
        int v;
        cin >> v;
        evs[v] = 1;
    }

    int dp[310];
    bool good[310];
    int ans = 0;

    memset(dp, 0, sizeof(dp));
    memset(good, 0, sizeof(good));
    good[0] = 1;
    for (int i = 0; i <= 101; ++i) {
        if (!good[i])
            continue;
        
        int ecnt = 0;
        for (int j = i+1; j < i+a && j <= 202; ++j) {
            ecnt += evs[j];
        }

        for (int j = i+a; j <= i+b && j <= 202; ++j) {
            if (j + c <= 303) {
                dp[j+c] = max(dp[j+c], dp[i]+ecnt);
                good[j+c] = 1;
                ans = max(ans, dp[i]+ecnt);
            }
            
            ecnt += evs[j];
        }

        log("");
        debug(i);
        debug(evs[i]);
        debug(dp[i]);
    }

    cout << ans << '\n';
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    
    //freopen("input.txt", "r", stdin);

    solve();
}

Test details

Test 1

Group: 1, 2, 3, 4

Verdict: ACCEPTED

input
3 5 7 5
5 8 12

correct output
2

user output
2

Test 2

Group: 1, 2, 3, 4

Verdict: ACCEPTED

input
3 5 7 5
6 21 22

correct output
2

user output
2

Test 3

Group: 2, 4

Verdict:

input
1000 127 134 713
491 3778 4129 4563 6372 7347 7...

correct output
281

user output
(empty)

Test 4

Group: 1, 2, 3, 4

Verdict: ACCEPTED

input
15 11 13 11
2 14 17 22 23 25 27 31 32 69 7...

correct output
11

user output
11

Test 5

Group: 3, 4

Verdict:

input
200 1 2 100
94623 612821 706074 2477208 33...

correct output
196

user output
(empty)

Test 6

Group: 2, 3, 4

Verdict:

input
200 27 30 100
8 183 310 517 819 927 1276 146...

correct output
87

user output
1

Test 7

Group: 4

Verdict:

input
1000 71428 72356 221426
109849 411498 1480476 1734215 ...

correct output
369

user output
(empty)

Test 8

Group: 4

Verdict:

input
1000 71428 71429 220426
557231 743380 905998 1053927 1...

correct output
266

user output
(empty)

Test 9

Group: 1, 2, 3, 4

Verdict: ACCEPTED

input
74 1 3 3
1 2 4 6 7 8 9 11 13 14 15 16 1...

correct output
29

user output
29

Test 10

Group: 2, 4

Verdict:

input
1000 478 479 1426
800 1062 2097 3132 4106 6698 7...

correct output
275

user output
(empty)

Test 11

Group: 3, 4

Verdict:

input
200 4 5 93
84806 597999 828025 1057335 16...

correct output
198

user output
(empty)

Test 12

Group: 1, 2, 3, 4

Verdict: ACCEPTED

input
9 2 2 1
1 2 3 4 5 6 7 8 9

correct output
3

user output
3

Test 13

Group: 1, 2, 3, 4

Verdict: ACCEPTED

input
30 5 7 5
2 3 4 5 6 10 11 16 19 20 21 23...

correct output
19

user output
19

Test 14

Group: 2, 4

Verdict:

input
1000 1 1000000 1
176 273 1016 1529 1642 2291 30...

correct output
1000

user output
(empty)

Test 15

Group: 2, 3, 4

Verdict:

input
200 3 7 69
334 429 1639 1775 1840 1971 21...

correct output
110

user output
0

Test 16

Group: 4

Verdict:

input
1000 1 2 250000
500004 1000007 1500010 2000013...

correct output
1000

user output
(empty)

Test 17

Group: 2, 4

Verdict:

input
1000 1 2 497
998 1995 2992 3989 4986 5983 6...

correct output
1000

user output
(empty)

Test 18

Group: 2, 4

Verdict:

input
1000 1 704731 20372
1901 3947 4720 5745 6005 6413 ...

correct output
989

user output
(empty)