Submission #49387

#TimeUsernameProblemLanguageResultExecution timeMemory
49387okaybody10Worst Reporter 3 (JOI18_worst_reporter3)C++98
100 / 100
1288 ms262144 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; ll a[600000]; int n; int bef(int t,int k) { int l=0,r=n+1; while(l<r) { int mid=(l+r)/2; if(-mid+t/a[mid]*a[mid]>=k) l=mid+1; else r=mid; } return r; } int main() { int q; scanf("%d %d",&n,&q); a[0]=1; for(int i=1;i<=n;i++) { scanf("%lld",&a[i]); a[i]=((a[i]-1)/a[i-1]+1)*a[i-1]; } while(q--) { int t,i,j; scanf("%d %d %d",&t,&i,&j); printf("%d\n",bef(t,i)-bef(t,j+1)); } }

Compilation message (stderr)

worst_reporter3.cpp: In function 'int main()':
worst_reporter3.cpp:19:17: 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:23:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%lld",&a[i]);
         ~~~~~^~~~~~~~~~~~~~
worst_reporter3.cpp:28:25: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         int t,i,j; scanf("%d %d %d",&t,&i,&j);
                    ~~~~~^~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...