Submission #100511

#TimeUsernameProblemLanguageResultExecution timeMemory
100511rzbtWorst Reporter 3 (JOI18_worst_reporter3)C++14
100 / 100
994 ms29404 KiB
#include <bits/stdc++.h> #define MAXN 500005 using namespace std; typedef long long ll; ll n,q; ll de[MAXN]; ll in[MAXN]; ll binarna(ll l,ll d,ll cilj,ll vreme,ll sol){ if(l>d)return sol; ll mid=(l+d)/2; //printf(" %lld %lld",mid,in[mid]); if(vreme-(vreme%in[mid])-mid>=cilj)return binarna(mid+1,d,cilj,vreme,mid); else return binarna(l,mid-1,cilj,vreme,sol); } int main() { scanf("%lld %lld", &n, &q); //freopen("lul.txt","w",stdout); for(ll i=1;i<=n;i++) scanf("%lld",de+i); in[1]=de[1]; //printf(" %lld\n",in[1]); for(ll i=2;i<=n;i++){ //printf(" %lld %lld\n",de[i],de[i-1]); if(in[i-1]>=5000000007ll){ in[i]=5000000007ll; continue; } ll nak=(de[i]/in[i-1])+ (de[i]%in[i-1]?1:0); in[i]=nak*in[i-1]; //printf(" %lld\n",in[i]); } while(q--){ ll t,a,b; scanf("%lld %lld %lld", &t, &a, &b); ll tres=binarna(1,n,a,t,0)-binarna(1,n,b+1,t,0); if(t>=a && t<=b)tres++; printf("%lld\n",tres); } return 0; }

Compilation message (stderr)

worst_reporter3.cpp: In function 'int main()':
worst_reporter3.cpp:20: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:23:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%lld",de+i);
         ~~~~~^~~~~~~~~~~~~
worst_reporter3.cpp:39: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...