Submission #1035033

# Submission time Handle Problem Language Result Execution time Memory
1035033 2024-07-26T03:19:24 Z yellowtoad Worst Reporter 3 (JOI18_worst_reporter3) C++17
100 / 100
1125 ms 29268 KB
#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 time Memory Grader output
1 Correct 1125 ms 25296 KB Output is correct
2 Correct 1081 ms 25168 KB Output is correct
3 Correct 1065 ms 25308 KB Output is correct
4 Correct 1060 ms 25316 KB Output is correct
5 Correct 1120 ms 25176 KB Output is correct
6 Correct 1041 ms 25456 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 344 KB Output is correct
2 Correct 2 ms 348 KB Output is correct
3 Correct 2 ms 348 KB Output is correct
4 Correct 2 ms 348 KB Output is correct
5 Correct 2 ms 348 KB Output is correct
6 Correct 2 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1125 ms 25296 KB Output is correct
2 Correct 1081 ms 25168 KB Output is correct
3 Correct 1065 ms 25308 KB Output is correct
4 Correct 1060 ms 25316 KB Output is correct
5 Correct 1120 ms 25176 KB Output is correct
6 Correct 1041 ms 25456 KB Output is correct
7 Correct 2 ms 344 KB Output is correct
8 Correct 2 ms 348 KB Output is correct
9 Correct 2 ms 348 KB Output is correct
10 Correct 2 ms 348 KB Output is correct
11 Correct 2 ms 348 KB Output is correct
12 Correct 2 ms 348 KB Output is correct
13 Correct 931 ms 25064 KB Output is correct
14 Correct 909 ms 25536 KB Output is correct
15 Correct 905 ms 24400 KB Output is correct
16 Correct 939 ms 24916 KB Output is correct
17 Correct 975 ms 29072 KB Output is correct
18 Correct 995 ms 29008 KB Output is correct
19 Correct 993 ms 29268 KB Output is correct
20 Correct 995 ms 29008 KB Output is correct
21 Correct 1028 ms 29048 KB Output is correct
22 Correct 1014 ms 29264 KB Output is correct
23 Correct 954 ms 29008 KB Output is correct
24 Correct 982 ms 29192 KB Output is correct
25 Correct 1096 ms 26532 KB Output is correct
26 Correct 1029 ms 26448 KB Output is correct
27 Correct 978 ms 28632 KB Output is correct
28 Correct 942 ms 29068 KB Output is correct
29 Correct 971 ms 28500 KB Output is correct
30 Correct 986 ms 28680 KB Output is correct
31 Correct 977 ms 29044 KB Output is correct
32 Correct 908 ms 25176 KB Output is correct
33 Correct 1 ms 344 KB Output is correct