답안 #78502

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
78502 2018-10-05T14:03:18 Z nxteru Worst Reporter 3 (JOI18_worst_reporter3) C++14
19 / 100
1303 ms 263168 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 1173 ms 26616 KB Output is correct
2 Correct 1200 ms 42248 KB Output is correct
3 Correct 1150 ms 57584 KB Output is correct
4 Correct 1303 ms 73280 KB Output is correct
5 Correct 1172 ms 88820 KB Output is correct
6 Correct 1136 ms 104328 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 104328 KB Output is correct
2 Correct 3 ms 104328 KB Output is correct
3 Correct 3 ms 104328 KB Output is correct
4 Correct 3 ms 104328 KB Output is correct
5 Correct 3 ms 104328 KB Output is correct
6 Correct 3 ms 104328 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1173 ms 26616 KB Output is correct
2 Correct 1200 ms 42248 KB Output is correct
3 Correct 1150 ms 57584 KB Output is correct
4 Correct 1303 ms 73280 KB Output is correct
5 Correct 1172 ms 88820 KB Output is correct
6 Correct 1136 ms 104328 KB Output is correct
7 Correct 4 ms 104328 KB Output is correct
8 Correct 3 ms 104328 KB Output is correct
9 Correct 3 ms 104328 KB Output is correct
10 Correct 3 ms 104328 KB Output is correct
11 Correct 3 ms 104328 KB Output is correct
12 Correct 3 ms 104328 KB Output is correct
13 Correct 819 ms 118600 KB Output is correct
14 Correct 826 ms 135048 KB Output is correct
15 Correct 806 ms 150200 KB Output is correct
16 Correct 819 ms 166208 KB Output is correct
17 Correct 943 ms 186020 KB Output is correct
18 Correct 958 ms 204736 KB Output is correct
19 Correct 930 ms 223600 KB Output is correct
20 Correct 938 ms 241724 KB Output is correct
21 Correct 971 ms 259456 KB Output is correct
22 Runtime error 955 ms 263168 KB Memory limit exceeded: We have a known bug that the memory usage is measured incorrectly (possibly because of Meltdown/Spectre patch), so your solution may be correct. Please submit again. Sorry for the inconvenience.
23 Halted 0 ms 0 KB -