#include<bits/stdc++.h>
using namespace std;
#define int long long
#define ii pair <int, int>
#define app push_back
#define all(a) a.begin(), a.end()
#define bp __builtin_popcountll
#define ll long long
#define mp make_pair
#define f first
#define s second
#define Time (double)clock()/CLOCKS_PER_SEC
#define debug(x) std::cout << #x << ": " << x << '\n';
signed main() {
#ifdef HOME
freopen("input.txt", "r", stdin);
#else
#define endl '\n'
ios_base::sync_with_stdio(0); cin.tie(0);
#endif
int n, q;
cin >> n >> q;
vector <int> d(n);
for (int i = 0; i < n; ++i)
cin >> d[i];
while (q--) {
int t, l, r;
cin >> t >> l >> r;
int ans = 0;
ans += l <= t && t <= r;
int step = 1, cnt = t;
for (int i = 0; i < n; ++i) {
//step * x >= d[i]
int x = (d[i]+step-1)/step;
int step1 = step * x;
int cnt1 = cnt/x;
int to = -i-1 + cnt1 * step1;
ans += l <= to && to <= r;
tie(step, cnt) = mp(step1, cnt1);
}
cout << ans << endl;
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
2075 ms |
5368 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
15 ms |
512 KB |
Output is correct |
2 |
Correct |
15 ms |
384 KB |
Output is correct |
3 |
Correct |
15 ms |
384 KB |
Output is correct |
4 |
Correct |
15 ms |
384 KB |
Output is correct |
5 |
Correct |
15 ms |
384 KB |
Output is correct |
6 |
Correct |
15 ms |
384 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
2075 ms |
5368 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |