답안 #798460

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
798460 2023-07-30T17:51:26 Z vjudge1 Worst Reporter 3 (JOI18_worst_reporter3) C++17
100 / 100
438 ms 25288 KB
#ifdef Home
#define _GLIBCXX_DEBUG
#endif // Home

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double ld;

main() {
#ifdef Home
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif // Home
    ios_base::sync_with_stdio(0);
    cin.tie(0);

    ll n, q, T, L, R;
    cin >> n >> q;
    vector < ll > D(n + 1);
    D[0] = 1;
    for(int i = 1; i <= n; ++ i) {
        cin >> D[i];
        D[i] = D[i - 1] * ((D[i] + D[i - 1] - 1) / D[i - 1]);
    }
    for(ll l, r, m, _l, _r, t; q --> 0;) {
        cin >> T >> L >> R;
        /**
        for(int i = 0; i <= n; ++ i) {
            cout << T - T % D[i] - i << ' ';
        }
        cout << '\n';
        // */
        //**
        l = -1, r = n + 1;
        for(; l + 1 < r;) {
            m = (l + r) / 2;
            t = T - T % D[m] - m;
            (t < L ? r : l) = m;
        }
        _r = l;
        l = -1, r = n + 1;
        for(; l + 1 < r;) {
            m = (l + r) / 2;
            t = T - T % D[m] - m;
            (R < t ? l : r) = m;
        }
        _l = r;
        cout << (_l <= _r ? _r - _l + 1 : 0) << '\n';
        // */
    }
}

Compilation message

worst_reporter3.cpp:12:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   12 | main() {
      | ^~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 432 ms 22584 KB Output is correct
2 Correct 429 ms 22580 KB Output is correct
3 Correct 436 ms 22560 KB Output is correct
4 Correct 428 ms 22572 KB Output is correct
5 Correct 427 ms 22688 KB Output is correct
6 Correct 432 ms 22568 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 1 ms 332 KB Output is correct
4 Correct 1 ms 340 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 Correct 432 ms 22584 KB Output is correct
2 Correct 429 ms 22580 KB Output is correct
3 Correct 436 ms 22560 KB Output is correct
4 Correct 428 ms 22572 KB Output is correct
5 Correct 427 ms 22688 KB Output is correct
6 Correct 432 ms 22568 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
8 Correct 1 ms 340 KB Output is correct
9 Correct 1 ms 332 KB Output is correct
10 Correct 1 ms 340 KB Output is correct
11 Correct 1 ms 340 KB Output is correct
12 Correct 1 ms 340 KB Output is correct
13 Correct 259 ms 21244 KB Output is correct
14 Correct 259 ms 21660 KB Output is correct
15 Correct 242 ms 20320 KB Output is correct
16 Correct 254 ms 20892 KB Output is correct
17 Correct 319 ms 25208 KB Output is correct
18 Correct 328 ms 25224 KB Output is correct
19 Correct 324 ms 25264 KB Output is correct
20 Correct 317 ms 25136 KB Output is correct
21 Correct 324 ms 25188 KB Output is correct
22 Correct 319 ms 25288 KB Output is correct
23 Correct 322 ms 25176 KB Output is correct
24 Correct 322 ms 25212 KB Output is correct
25 Correct 429 ms 22624 KB Output is correct
26 Correct 438 ms 22580 KB Output is correct
27 Correct 360 ms 24772 KB Output is correct
28 Correct 341 ms 25072 KB Output is correct
29 Correct 359 ms 24652 KB Output is correct
30 Correct 366 ms 24784 KB Output is correct
31 Correct 353 ms 25008 KB Output is correct
32 Correct 373 ms 21184 KB Output is correct
33 Correct 0 ms 212 KB Output is correct