답안 #321722

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
321722 2020-11-13T05:40:24 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>

using namespace std;

long long all[3005];
map < long long , long long > Con;
set < long long > have,have2;
int main()
{
    long long N,M,K,a,b,c,x,y,z,t,ans=0,con=0,now=0,i;
    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[all[i]]=(all[i]-1)*b;
    }
    con=M;
    for(i=1;i<=N;i++)
    {
        if((i-1)*a<=t) ans++;
        else
        {
            if(have.find(i)!=have.end())
            {
                if((i-1)*b<=t)
                {
                    ans++;
                }
            }
            else
            {
                if((*prev(have.lower_bound(i))-1)*b+(i-*prev(have.lower_bound(i)))*a<=t)
                {
                    ans++;
                    continue;
                }
                if(Con[*prev(have2.lower_bound(i))]+(i-*prev(have2.lower_bound(i)))*a<=t)
                {
                    ans++;
                    continue;
                }
                if(con==K) continue;
                if((i-*prev(have.lower_bound(i)))*c+(*prev(have.lower_bound(i))-1)*b<=t)
                {
                    Con[i]=(i-*prev(have.lower_bound(i)))*c+(*prev(have.lower_bound(i))-1)*b;
                    ans++;
                    con++;
                    have2.insert(i);
                }

                if((i-*prev(have2.lower_bound(i)))*c+Con[(*prev(have.lower_bound(i)))]<=t)
                {
                    Con[i]=(i-*prev(have.lower_bound(i)))*c+(*prev(have.lower_bound(i))-1)*b;
                    ans++;
                    con++;
                    have2.insert(i);
                }
            }
        }
    }
    printf("%lld\n",ans-1);
    return 0;
}

Compilation message

semiexpress.cpp: In function 'int main()':
semiexpress.cpp:16:27: warning: unused variable 'x' [-Wunused-variable]
   16 |     long long N,M,K,a,b,c,x,y,z,t,ans=0,con=0,now=0,i;
      |                           ^
semiexpress.cpp:16:29: warning: unused variable 'y' [-Wunused-variable]
   16 |     long long N,M,K,a,b,c,x,y,z,t,ans=0,con=0,now=0,i;
      |                             ^
semiexpress.cpp:16:31: warning: unused variable 'z' [-Wunused-variable]
   16 |     long long N,M,K,a,b,c,x,y,z,t,ans=0,con=0,now=0,i;
      |                               ^
semiexpress.cpp:16:47: warning: unused variable 'now' [-Wunused-variable]
   16 |     long long N,M,K,a,b,c,x,y,z,t,ans=0,con=0,now=0,i;
      |                                               ^~~
semiexpress.cpp:17:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   17 |     scanf("%lld %lld %lld",&N,&M,&K);
      |     ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
semiexpress.cpp:18:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   18 |     scanf("%lld %lld %lld",&a,&b,&c);
      |     ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
semiexpress.cpp:19:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   19 |     scanf("%lld",&t);
      |     ~~~~~^~~~~~~~~~~
semiexpress.cpp:22:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   22 |         scanf("%lld",&all[i]);
      |         ~~~~~^~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
5 Correct 1 ms 364 KB Output is correct
6 Correct 0 ms 364 KB Output is correct
7 Incorrect 1 ms 364 KB Output isn't correct
8 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
5 Correct 1 ms 364 KB Output is correct
6 Correct 0 ms 364 KB Output is correct
7 Incorrect 1 ms 364 KB Output isn't correct
8 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
5 Correct 1 ms 364 KB Output is correct
6 Correct 0 ms 364 KB Output is correct
7 Incorrect 1 ms 364 KB Output isn't correct
8 Halted 0 ms 0 KB -