# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
142653 | 2019-08-10T09:30:34 Z | arnold518 | Semiexpress (JOI17_semiexpress) | C++14 | 23 ms | 2540 KB |
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int, int> pii; typedef pair<ll, ll> pll; const int MAXN = 1e9; const int MAXK = 3000; const int MAXM = 3000; int N, M, K, S[MAXM+10]; ll A, B, C, T, ans; int main() { int i, j; scanf("%d%d%d%lld%lld%lld%lld", &N, &M, &K, &A, &B, &C, &T); for(i=0; i<M; i++) scanf("%d", &S[i]); S[M]=N+1; K-=M; vector<int> todo; for(i=0; i<M; i++) { int pt=S[i]; for(j=0; j<=K && pt<S[i+1]; j++) { if(T<B*(S[i]-1)+C*(pt-S[i])) break; int nxt=(T-B*(S[i]-1)-C*(pt-S[i]))/A+pt; if(j!=0) { if(nxt<S[i+1]) todo.push_back(nxt-pt+1), pt=nxt+1; else { todo.push_back(S[i+1]-pt); break; } } else { if(nxt<S[i+1]) ans+=nxt-pt+1, pt=nxt+1; else { ans+=S[i+1]-pt; break; } } } } sort(todo.begin(), todo.end(), greater<int>()); for(i=0; i<todo.size() && i<K; i++) ans+=todo[i]; printf("%d", ans-1); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 364 KB | Output is correct |
2 | Correct | 2 ms | 376 KB | Output is correct |
3 | Correct | 2 ms | 376 KB | Output is correct |
4 | Correct | 2 ms | 256 KB | Output is correct |
5 | Correct | 2 ms | 256 KB | Output is correct |
6 | Correct | 2 ms | 376 KB | Output is correct |
7 | Correct | 2 ms | 256 KB | Output is correct |
8 | Correct | 2 ms | 256 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 364 KB | Output is correct |
2 | Correct | 2 ms | 376 KB | Output is correct |
3 | Correct | 2 ms | 376 KB | Output is correct |
4 | Correct | 2 ms | 256 KB | Output is correct |
5 | Correct | 2 ms | 256 KB | Output is correct |
6 | Correct | 2 ms | 376 KB | Output is correct |
7 | Correct | 2 ms | 256 KB | Output is correct |
8 | Correct | 2 ms | 256 KB | Output is correct |
9 | Correct | 2 ms | 504 KB | Output is correct |
10 | Correct | 2 ms | 256 KB | Output is correct |
11 | Correct | 2 ms | 256 KB | Output is correct |
12 | Correct | 2 ms | 376 KB | Output is correct |
13 | Correct | 2 ms | 256 KB | Output is correct |
14 | Correct | 2 ms | 376 KB | Output is correct |
15 | Correct | 2 ms | 256 KB | Output is correct |
16 | Correct | 2 ms | 256 KB | Output is correct |
17 | Correct | 2 ms | 256 KB | Output is correct |
18 | Correct | 2 ms | 424 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 364 KB | Output is correct |
2 | Correct | 2 ms | 376 KB | Output is correct |
3 | Correct | 2 ms | 376 KB | Output is correct |
4 | Correct | 2 ms | 256 KB | Output is correct |
5 | Correct | 2 ms | 256 KB | Output is correct |
6 | Correct | 2 ms | 376 KB | Output is correct |
7 | Correct | 2 ms | 256 KB | Output is correct |
8 | Correct | 2 ms | 256 KB | Output is correct |
9 | Correct | 2 ms | 504 KB | Output is correct |
10 | Correct | 2 ms | 256 KB | Output is correct |
11 | Correct | 2 ms | 256 KB | Output is correct |
12 | Correct | 2 ms | 376 KB | Output is correct |
13 | Correct | 2 ms | 256 KB | Output is correct |
14 | Correct | 2 ms | 376 KB | Output is correct |
15 | Correct | 2 ms | 256 KB | Output is correct |
16 | Correct | 2 ms | 256 KB | Output is correct |
17 | Correct | 2 ms | 256 KB | Output is correct |
18 | Correct | 2 ms | 424 KB | Output is correct |
19 | Correct | 3 ms | 504 KB | Output is correct |
20 | Correct | 2 ms | 376 KB | Output is correct |
21 | Correct | 2 ms | 380 KB | Output is correct |
22 | Correct | 4 ms | 504 KB | Output is correct |
23 | Correct | 23 ms | 2536 KB | Output is correct |
24 | Correct | 3 ms | 376 KB | Output is correct |
25 | Correct | 2 ms | 376 KB | Output is correct |
26 | Correct | 2 ms | 376 KB | Output is correct |
27 | Correct | 3 ms | 376 KB | Output is correct |
28 | Correct | 3 ms | 376 KB | Output is correct |
29 | Correct | 16 ms | 2540 KB | Output is correct |
30 | Correct | 10 ms | 1520 KB | Output is correct |