답안 #105869

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
105869 2019-04-15T11:51:20 Z Alexa2001 Bitaro, who Leaps through Time (JOI19_timeleap) C++17
4 / 100
261 ms 22820 KB
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
const int Nmax = 3e5 + 5;

int q, n, L[Nmax], R[Nmax], a[Nmax], b[Nmax], c[Nmax], d[Nmax];



void subtask1()
{
    int i, tip, a, b, c, d;

    while(q--)
    {
        cin >> tip >> a >> b >> c;
        if(tip == 2) cin >> d;

        if(tip == 1)
        {
            L[a] = b;
            R[a] = c;
            continue;
        }

        int t = b;
        ll ans = 0;

        if(a <= c)
        {
            for(i=a; i<c; ++i)
            {
                if(t >= R[i]) ans += t - R[i] + 1, t = R[i] - 1;
                    else if(t < L[i]) t = L[i];
                ++t;
            }
            if(t > d) ans += t - d;
        }
        else
        {
            for(i=a; i>c; --i)
            {
                if(t >= R[i-1]) ans += t - R[i-1] + 1, t = R[i-1] - 1;
                    else if(t < L[i-1]) t = L[i-1];
                ++t;
             }
            if(t > d) ans += t - d;
        }

        cout << ans << '\n';
    }
}

int main()
{
   // freopen("input", "r", stdin);
    cin.sync_with_stdio(false);

    int i;

    cin >> n >> q;
    for(i=1; i<n; ++i) cin >> L[i] >> R[i];

    if(n <= 1000 && q <= 1000)
    {
        subtask1();
        exit(0);
    }

    int tip;
    for(i=1; i<=q; ++i) cin >> tip >> a[i] >> b[i] >> c[i] >> d[i];

    //solve();


    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 384 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
3 Correct 3 ms 384 KB Output is correct
4 Correct 3 ms 384 KB Output is correct
5 Correct 2 ms 384 KB Output is correct
6 Correct 2 ms 384 KB Output is correct
7 Correct 3 ms 384 KB Output is correct
8 Correct 3 ms 384 KB Output is correct
9 Correct 2 ms 384 KB Output is correct
10 Correct 3 ms 384 KB Output is correct
11 Correct 4 ms 384 KB Output is correct
12 Correct 4 ms 384 KB Output is correct
13 Correct 4 ms 384 KB Output is correct
14 Correct 5 ms 384 KB Output is correct
15 Correct 4 ms 384 KB Output is correct
16 Correct 4 ms 384 KB Output is correct
17 Correct 4 ms 384 KB Output is correct
18 Correct 4 ms 384 KB Output is correct
19 Correct 4 ms 384 KB Output is correct
20 Correct 4 ms 384 KB Output is correct
21 Correct 5 ms 384 KB Output is correct
22 Correct 4 ms 384 KB Output is correct
23 Correct 5 ms 384 KB Output is correct
24 Correct 5 ms 384 KB Output is correct
25 Correct 5 ms 512 KB Output is correct
26 Correct 5 ms 384 KB Output is correct
27 Correct 5 ms 384 KB Output is correct
28 Correct 5 ms 384 KB Output is correct
29 Correct 6 ms 384 KB Output is correct
30 Correct 5 ms 384 KB Output is correct
31 Correct 4 ms 384 KB Output is correct
32 Correct 0 ms 256 KB Output is correct
33 Correct 5 ms 384 KB Output is correct
34 Correct 5 ms 384 KB Output is correct
35 Correct 4 ms 384 KB Output is correct
36 Correct 5 ms 384 KB Output is correct
37 Correct 4 ms 512 KB Output is correct
38 Correct 4 ms 384 KB Output is correct
39 Correct 5 ms 384 KB Output is correct
40 Correct 4 ms 384 KB Output is correct
41 Correct 2 ms 384 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 261 ms 22820 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 384 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
3 Correct 3 ms 384 KB Output is correct
4 Correct 3 ms 384 KB Output is correct
5 Correct 2 ms 384 KB Output is correct
6 Correct 2 ms 384 KB Output is correct
7 Correct 3 ms 384 KB Output is correct
8 Correct 3 ms 384 KB Output is correct
9 Correct 2 ms 384 KB Output is correct
10 Correct 3 ms 384 KB Output is correct
11 Correct 4 ms 384 KB Output is correct
12 Correct 4 ms 384 KB Output is correct
13 Correct 4 ms 384 KB Output is correct
14 Correct 5 ms 384 KB Output is correct
15 Correct 4 ms 384 KB Output is correct
16 Correct 4 ms 384 KB Output is correct
17 Correct 4 ms 384 KB Output is correct
18 Correct 4 ms 384 KB Output is correct
19 Correct 4 ms 384 KB Output is correct
20 Correct 4 ms 384 KB Output is correct
21 Correct 5 ms 384 KB Output is correct
22 Correct 4 ms 384 KB Output is correct
23 Correct 5 ms 384 KB Output is correct
24 Correct 5 ms 384 KB Output is correct
25 Correct 5 ms 512 KB Output is correct
26 Correct 5 ms 384 KB Output is correct
27 Correct 5 ms 384 KB Output is correct
28 Correct 5 ms 384 KB Output is correct
29 Correct 6 ms 384 KB Output is correct
30 Correct 5 ms 384 KB Output is correct
31 Correct 4 ms 384 KB Output is correct
32 Correct 0 ms 256 KB Output is correct
33 Correct 5 ms 384 KB Output is correct
34 Correct 5 ms 384 KB Output is correct
35 Correct 4 ms 384 KB Output is correct
36 Correct 5 ms 384 KB Output is correct
37 Correct 4 ms 512 KB Output is correct
38 Correct 4 ms 384 KB Output is correct
39 Correct 5 ms 384 KB Output is correct
40 Correct 4 ms 384 KB Output is correct
41 Correct 2 ms 384 KB Output is correct
42 Incorrect 261 ms 22820 KB Output isn't correct
43 Halted 0 ms 0 KB -