Submission #1035033

#TimeUsernameProblemLanguageResultExecution timeMemory
1035033yellowtoadWorst Reporter 3 (JOI18_worst_reporter3)C++17
100 / 100
1125 ms29268 KiB
#include <iostream> using namespace std; long long n, test, a[500010], b[500010], ll, rr, tim, l, r, mid, tmp; int main() { cin >> n >> test; for (int i = 1; i <= n; i++) cin >> a[i]; b[0] = 1; for (int i = 1; i <= n; i++) b[i] = (a[i]+b[i-1]-1)/b[i-1]*b[i-1]; while (test--) { cin >> tim >> ll >> rr; l = 0; r = n; while (l <= r) { mid = (l+r)/2; if ((tim/b[mid])*b[mid]-mid >= ll) l = mid+1; else r = mid-1; } tmp = r; l = 0; r = n; while (l <= r) { mid = (l+r)/2; if ((tim/b[mid])*b[mid]-mid <= rr) r = mid-1; else l = mid+1; } cout << tmp-r << endl; } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...