답안 #654233

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
654233 2022-10-30T13:32:46 Z Hanksburger Worst Reporter 3 (JOI18_worst_reporter3) C++17
12 / 100
8 ms 2388 KB
#include <bits/stdc++.h>
#define int long long
using namespace std;
int a[100005], 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()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    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 Runtime error 8 ms 2388 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 344 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Runtime error 8 ms 2388 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -