Submission #114100

#TimeUsernameProblemLanguageResultExecution timeMemory
114100popovicirobertSemiexpress (JOI17_semiexpress)C++14
100 / 100
21 ms2560 KiB
#include <bits/stdc++.h> #define lsb(x) (x & (-x)) #define ll long long #define ull unsigned long long // 217 // 44 using namespace std; const int INF = 1e9; int main() { //ifstream cin("A.in"); //ofstream cout("A.out"); int i, n, m, k, a, b, c; ios::sync_with_stdio(false); cin.tie(0), cout.tie(0); cin >> n >> m >> k >> a >> b >> c; // b < c < a ll t; cin >> t; vector <int> st(m + 1); int ans = -1; for(i = 1; i <= m; i++) { cin >> st[i]; if(1LL * b * (st[i] - 1) <= t) { ans++; } } k -= m; vector <int> vals; for(i = 1; i < m; i++) { ll now = 1LL * (st[i] - 1) * b; if(now > t) { break; } ll x = st[i]; int cnt = 0; while(x + 1 < st[i + 1] && cnt <= k) { ll y = (x + (t - now) / a); if(x == st[i]) { ans += min(y, 1LL * st[i + 1] - 1) - x; } if(y + 1 >= st[i + 1]) { break; } if(now + 1LL * (y + 1 - x) * c <= t) { now += 1LL * (y + 1 - x) * c; x = y + 1; y = (x + (t - now) / a); cnt++; if(cnt <= k) { vals.push_back(min(y, 1LL * st[i + 1] - 1) - x + 1); } } else { break; } } } sort(vals.begin(), vals.end(), greater<int>()); for(i = 0; i < k && i < vals.size(); i++) { ans += vals[i]; } cout << ans; //cin.close(); //cout.close(); return 0; }

Compilation message (stderr)

semiexpress.cpp: In function 'int main()':
semiexpress.cpp:80:27: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for(i = 0; i < k && i < vals.size(); i++) {
                         ~~^~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...