답안 #78504

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
78504 2018-10-05T14:04:56 Z nxteru Worst Reporter 3 (JOI18_worst_reporter3) C++14
100 / 100
1180 ms 195780 KB
#include <iostream>
using namespace std;
typedef long long ll;
ll n,q,d[500005],x[500005];
ll bs(ll t,ll p){
    ll l=n+1,r=-1;
    while(l-r>1){
        ll m=(l+r)/2;
        if(t/x[m]*x[m]-m<p)l=m;
        else r=m;
    }
    return r;
}
int main(void){
    scanf("%lld%lld",&n,&q);
    d[0]=1;
    for(int i=1;i<=n;i++)scanf("%lld",d+i);
    x[0]=1;
    for(int i=1;i<=n;i++)x[i]=((d[i]-1+x[i-1])/x[i-1])*x[i-1];
    while(q--){
        ll t,a,b;
        scanf("%lld%lld%lld",&t,&a,&b);
        a=bs(t,a);
        b=bs(t,b+1);
        printf("%lld\n",a-b);
    }
}

Compilation message

worst_reporter3.cpp: In function 'int main()':
worst_reporter3.cpp:15: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:17:31: 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("%lld",d+i);
                          ~~~~~^~~~~~~~~~~~
worst_reporter3.cpp:22: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 1128 ms 26720 KB Output is correct
2 Correct 1111 ms 30056 KB Output is correct
3 Correct 1124 ms 30056 KB Output is correct
4 Correct 1180 ms 30056 KB Output is correct
5 Correct 1127 ms 30208 KB Output is correct
6 Correct 1069 ms 30208 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 30208 KB Output is correct
2 Correct 3 ms 30208 KB Output is correct
3 Correct 3 ms 30208 KB Output is correct
4 Correct 3 ms 30208 KB Output is correct
5 Correct 3 ms 30208 KB Output is correct
6 Correct 3 ms 30208 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1128 ms 26720 KB Output is correct
2 Correct 1111 ms 30056 KB Output is correct
3 Correct 1124 ms 30056 KB Output is correct
4 Correct 1180 ms 30056 KB Output is correct
5 Correct 1127 ms 30208 KB Output is correct
6 Correct 1069 ms 30208 KB Output is correct
7 Correct 3 ms 30208 KB Output is correct
8 Correct 3 ms 30208 KB Output is correct
9 Correct 3 ms 30208 KB Output is correct
10 Correct 3 ms 30208 KB Output is correct
11 Correct 3 ms 30208 KB Output is correct
12 Correct 3 ms 30208 KB Output is correct
13 Correct 799 ms 30208 KB Output is correct
14 Correct 820 ms 30208 KB Output is correct
15 Correct 808 ms 30208 KB Output is correct
16 Correct 819 ms 30208 KB Output is correct
17 Correct 953 ms 30208 KB Output is correct
18 Correct 957 ms 30208 KB Output is correct
19 Correct 984 ms 30208 KB Output is correct
20 Correct 967 ms 30208 KB Output is correct
21 Correct 925 ms 30208 KB Output is correct
22 Correct 907 ms 30208 KB Output is correct
23 Correct 971 ms 48200 KB Output is correct
24 Correct 978 ms 66560 KB Output is correct
25 Correct 1129 ms 82292 KB Output is correct
26 Correct 1065 ms 97652 KB Output is correct
27 Correct 1072 ms 114704 KB Output is correct
28 Correct 1016 ms 132372 KB Output is correct
29 Correct 948 ms 149176 KB Output is correct
30 Correct 1004 ms 166036 KB Output is correct
31 Correct 1006 ms 182764 KB Output is correct
32 Correct 935 ms 195780 KB Output is correct
33 Correct 2 ms 195780 KB Output is correct