# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1051819 | 2024-08-10T09:59:57 Z | dilanyan | Semiexpress (JOI17_semiexpress) | C++17 | 1 ms | 348 KB |
//-------------dilanyan------------\\ #define _CRT_SECURE_NO_WARNINGS #include<bits/stdc++.h> #include<stdio.h> using namespace std; //------------------Kargpefines--------------------\\ #define ll long long #define pb push_back #define all(u) (u).begin(), (u).end() #define pqueue priority_queue #define upper upper_bound #define lower lower_bound #define umap unordered_map #define uset unordered_set void KarginSet(string name = "") { ios_base::sync_with_stdio(false); cin.tie(NULL); if (name.size()) { freopen((name + ".in").c_str(), "r", stdin); freopen((name + ".out").c_str(), "w", stdout); } } //-------------------KarginConstants------------------\\ const ll mod = 1e9 + 7; const ll inf = 2e18; //-------------------KarginCode-----------------------\\ const int N = 300006, M = 1000005; ll s[N]; void KarginSolve() { ll n, m, k, a, b, c, t; cin >> n >> m >> k >> a >> b >> c >> t; for (int i = 1;i <= m;i++) cin >> s[i]; ll ans = 0; ll cnt = k - m; if ((n - 1) * b <= t) ans++; for (int i = 1;i < m;i++) { ll time = (s[i] - 1) * b; if (time > t) break; ll ind = s[i]; while (time <= t) { ans++; ll l = ind, r = s[i + 1] - 1, st = ind; while (l <= r) { ll mid = (l + r) / 2; if ((mid - ind) * a <= t - time) { l = mid + 1; st = mid; } else r = mid - 1; } ans += st - ind; if (cnt == 0) { break; } if (st + 1 < s[i + 1]) { time += (st + 1 - ind) * c; ind = st + 1; cnt--; } else break; } } assert(ans >= 0); cout << ans - 1 << '\n'; } int main() { KarginSet(); int test = 1; //cin >> test; while (test--) { KarginSolve(); } return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 344 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Correct | 0 ms | 348 KB | Output is correct |
4 | Correct | 0 ms | 348 KB | Output is correct |
5 | Correct | 0 ms | 348 KB | Output is correct |
6 | Correct | 0 ms | 348 KB | Output is correct |
7 | Correct | 0 ms | 348 KB | Output is correct |
8 | Correct | 1 ms | 348 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 344 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Correct | 0 ms | 348 KB | Output is correct |
4 | Correct | 0 ms | 348 KB | Output is correct |
5 | Correct | 0 ms | 348 KB | Output is correct |
6 | Correct | 0 ms | 348 KB | Output is correct |
7 | Correct | 0 ms | 348 KB | Output is correct |
8 | Correct | 1 ms | 348 KB | Output is correct |
9 | Correct | 0 ms | 344 KB | Output is correct |
10 | Correct | 0 ms | 344 KB | Output is correct |
11 | Correct | 0 ms | 348 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 | 344 KB | Output is correct |
15 | Incorrect | 0 ms | 344 KB | Output isn't correct |
16 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 344 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Correct | 0 ms | 348 KB | Output is correct |
4 | Correct | 0 ms | 348 KB | Output is correct |
5 | Correct | 0 ms | 348 KB | Output is correct |
6 | Correct | 0 ms | 348 KB | Output is correct |
7 | Correct | 0 ms | 348 KB | Output is correct |
8 | Correct | 1 ms | 348 KB | Output is correct |
9 | Correct | 0 ms | 344 KB | Output is correct |
10 | Correct | 0 ms | 344 KB | Output is correct |
11 | Correct | 0 ms | 348 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 | 344 KB | Output is correct |
15 | Incorrect | 0 ms | 344 KB | Output isn't correct |
16 | Halted | 0 ms | 0 KB | - |