Submission #81876

#TimeUsernameProblemLanguageResultExecution timeMemory
81876PajarajaWorst Reporter 3 (JOI18_worst_reporter3)C++17
19 / 100
827 ms263168 KiB
#include <bits/stdc++.h> #define MAXN 500007 using namespace std; int sk[MAXN],d[MAXN]; int bin(int l,int r,int p,int t) { if(l==r) return l; int s=(l+r)/2; if((t/sk[s])*sk[s]-s<=p) return bin(l,s,p,t); return bin(s+1,r,p,t); } int main() { int n,q; scanf("%d%d",&n,&q); sk[0]=1; sk[n+1]=2000000000; for(int i=1;i<=n;i++) scanf("%d",&d[i]); for(int i=1;i<=n;i++) sk[i]=((d[i]-1)/sk[i-1]+1)*sk[i-1]; for(int i=0;i<q;i++) { int t,l,r; scanf("%d%d%d",&t,&l,&r); printf("%d\n",-bin(0,n+1,r,t)+bin(0,n+1,l-1,t)); } }

Compilation message (stderr)

worst_reporter3.cpp: In function 'int main()':
worst_reporter3.cpp:15:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d%d",&n,&q);
  ~~~~~^~~~~~~~~~~~~~
worst_reporter3.cpp:17:29: 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("%d",&d[i]);
                        ~~~~~^~~~~~~~~~~~
worst_reporter3.cpp:22:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d%d%d",&t,&l,&r);
   ~~~~~^~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...