# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
94169 | 2019-01-16T12:16:19 Z | autumn_eel | Worst Reporter 3 (JOI18_worst_reporter3) | C++14 | 1116 ms | 12816 KB |
#include <bits/stdc++.h> #define rep(i,n)for(int i=0;i<(n);i++) using namespace std; typedef long long ll; int n; ll d[600000]; ll a[600000]; int calc(ll x,ll T){ ll l=-1,r=n+1; while(r-l>1){ int t=(l+r)/2; if(-t+(T/a[t])*a[t]>=x)l=t; else r=t; } return r; } int main(){ int q;scanf("%d%d",&n,&q); rep(i,n)scanf("%lld",&d[i+1]); a[0]=1; for(int i=1;i<=n;i++){ ll t=(d[i]+a[i-1]-1)/a[i-1]; a[i]=t*a[i-1]; } rep(i,q){ ll t,l,r;scanf("%lld%lld%lld",&t,&l,&r); printf("%d\n",calc(l,t)-calc(r+1,t)); } }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 949 ms | 12792 KB | Output is correct |
2 | Correct | 922 ms | 12664 KB | Output is correct |
3 | Correct | 891 ms | 12540 KB | Output is correct |
4 | Correct | 860 ms | 12664 KB | Output is correct |
5 | Correct | 1116 ms | 12792 KB | Output is correct |
6 | Correct | 933 ms | 12772 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 376 KB | Output is correct |
3 | Correct | 2 ms | 376 KB | Output is correct |
4 | Correct | 3 ms | 376 KB | Output is correct |
5 | Correct | 3 ms | 376 KB | Output is correct |
6 | Correct | 3 ms | 376 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 949 ms | 12792 KB | Output is correct |
2 | Correct | 922 ms | 12664 KB | Output is correct |
3 | Correct | 891 ms | 12540 KB | Output is correct |
4 | Correct | 860 ms | 12664 KB | Output is correct |
5 | Correct | 1116 ms | 12792 KB | Output is correct |
6 | Correct | 933 ms | 12772 KB | Output is correct |
7 | Correct | 0 ms | 376 KB | Output is correct |
8 | Correct | 2 ms | 376 KB | Output is correct |
9 | Correct | 2 ms | 376 KB | Output is correct |
10 | Correct | 3 ms | 376 KB | Output is correct |
11 | Correct | 3 ms | 376 KB | Output is correct |
12 | Correct | 3 ms | 376 KB | Output is correct |
13 | Correct | 658 ms | 10652 KB | Output is correct |
14 | Correct | 661 ms | 9248 KB | Output is correct |
15 | Correct | 715 ms | 10844 KB | Output is correct |
16 | Correct | 748 ms | 10724 KB | Output is correct |
17 | Correct | 755 ms | 10744 KB | Output is correct |
18 | Correct | 755 ms | 10764 KB | Output is correct |
19 | Correct | 781 ms | 10552 KB | Output is correct |
20 | Correct | 777 ms | 10848 KB | Output is correct |
21 | Correct | 791 ms | 10796 KB | Output is correct |
22 | Correct | 758 ms | 10700 KB | Output is correct |
23 | Correct | 760 ms | 10744 KB | Output is correct |
24 | Correct | 800 ms | 10732 KB | Output is correct |
25 | Correct | 928 ms | 12816 KB | Output is correct |
26 | Correct | 1045 ms | 12788 KB | Output is correct |
27 | Correct | 870 ms | 11316 KB | Output is correct |
28 | Correct | 839 ms | 11200 KB | Output is correct |
29 | Correct | 774 ms | 10976 KB | Output is correct |
30 | Correct | 966 ms | 11188 KB | Output is correct |
31 | Correct | 774 ms | 11020 KB | Output is correct |
32 | Correct | 747 ms | 11892 KB | Output is correct |
33 | Correct | 2 ms | 376 KB | Output is correct |