Submission #1035031

#TimeUsernameProblemLanguageResultExecution timeMemory
1035031yellowtoadWorst Reporter 3 (JOI18_worst_reporter3)C++17
19 / 100
1041 ms22772 KiB
#include <iostream> using namespace std; int 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...