Submission #1035031

# Submission time Handle Problem Language Result Execution time Memory
1035031 2024-07-26T03:17:28 Z yellowtoad Worst Reporter 3 (JOI18_worst_reporter3) C++17
19 / 100
1041 ms 22772 KB
#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 time Memory Grader output
1 Correct 1016 ms 22644 KB Output is correct
2 Correct 1041 ms 22612 KB Output is correct
3 Correct 1000 ms 22612 KB Output is correct
4 Correct 953 ms 22612 KB Output is correct
5 Correct 1022 ms 22772 KB Output is correct
6 Correct 959 ms 22616 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 2396 KB Output is correct
2 Correct 2 ms 2396 KB Output is correct
3 Correct 2 ms 2396 KB Output is correct
4 Correct 2 ms 2396 KB Output is correct
5 Correct 2 ms 2396 KB Output is correct
6 Correct 2 ms 2496 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1016 ms 22644 KB Output is correct
2 Correct 1041 ms 22612 KB Output is correct
3 Correct 1000 ms 22612 KB Output is correct
4 Correct 953 ms 22612 KB Output is correct
5 Correct 1022 ms 22772 KB Output is correct
6 Correct 959 ms 22616 KB Output is correct
7 Correct 2 ms 2396 KB Output is correct
8 Correct 2 ms 2396 KB Output is correct
9 Correct 2 ms 2396 KB Output is correct
10 Correct 2 ms 2396 KB Output is correct
11 Correct 2 ms 2396 KB Output is correct
12 Correct 2 ms 2496 KB Output is correct
13 Runtime error 124 ms 13032 KB Execution killed with signal 8
14 Halted 0 ms 0 KB -