Submission #556839

#TimeUsernameProblemLanguageResultExecution timeMemory
556839Ai7081Semiexpress (JOI17_semiexpress)C++17
0 / 100
1 ms212 KiB
#include <bits/stdc++.h> using namespace std; #define ll long long const ll N = 3005; ll n, m, k, s[N], ans, a, b, c, t; priority_queue<ll> pq; int main() { scanf(" %lld %lld %lld", &n, &m, &k); scanf(" %lld %lld %lld", &a, &b, &c); scanf(" %lld", &t); k -= m; for (ll i=1; i<=m; i++) scanf(" %lld", &s[i]); ans = (t >= b*n) - 1; for (ll i=1; i<m && t>=0; i++) { ans += min(s[i+1]-s[i]-1, t/a)+1; ll now = min(s[i+1], s[i]+t/a+1), pre=0, tmp=k; while (now < s[i+1] && tmp--) { pre = now; ll t_left = t - (pre - s[i]) * c; if (t_left < 0) break; now = min(pre + t_left/a, s[i+1]-1); pq.push(now - pre + 1); now++; } t -= (s[i+1] - s[i]) * b; } while (!pq.empty() && k--) ans += pq.top(), pq.pop(); printf("%lld", ans); return 0; }

Compilation message (stderr)

semiexpress.cpp: In function 'int main()':
semiexpress.cpp:11:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   11 |     scanf(" %lld %lld %lld", &n, &m, &k);
      |     ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
semiexpress.cpp:12:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   12 |     scanf(" %lld %lld %lld", &a, &b, &c);
      |     ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
semiexpress.cpp:13:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   13 |     scanf(" %lld", &t);
      |     ~~~~~^~~~~~~~~~~~~
semiexpress.cpp:15:34: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   15 |     for (ll i=1; i<=m; i++) scanf(" %lld", &s[i]);
      |                             ~~~~~^~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...