#include "bits/stdc++.h"
using namespace std;
#ifdef Nero
#include "Deb.h"
#else
#define deb(...)
#endif
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
int n, q;
cin >> n >> q;
vector<long long> a(n);
for (int i = 0; i < n; ++i) {
cin >> a[i];
}
for (int i = 1; i < n; ++i) {
if (a[i] < a[i - 1]) {
a[i] = a[i - 1];
} else {
a[i] = ((a[i] + a[i - 1] - 1) / a[i - 1]) * a[i - 1];
}
}
while (q--) {
int t, l, r;
cin >> t >> l >> r;
int ans = t >= l && t <= r;
for (int i = 0; i < n; ++i) {
int p = t / a[i] * a[i] - i - 1;
ans += p >= l && p <= r;
}
cout << ans << '\n';
}
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
2041 ms |
5496 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
6 ms |
604 KB |
Output is correct |
2 |
Correct |
5 ms |
348 KB |
Output is correct |
3 |
Correct |
5 ms |
348 KB |
Output is correct |
4 |
Correct |
5 ms |
348 KB |
Output is correct |
5 |
Correct |
5 ms |
348 KB |
Output is correct |
6 |
Correct |
5 ms |
348 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
2041 ms |
5496 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |