답안 #940836

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
940836 2024-03-07T17:57:28 Z Andrey Semiexpress (JOI17_semiexpress) C++14
100 / 100
134 ms 65660 KB
#include<bits/stdc++.h>
using namespace std;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    long long n,m,k,a,b,c,t,sb = 0;
    cin >> n >> m >> k >> a >> b >> c >> t;
    vector<long long> haha(m);
    for(long long i = 0; i < m; i++) {
        cin >> haha[i];
    }
    haha.push_back(n+1);
    long long bruh[m][k+1];
    vector<long long> wow(0);
    for(long long i = 0; i < m; i++) {
        if((haha[i]-1)*b <= t) {
            bruh[i][0] = (t-(haha[i]-1)*b)/a+1;
            bruh[i][0] = min(bruh[i][0],haha[i+1]-haha[i]);
        }
        else {
            bruh[i][0] = 0;
        }
        for(long long j = 1; j <= k; j++) {
            bruh[i][j] = bruh[i][j-1];
            if((haha[i]-1)*b+bruh[i][j-1]*c <= t) {
                bruh[i][j]+=(t-(haha[i]-1)*b-bruh[i][j-1]*c)/a+1;
            }
            bruh[i][j] = min(bruh[i][j],haha[i+1]-haha[i]);
        }
        sb+=bruh[i][0];
        for(long long j = 0; j <= k; j++) {
            bruh[i][j] = min(bruh[i][j],haha[i+1]-haha[i]);
            if(j > 0) {
                wow.push_back(bruh[i][j]-bruh[i][j-1]);
            }
        }
    }
    sort(wow.begin(),wow.end());
    reverse(wow.begin(),wow.end());
    for(long long i = 0; i < k-m; i++) {
        sb+=wow[i];
    }
    cout << sb-1;
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 708 KB Output is correct
4 Correct 1 ms 456 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 1 ms 344 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 708 KB Output is correct
4 Correct 1 ms 456 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 1 ms 344 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Correct 1 ms 600 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 0 ms 344 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 1 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 708 KB Output is correct
4 Correct 1 ms 456 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 1 ms 344 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Correct 1 ms 600 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 0 ms 344 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 1 ms 348 KB Output is correct
19 Correct 96 ms 57724 KB Output is correct
20 Correct 85 ms 61636 KB Output is correct
21 Correct 40 ms 31696 KB Output is correct
22 Correct 70 ms 54724 KB Output is correct
23 Correct 125 ms 64564 KB Output is correct
24 Correct 63 ms 29640 KB Output is correct
25 Correct 23 ms 17616 KB Output is correct
26 Correct 134 ms 65660 KB Output is correct
27 Correct 71 ms 52816 KB Output is correct
28 Correct 73 ms 53184 KB Output is correct
29 Correct 18 ms 15056 KB Output is correct
30 Correct 6 ms 4052 KB Output is correct