답안 #931155

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
931155 2024-02-21T10:14:44 Z De3b0o Semiexpress (JOI17_semiexpress) C++14
48 / 100
1000 ms 235688 KB
#include<bits/stdc++.h>
#define ll long long
#define F first
#define S second
#define in insert
#define er erase
#define pb push_back
#define ppb pop_back()
#define ph push
#define pp pop()
#define d3 ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define cans cout << ans << "\n";
#define yes cout << "YES" << "\n";
#define no cout << "NO" << "\n";
#define pll pair<ll,ll>
#define lin cout << "\n";
#define sqr 340
#define mod 1000000007
#define mid (l+r)/2

using namespace std;

int main()
{
    d3
    ll n , m , k;
    cin >> n >> m >> k;
    ll a , b , c;
    cin >> a >> b >> c;
    ll t;
    cin >> t;
    ll exp[m];
    for(int i = 0 ; m>i ; i++)
        cin >> exp[i];
    ll ans = 0;
    multiset<ll> semi;
    for(int i = 0 ; m-1>i ; i++)
    {
        if((exp[i]-1)*b>t)
            break;
        ll l = exp[i]+1;
        ll r = exp[i+1]-1;
        while(l<=r)
        {
            if((mid-exp[i])*a+(exp[i]-1)*b>t)
                r=mid-1;
            else
                l=mid+1;
        }
        ans+=(l-1-exp[i]+1);
        ll x = l;
        while(x<exp[i+1])
        {
            l = x;
            r = exp[i+1]-1;
            while(l<=r)
            {
                if((exp[i]-1)*b + (x-exp[i])*c + (mid-x)*a >t)
                    r=mid-1;
                else
                    l=mid+1;
            }
            if(l-1==x-1)
                break;
            semi.in(l-1-x+1);
            x=l;
        }
    }
    ll x = k-m;
    while(x--&&!semi.empty())
    {
        auto it = semi.end();
        it--;
        //cout << *it << "\n";
        ans+=*it;
        semi.erase(it);
    }
    if((n-1)*b<=t)
        ans++;
    ans--;
    cans
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 1 ms 348 KB Output is correct
12 Correct 0 ms 344 KB Output is correct
13 Correct 1 ms 456 KB Output is correct
14 Correct 1 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 1 ms 344 KB Output is correct
18 Correct 0 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 1 ms 348 KB Output is correct
12 Correct 0 ms 344 KB Output is correct
13 Correct 1 ms 456 KB Output is correct
14 Correct 1 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 1 ms 344 KB Output is correct
18 Correct 0 ms 348 KB Output is correct
19 Correct 1 ms 348 KB Output is correct
20 Correct 1 ms 348 KB Output is correct
21 Execution timed out 1048 ms 235688 KB Time limit exceeded
22 Halted 0 ms 0 KB -