Submission #878051

#TimeUsernameProblemLanguageResultExecution timeMemory
878051NeroZeinWorst Reporter 3 (JOI18_worst_reporter3)C++17
12 / 100
2041 ms5496 KiB
#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; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...