Submission #67163

# Submission time Handle Problem Language Result Execution time Memory
67163 2018-08-13T12:43:19 Z imeimi2000 Worst Reporter 3 (JOI18_worst_reporter3) C++17
100 / 100
1285 ms 191524 KB
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <unordered_map>
#include <functional>
#include <cstring>
#include <cmath>
#include <ctime>
#include <cstdlib>

using namespace std;
typedef long long llong;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<llong, llong> pll;

int n;
llong d[500001];

int getPos(int i, int t) {
    return i - t / d[i] * d[i];
}

int lowbound(int x, int t) {
    int s = 0, e = n + 1;
    while (s < e) {
        int m = (s + e) / 2;
        if (getPos(m, t) < x) s = m + 1;
        else e = m;
    }
    return s;
}

int main() {
	ios_base::sync_with_stdio(false); cin.tie(0);
	int q;
	cin >> n >> q;
	d[0] = 1;
	for (int i = 1; i <= n; ++i) {
        cin >> d[i];
        d[i] = ((d[i] - 1) / d[i - 1] + 1) * d[i - 1];
	}
	
	while (q--) {
        int t, l, r;
        cin >> t >> l >> r;
        printf("%d\n", lowbound(-l + 1, t) - lowbound(-r, t));
	}
	return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1149 ms 19712 KB Output is correct
2 Correct 1220 ms 19712 KB Output is correct
3 Correct 1285 ms 19712 KB Output is correct
4 Correct 1154 ms 19860 KB Output is correct
5 Correct 1083 ms 19860 KB Output is correct
6 Correct 1033 ms 19860 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 19860 KB Output is correct
2 Correct 3 ms 19860 KB Output is correct
3 Correct 3 ms 19860 KB Output is correct
4 Correct 3 ms 19860 KB Output is correct
5 Correct 3 ms 19860 KB Output is correct
6 Correct 3 ms 19860 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1149 ms 19712 KB Output is correct
2 Correct 1220 ms 19712 KB Output is correct
3 Correct 1285 ms 19712 KB Output is correct
4 Correct 1154 ms 19860 KB Output is correct
5 Correct 1083 ms 19860 KB Output is correct
6 Correct 1033 ms 19860 KB Output is correct
7 Correct 3 ms 19860 KB Output is correct
8 Correct 3 ms 19860 KB Output is correct
9 Correct 3 ms 19860 KB Output is correct
10 Correct 3 ms 19860 KB Output is correct
11 Correct 3 ms 19860 KB Output is correct
12 Correct 3 ms 19860 KB Output is correct
13 Correct 647 ms 19860 KB Output is correct
14 Correct 652 ms 19860 KB Output is correct
15 Correct 599 ms 19860 KB Output is correct
16 Correct 648 ms 19860 KB Output is correct
17 Correct 814 ms 19860 KB Output is correct
18 Correct 791 ms 19860 KB Output is correct
19 Correct 913 ms 19860 KB Output is correct
20 Correct 802 ms 19860 KB Output is correct
21 Correct 846 ms 19860 KB Output is correct
22 Correct 891 ms 19860 KB Output is correct
23 Correct 780 ms 37980 KB Output is correct
24 Correct 783 ms 56732 KB Output is correct
25 Correct 1064 ms 72764 KB Output is correct
26 Correct 1109 ms 88120 KB Output is correct
27 Correct 944 ms 105940 KB Output is correct
28 Correct 796 ms 123800 KB Output is correct
29 Correct 820 ms 141484 KB Output is correct
30 Correct 832 ms 159292 KB Output is correct
31 Correct 946 ms 177376 KB Output is correct
32 Correct 775 ms 191524 KB Output is correct
33 Correct 3 ms 191524 KB Output is correct