답안 #654235

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
654235 2022-10-30T13:34:26 Z Hanksburger Worst Reporter 3 (JOI18_worst_reporter3) C++17
100 / 100
1705 ms 8208 KB
#include <bits/stdc++.h>
#define int long long
using namespace std;
int a[500005], n, q;
int f(int t, int x)
{
    int l=0, r=n+1;
    while (l<r)
    {
        int m=(l+r)/2;
        if (t/a[m]*a[m]-m<=x)
            r=m;
        else
            l=m+1;
    }
    return n-r+2;
}
signed main()
{
    cin >> n >> q;
    a[0]=1;
    for (int i=1; i<=n; i++)
    {
        cin >> a[i];
        a[i]=((a[i]-1)/a[i-1]+1)*a[i-1];
    }
    for (int i=1; i<=q; i++)
    {
        int t, l, r;
        cin >> t >> l >> r;
        cout << f(t, r)-f(t, l-1) << '\n';
    }
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1587 ms 8208 KB Output is correct
2 Correct 1658 ms 8064 KB Output is correct
3 Correct 1705 ms 8012 KB Output is correct
4 Correct 1577 ms 7916 KB Output is correct
5 Correct 1627 ms 8008 KB Output is correct
6 Correct 1611 ms 7940 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 212 KB Output is correct
2 Correct 3 ms 212 KB Output is correct
3 Correct 3 ms 212 KB Output is correct
4 Correct 3 ms 212 KB Output is correct
5 Correct 3 ms 212 KB Output is correct
6 Correct 3 ms 316 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1587 ms 8208 KB Output is correct
2 Correct 1658 ms 8064 KB Output is correct
3 Correct 1705 ms 8012 KB Output is correct
4 Correct 1577 ms 7916 KB Output is correct
5 Correct 1627 ms 8008 KB Output is correct
6 Correct 1611 ms 7940 KB Output is correct
7 Correct 3 ms 212 KB Output is correct
8 Correct 3 ms 212 KB Output is correct
9 Correct 3 ms 212 KB Output is correct
10 Correct 3 ms 212 KB Output is correct
11 Correct 3 ms 212 KB Output is correct
12 Correct 3 ms 316 KB Output is correct
13 Correct 1365 ms 6096 KB Output is correct
14 Correct 1364 ms 5220 KB Output is correct
15 Correct 1370 ms 6048 KB Output is correct
16 Correct 1385 ms 5984 KB Output is correct
17 Correct 1501 ms 6560 KB Output is correct
18 Correct 1541 ms 6572 KB Output is correct
19 Correct 1464 ms 6584 KB Output is correct
20 Correct 1519 ms 6744 KB Output is correct
21 Correct 1486 ms 6584 KB Output is correct
22 Correct 1478 ms 6804 KB Output is correct
23 Correct 1511 ms 6776 KB Output is correct
24 Correct 1495 ms 6740 KB Output is correct
25 Correct 1615 ms 7904 KB Output is correct
26 Correct 1651 ms 7944 KB Output is correct
27 Correct 1578 ms 7076 KB Output is correct
28 Correct 1534 ms 6864 KB Output is correct
29 Correct 1534 ms 7016 KB Output is correct
30 Correct 1545 ms 7236 KB Output is correct
31 Correct 1542 ms 6960 KB Output is correct
32 Correct 1455 ms 7456 KB Output is correct
33 Correct 1 ms 212 KB Output is correct