Submission #252211

#TimeUsernameProblemLanguageResultExecution timeMemory
252211DS007Semiexpress (JOI17_semiexpress)C++14
100 / 100
103 ms33344 KiB
#include <bits/stdc++.h> using namespace std; #define int long long const int N = 1e9, M = 3005, K = 3005; int n, m, k, a, b, c, t, ans, s[M]; vector<int> v; int solveTestCase() { cin >> n >> m >> k >> a >> b >> c >> t; for (int i = 1; i <= m; i++) cin >> s[i]; for (int i = 1; i < m; i++) { int time = (s[i] - 1) * b; if (time > t) break; int left = t - time; ans += min(left / a, s[i + 1] - s[i] - 1) + 1; if (i == 1) ans--; //cerr << ans << " "; int last = s[i] + left/ a; for (int j = 0; j < k; j++) { int start = last + 1; if (start >= s[i + 1]) break; left = t - time - (start - s[i]) * c; if (left < 0) break; v.push_back(min(left / a, s[i + 1] - start - 1) + 1); last = last + 1 + left / a; } } if ((n - 1) * b <= t) ans++; //cerr<<"\n"; //for (int i : v) // cerr<<i<<" "; //cerr<<"\n"; sort(v.begin(), v.end(), greater<>()); for (int i = 0; i < min(k - m, (int)v.size()); i++) ans += v[i] >= 0 ? v[i]: 0; cout << ans; } signed main() { ios::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); int t = 1; //cin >> t; while (t--) solveTestCase(); }

Compilation message (stderr)

semiexpress.cpp: In function 'long long int solveTestCase()':
semiexpress.cpp:51:1: warning: no return statement in function returning non-void [-Wreturn-type]
 }
 ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...