제출 #78504

#제출 시각아이디문제언어결과실행 시간메모리
78504nxteruWorst Reporter 3 (JOI18_worst_reporter3)C++14
100 / 100
1180 ms195780 KiB
#include <iostream>
using namespace std;
typedef long long ll;
ll n,q,d[500005],x[500005];
ll bs(ll t,ll p){
    ll l=n+1,r=-1;
    while(l-r>1){
        ll m=(l+r)/2;
        if(t/x[m]*x[m]-m<p)l=m;
        else r=m;
    }
    return r;
}
int main(void){
    scanf("%lld%lld",&n,&q);
    d[0]=1;
    for(int i=1;i<=n;i++)scanf("%lld",d+i);
    x[0]=1;
    for(int i=1;i<=n;i++)x[i]=((d[i]-1+x[i-1])/x[i-1])*x[i-1];
    while(q--){
        ll t,a,b;
        scanf("%lld%lld%lld",&t,&a,&b);
        a=bs(t,a);
        b=bs(t,b+1);
        printf("%lld\n",a-b);
    }
}

컴파일 시 표준 에러 (stderr) 메시지

worst_reporter3.cpp: In function 'int main()':
worst_reporter3.cpp:15:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%lld%lld",&n,&q);
     ~~~~~^~~~~~~~~~~~~~~~~~
worst_reporter3.cpp:17:31: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     for(int i=1;i<=n;i++)scanf("%lld",d+i);
                          ~~~~~^~~~~~~~~~~~
worst_reporter3.cpp:22:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%lld%lld%lld",&t,&a,&b);
         ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...