이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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;
}
컴파일 시 표준 에러 (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 time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |