Submission #78502

#TimeUsernameProblemLanguageResultExecution timeMemory
78502nxteruWorst Reporter 3 (JOI18_worst_reporter3)C++14
19 / 100
1303 ms263168 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); } }

Compilation message (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...