#include<iostream>
#include<vector>
#include<algorithm>
#include<cmath>
using namespace std;
int main()
{
int n,q;
cin >> n >> q;
int slowness[n+1];
slowness[0]=0;
for(int i=1;i<=n;i++) cin >> slowness[i];
int pattern[n+1];
pattern[0]=1;
pattern[1]=slowness[1];
for(int i=2;i<=n;i++)
{
if(slowness[i]<=slowness[i-1])
pattern [i]=pattern[i-1];
else
{
int k= slowness[i]/pattern[i-1];
if(slowness[i]%pattern[i-1] !=0) k++;
pattern[i]=pattern[i-1]*k;
}
}
while(q--)
{
int L,R,t;
cin >> t >> L >> R ;
int ans=0;
for(int i=0;i<=n;i++)
{
if((t/pattern[i])*pattern[i] -i >=L && (t/pattern[i])*pattern[i] -i <=R) ans +=1;
}
cout << ans << endl;
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
2064 ms |
5496 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
10 ms |
5496 KB |
Output is correct |
2 |
Correct |
11 ms |
5496 KB |
Output is correct |
3 |
Correct |
10 ms |
5496 KB |
Output is correct |
4 |
Correct |
9 ms |
5496 KB |
Output is correct |
5 |
Correct |
9 ms |
5496 KB |
Output is correct |
6 |
Correct |
9 ms |
5496 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
2064 ms |
5496 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |