답안 #556839

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
556839 2022-05-04T03:34:04 Z Ai7081 Semiexpress (JOI17_semiexpress) C++17
0 / 100
1 ms 212 KB
#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

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]);
      |                             ~~~~~^~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Incorrect 0 ms 212 KB Output isn't correct
8 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Incorrect 0 ms 212 KB Output isn't correct
8 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Incorrect 0 ms 212 KB Output isn't correct
8 Halted 0 ms 0 KB -