This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include<bits/stdc++.h>
using namespace std;
ostream& operator<<(ostream &out, string str) {
for(char c : str) out << c;
return out;
}
template<class L, class R> ostream& operator<<(ostream &out, pair<L, R> p) {
return out << "(" << p.first << ", " << p.second << ")";
}
template<class T> auto operator<<(ostream &out, T a) -> decltype(a.begin(), out) {
out << "{";
for(auto it = a.begin(); it != a.end(); it = next(it))
out << (it != a.begin() ? ", " : "") << *it;
return out << "}";
}
void dump() { cerr << "\n"; }
template<class T, class... Ts> void dump(T a, Ts... x) {
cerr << a << ", ";
dump(x...);
}
#ifdef DEBUG
# define debug(...) cerr << "[" #__VA_ARGS__ "]: ", dump(__VA_ARGS__)
#else
# define debug(...) false
#endif
#define REP(i, n) for(int i = 0; i < n; i++)
#define FOR(i, a, b) for(int i = a; i <= b; i++)
#define ST first
#define ND second
template<class T> int size(T && a) { return a.size(); }
using LL = long long;
using PII = pair<int, int>;
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
int n, m, k;
LL a, b, c, t;
cin >> n >> m >> k >> a >> b >> c >> t;
vector<LL> s(m);
k -= m;
REP(i, m) cin >> s[i];
s.emplace_back(n + 1);
LL f = min(a, min(b, c));
debug(f);
LL ans = -1;
vector<LL> best;
REP(i, m) {
LL time_elapsed = f * (s[i] - 1);
debug(i, s[i], time_elapsed);
if(time_elapsed > t) break;
LL pos = s[i] + (t - time_elapsed) / a;
pos = min(pos, s[i + 1] - 1);
ans += pos - s[i] + 1;
debug(i, s[i], pos, ans);
REP(j, k) {
LL last = pos;
pos++;
if(pos >= s[i + 1]) break;
time_elapsed = f * (s[i] - 1) + (pos - s[i]) * c;
debug(pos, time_elapsed);
if(time_elapsed > t) break;
pos += (t - time_elapsed) / a;
pos = min(pos, s[i + 1] - 1);
debug(pos, last);
best.emplace_back(pos - last);
}
}
debug(best);
sort(best.rbegin(), best.rend());
REP(i, min(k, size(best)))
ans += best[i];
cout << ans << "\n";
}
Compilation message (stderr)
semiexpress.cpp: In function 'int main()':
semiexpress.cpp:55:10: warning: statement has no effect [-Wunused-value]
debug(f);
^
semiexpress.cpp:60:31: warning: statement has no effect [-Wunused-value]
debug(i, s[i], time_elapsed);
^
semiexpress.cpp:65:27: warning: statement has no effect [-Wunused-value]
debug(i, s[i], pos, ans);
^
semiexpress.cpp:71:28: warning: statement has no effect [-Wunused-value]
debug(pos, time_elapsed);
^
semiexpress.cpp:75:20: warning: statement has no effect [-Wunused-value]
debug(pos, last);
^
semiexpress.cpp:80:13: warning: statement has no effect [-Wunused-value]
debug(best);
^
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |