답안 #100458

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
100458 2019-03-11T11:34:44 Z rzbt Worst Reporter 3 (JOI18_worst_reporter3) C++14
7 / 100
996 ms 11416 KB
#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);
    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]>=1e9+7){
            in[i]=1e9+7;
            continue;
        }
        ll nak=(de[i]/de[i-1])+ (de[i]%de[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

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:22: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:38: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);
         ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 900 ms 11168 KB Output is correct
2 Correct 843 ms 11128 KB Output is correct
3 Correct 837 ms 11128 KB Output is correct
4 Correct 978 ms 11416 KB Output is correct
5 Correct 898 ms 11180 KB Output is correct
6 Correct 996 ms 11256 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 384 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Incorrect 3 ms 384 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 900 ms 11168 KB Output is correct
2 Correct 843 ms 11128 KB Output is correct
3 Correct 837 ms 11128 KB Output is correct
4 Correct 978 ms 11416 KB Output is correct
5 Correct 898 ms 11180 KB Output is correct
6 Correct 996 ms 11256 KB Output is correct
7 Correct 3 ms 384 KB Output is correct
8 Correct 2 ms 384 KB Output is correct
9 Incorrect 3 ms 384 KB Output isn't correct
10 Halted 0 ms 0 KB -