Submission #489090

#TimeUsernameProblemLanguageResultExecution timeMemory
489090cheissmartSemiexpress (JOI17_semiexpress)C++14
0 / 100
1 ms204 KiB
#include <bits/stdc++.h> #pragma GCC optimize("trapv") #define IO_OP ios::sync_with_stdio(0), cin.tie(0) #define F first #define S second #define V vector #define PB push_back #define EB emaplce_back #define MP make_pair #define ALL(v) (v).begin(), (v).end() using namespace std; typedef long long ll; typedef pair<int, int> pi; typedef vector<int> vi; const int INF = 1e9 + 7, N = 3005; int s[N]; signed main() { IO_OP; int n, m, k, a, b, c; ll t; cin >> n >> m >> k >> a >> b >> c >> t; assert(k >= m); k -= m; int ans = 0; for(int i = 0; i < m; i++) { cin >> s[i]; } vi tt; for(int i = 0; i < m - 1; i++) { ll now = 1LL * (s[i] - 1) * b; int pos = s[i]; vi aux; while(now <= t && pos < s[i + 1] && aux.size() < k + 1) { // now + a * x <= t // pos + x < s[i + 1] ll x = min<ll>((t - now) / a, s[i + 1] - pos - 1); aux.PB(x + 1); pos = pos + x + 1; now += 1LL * (x + 1) * c; } if(aux.size()) { ans += aux[0]; for(int i = 1; i < int(aux.size()); i++) tt.PB(aux[i]); } } if(1LL * s[m - 1] * b <= t) ans++; sort(ALL(tt), greater<int>()); for(int i = 0; i < min(int(tt.size()), k); i++) ans += tt[i]; ans--; cout << ans << '\n'; }

Compilation message (stderr)

semiexpress.cpp: In function 'int main()':
semiexpress.cpp:40:50: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   40 |   while(now <= t && pos < s[i + 1] && aux.size() < k + 1) {
      |                                       ~~~~~~~~~~~^~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...