Submission #968677

# Submission time Handle Problem Language Result Execution time Memory
968677 2024-04-23T20:03:51 Z raphaelp Worst Reporter 3 (JOI18_worst_reporter3) C++14
100 / 100
1388 ms 29724 KB
#include <bits/stdc++.h>
using namespace std;
int main()
{
    long long N, Q;
    cin >> N >> Q;
    N++;
    vector<long long> Tab(N);
    for (long long i = 1; i < N; i++)
    {
        cin >> Tab[i];
    }
    Tab[0] = 1;
    vector<long long> step(N);
    long long cur = 1;
    for (long long i = 0; i < N; i++)
    {
        cur = cur * ceil((double)Tab[i] / cur);
        step[i] = cur;
    }
    for (long long i = 0; i < Q; i++)
    {
        long long T, L, R;
        cin >> T >> L >> R;
        long long l = 0, r = N;
        if (T - T % step[0] - 0 < L)
            l = -1;
        else
            while (l + 1 != r)
            {
                long long m = (l + r) / 2;
                if (T - T % step[m] - m >= L)
                    l = m;
                else
                    r = m;
            }
        long long temp = l;
        l = 0, r = N;
        if (T - T % step[0] - 0 <= R)
            l = -1;
        else
            while (l + 1 != r)
            {
                long long m = (l + r) / 2;
                if (T - T % step[m] - m > R)
                    l = m;
                else
                    r = m;
            }
        cout << temp - l << '\n';
    }
}
# Verdict Execution time Memory Grader output
1 Correct 1341 ms 26704 KB Output is correct
2 Correct 1311 ms 26592 KB Output is correct
3 Correct 1359 ms 26528 KB Output is correct
4 Correct 1333 ms 26724 KB Output is correct
5 Correct 1319 ms 26552 KB Output is correct
6 Correct 1313 ms 26604 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 348 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 448 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 1341 ms 26704 KB Output is correct
2 Correct 1311 ms 26592 KB Output is correct
3 Correct 1359 ms 26528 KB Output is correct
4 Correct 1333 ms 26724 KB Output is correct
5 Correct 1319 ms 26552 KB Output is correct
6 Correct 1313 ms 26604 KB Output is correct
7 Correct 2 ms 348 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 448 KB Output is correct
11 Correct 2 ms 348 KB Output is correct
12 Correct 2 ms 348 KB Output is correct
13 Correct 1133 ms 25204 KB Output is correct
14 Correct 1166 ms 25676 KB Output is correct
15 Correct 1109 ms 24492 KB Output is correct
16 Correct 1131 ms 24952 KB Output is correct
17 Correct 1286 ms 29376 KB Output is correct
18 Correct 1285 ms 29580 KB Output is correct
19 Correct 1263 ms 29724 KB Output is correct
20 Correct 1267 ms 29268 KB Output is correct
21 Correct 1288 ms 29416 KB Output is correct
22 Correct 1297 ms 29072 KB Output is correct
23 Correct 1336 ms 29180 KB Output is correct
24 Correct 1322 ms 29260 KB Output is correct
25 Correct 1382 ms 26740 KB Output is correct
26 Correct 1330 ms 26572 KB Output is correct
27 Correct 1279 ms 28992 KB Output is correct
28 Correct 1277 ms 29324 KB Output is correct
29 Correct 1316 ms 28500 KB Output is correct
30 Correct 1304 ms 28816 KB Output is correct
31 Correct 1388 ms 29152 KB Output is correct
32 Correct 1213 ms 25180 KB Output is correct
33 Correct 0 ms 348 KB Output is correct