Submission #94166

#TimeUsernameProblemLanguageResultExecution timeMemory
94166autumn_eelWorst Reporter 3 (JOI18_worst_reporter3)C++14
100 / 100
1109 ms29304 KiB
#include <bits/stdc++.h> #define rep(i,n)for(int i=0;i<(n);i++) #define INF 0x3f3f3f3f #define INFL 0x3f3f3f3f3f3f3f3f #define EPS (1e-10) using namespace std; typedef long long ll; typedef pair<int,int>P; int n; ll d[600000]; ll a[600000];//cycle int calc(ll x,ll T){ ll l=-1,r=n+1; while(r-l>1){ int t=(l+r)/2; if(-t+(T/a[t])*a[t]>=x)l=t; else r=t; } return r; } int main(){ int q;scanf("%d%d",&n,&q); rep(i,n)scanf("%lld",&d[i+1]); a[0]=1; for(int i=1;i<=n;i++){ ll t=(d[i]+a[i-1]-1)/a[i-1]; a[i]=t*a[i-1]; } rep(i,q){ ll t,l,r;scanf("%lld%lld%lld",&t,&l,&r); printf("%d\n",calc(l,t)-calc(r+1,t)); } }

Compilation message (stderr)

worst_reporter3.cpp: In function 'int main()':
worst_reporter3.cpp:25:13: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  int q;scanf("%d%d",&n,&q);
        ~~~~~^~~~~~~~~~~~~~
worst_reporter3.cpp:26:15: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  rep(i,n)scanf("%lld",&d[i+1]);
          ~~~~~^~~~~~~~~~~~~~~~
worst_reporter3.cpp:33:17: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   ll t,l,r;scanf("%lld%lld%lld",&t,&l,&r);
            ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...