Submission #322587

# Submission time Handle Problem Language Result Execution time Memory
322587 2020-11-15T01:49:41 Z daniel920712 Semiexpress (JOI17_semiexpress) C++14
0 / 100
1 ms 364 KB
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <queue>

using namespace std;

long long all[3005];
map < long long , long long > Con;
set < long long > have,have2;
vector < long long > how;
priority_queue < pair < long long , pair < long long , long long > > , vector < pair < long long , pair < long long , long long > > > , less < pair < long long , pair < long long , long long > > > > ttt;
bool F(long long a,long long b)
{
    return a>b;
}
int main()
{
    long long N,M,K,a,b,c,x,y,z,t,ans=0,con=0,now=0,i,l,r;
    scanf("%lld %lld %lld",&N,&M,&K);
    scanf("%lld %lld %lld",&a,&b,&c);
    scanf("%lld",&t);
    for(i=0;i<M;i++)
    {
        scanf("%lld",&all[i]);
        have.insert(all[i]);
        have2.insert(all[i]);
    }

    con=M;
    ans+=t/a;
    for(i=0;i<M-1;i++)
    {
        if((all[i]-1)*b<=t)
        {
            l=all[i];
            r=(t-(all[i]-1)*b)/a+all[i];
            r=min(r,all[i+1]-1);
            if(l<=t/a) ans+=max((long long) 0,(r-t/a));
            else ans+=r-l+1;

            l=r+1;
            Con[l]=(*prev(have.lower_bound(l))-1)*b+c*(l-*prev(have.lower_bound(l)));
            r=min(*have.lower_bound(l)-1,l+(t-Con[l])/a);
            ttt.push(make_pair(r-l+1,make_pair(l,r)));
            //printf("%lld %lld %lld %lld\n",i,l,r,Con[l]);

        }
    }
    //printf("%lld\n",ans);
    while(!ttt.empty()&&con<K)
    {
        con++;
        //printf("aa %lld\n",ttt.top().first);
        ans+=max((long long) 0,ttt.top().first);
        l=ttt.top().second.first;
        r=ttt.top().second.second;
        ttt.pop();
        l=r+1;
        Con[l]=(*prev(have.lower_bound(l))-1)*b+c*(l-*prev(have.lower_bound(l)));
        r=min(*have.lower_bound(l)-1,l+(t-Con[l])/a);
        ttt.push(make_pair(r-l+1,make_pair(l,r)));
    }


    printf("%lld\n",ans);
    return 0;
}

Compilation message

semiexpress.cpp: In function 'int main()':
semiexpress.cpp:23:27: warning: unused variable 'x' [-Wunused-variable]
   23 |     long long N,M,K,a,b,c,x,y,z,t,ans=0,con=0,now=0,i,l,r;
      |                           ^
semiexpress.cpp:23:29: warning: unused variable 'y' [-Wunused-variable]
   23 |     long long N,M,K,a,b,c,x,y,z,t,ans=0,con=0,now=0,i,l,r;
      |                             ^
semiexpress.cpp:23:31: warning: unused variable 'z' [-Wunused-variable]
   23 |     long long N,M,K,a,b,c,x,y,z,t,ans=0,con=0,now=0,i,l,r;
      |                               ^
semiexpress.cpp:23:47: warning: unused variable 'now' [-Wunused-variable]
   23 |     long long N,M,K,a,b,c,x,y,z,t,ans=0,con=0,now=0,i,l,r;
      |                                               ^~~
semiexpress.cpp:24:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   24 |     scanf("%lld %lld %lld",&N,&M,&K);
      |     ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
semiexpress.cpp:25:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   25 |     scanf("%lld %lld %lld",&a,&b,&c);
      |     ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
semiexpress.cpp:26:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   26 |     scanf("%lld",&t);
      |     ~~~~~^~~~~~~~~~~
semiexpress.cpp:29:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   29 |         scanf("%lld",&all[i]);
      |         ~~~~~^~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 364 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 364 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 364 KB Output isn't correct
2 Halted 0 ms 0 KB -