답안 #581891

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
581891 2022-06-23T07:45:11 Z hibiki Semiexpress (JOI17_semiexpress) C++11
100 / 100
8 ms 4548 KB
#include<bits/stdc++.h>
using namespace std;

long long n,m,k;
long long a,b,c;
long long t,s[3005];
long long ans = 0;
priority_queue<long long> ex;

int main()
{
    scanf("%lld %lld %lld",&n,&m,&k);
    scanf("%lld %lld %lld",&a,&b,&c);
    scanf("%lld",&t);
    k -= m;
    for(int i = 0; i < m; i++)
        scanf("%lld",&s[i]);
    for(int i = 0; i < m; i++)
    {
        long long ti = (s[i] - 1) * b;
        if(ti > t) break;
        long long go = min(s[i] + (t - ti) / a, (i == m - 1)? n: (s[i + 1] - 1));
        // printf("a %lld %lld\n",s[i],go);
        ans += go - s[i] + 1;
        long long nw = go + 1;
        for(int j = 0; j < k && nw < ((i == m - 1)? (n + 1): s[i + 1]); j++)
        {
            long long ti2 = ti + (nw - s[i]) * c;
            if(ti2 > t) break;
            long long go2 = min(nw + (t - ti2) / a, (i == m - 1)? n: (s[i + 1] - 1));
            // printf("b %lld %lld\n",nw,go2);
            ex.push(go2 - nw + 1);
            nw = go2 + 1;
        }
    }
    while(!ex.empty() && k)
    {
        ans += ex.top();
        ex.pop();
        k--;
    }
    ans--;
    printf("%lld\n",ans);
    return 0;
}

Compilation message

semiexpress.cpp: In function 'int main()':
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",&n,&m,&k);
      |     ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
semiexpress.cpp:13:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   13 |     scanf("%lld %lld %lld",&a,&b,&c);
      |     ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
semiexpress.cpp:14:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   14 |     scanf("%lld",&t);
      |     ~~~~~^~~~~~~~~~~
semiexpress.cpp:17:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   17 |         scanf("%lld",&s[i]);
      |         ~~~~~^~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 276 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 276 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 1 ms 304 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 1 ms 212 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Correct 1 ms 308 KB Output is correct
14 Correct 1 ms 212 KB Output is correct
15 Correct 1 ms 212 KB Output is correct
16 Correct 0 ms 212 KB Output is correct
17 Correct 0 ms 304 KB Output is correct
18 Correct 0 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 276 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 1 ms 304 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 1 ms 212 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Correct 1 ms 308 KB Output is correct
14 Correct 1 ms 212 KB Output is correct
15 Correct 1 ms 212 KB Output is correct
16 Correct 0 ms 212 KB Output is correct
17 Correct 0 ms 304 KB Output is correct
18 Correct 0 ms 212 KB Output is correct
19 Correct 1 ms 340 KB Output is correct
20 Correct 1 ms 340 KB Output is correct
21 Correct 1 ms 340 KB Output is correct
22 Correct 1 ms 468 KB Output is correct
23 Correct 8 ms 4548 KB Output is correct
24 Correct 1 ms 340 KB Output is correct
25 Correct 1 ms 212 KB Output is correct
26 Correct 1 ms 340 KB Output is correct
27 Correct 1 ms 320 KB Output is correct
28 Correct 1 ms 340 KB Output is correct
29 Correct 5 ms 4548 KB Output is correct
30 Correct 3 ms 2504 KB Output is correct