# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
562251 | 2022-05-14T08:11:09 Z | dattranxxx | Semiexpress (JOI17_semiexpress) | C++11 | 0 ms | 212 KB |
#include<bits/stdc++.h> using namespace std; using ll = long long; void file() { const string FILE_NAME = "FILE_NAME"; freopen((FILE_NAME + ".inp").c_str(), "r", stdin); freopen((FILE_NAME + ".out").c_str(), "w", stdout); } const int N = 3000 + 5; ll a[N], c[N]; int n, _, k, A, B, C, T; int get(int i, ll t, ll D) { // trong tg t thi den dc bn trong khoang [a[i] + 1, a[j] - 1] if (t < 0) return 0; int nxt = min(a[i] + t / D, a[i+1] - 1); return nxt - a[i] + 1; } int main() { cin.tie(0)->sync_with_stdio(0); cout.tie(0); cin >> _ >> n >> k; cin >> A >> B >> C; cin >> T; for (int i = 0; i < n; ++i) cin >> a[i]; int res = 0; for (int i = 0; i < n-1; ++i) { int b = get(i, T - a[i] * B, A), d = get(i, T - a[i] * B, C); res += b; c[i] = d - b; } sort(c, c + n, greater<int>()); k -= n; for (int i = 0; i < k && c[i] > 0; ++i) res += c[i]; cout << res; return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Incorrect | 0 ms | 212 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Incorrect | 0 ms | 212 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Incorrect | 0 ms | 212 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |