Submission #1115156

# Submission time Handle Problem Language Result Execution time Memory
1115156 2024-11-20T07:22:11 Z elush Bitaro, who Leaps through Time (JOI19_timeleap) C++14
4 / 100
3000 ms 38604 KB
#include <bits/stdc++.h>
#define x first
#define y second
#define all(v) v.begin(), v.end()
#define chkmax(a, b) a = max(a, b)
#define chkmin(a, b) a = min(a, b)
using namespace std;
typedef long long ll;
typedef vector<ll> vi;
typedef vector<vi> vvi;
typedef pair<ll, ll> pii;
typedef vector<pii> vii;

const int block = 600;
const int MAX_N = 3e5 + 5;

pii dpl[MAX_N], dpr[MAX_N];
vii optl[MAX_N], optr[MAX_N];

void Update(int l, int r) {

}

int Query(int l, int r) {

}

int l[MAX_N], r[MAX_N], t[MAX_N], a[MAX_N], b[MAX_N], c[MAX_N], d[MAX_N];

int main() {
    int n, q;
    cin >> n >> q;
    for (int i = 1; i < n; i++) cin >> l[i] >> r[i];
    for (int i = 0; i < q; i++) {
        cin >> t[i] >> a[i] >> b[i] >> c[i];
        if (t[i] == 2) cin >> d[i];
    }
    for (int i = 0; i < q; i++) {
        if (t[i] == 1) {
            l[a[i]] = b[i], r[a[i]] = c[i];
            continue;
        }
        if (a[i] <= c[i]) {
            ll ti = b[i], ans = 0;
            for (int j = a[i]; j < c[i]; j++) {
                if (ti < l[j]) ti = l[j];
                else if (ti >= r[j]) ans += ti - r[j] + 1, ti = r[j] - 1;
                ti++;
            }
            ans += max<ll>(0, ti - d[i]);
            cout << ans << '\n';
        } else {
            ll ti = b[i], ans = 0;
            for (int j = a[i] - 1; j >= c[i]; j--) {
                if (ti < l[j]) ti = l[j];
                else if (ti >= r[j]) ans += ti - r[j] + 1, ti = r[j] - 1;
                ti++;
            }
            ans += max<ll>(0, ti - d[i]);
            cout << ans << '\n';
        }
    }

}

Compilation message

timeleap.cpp: In function 'int Query(int, int)':
timeleap.cpp:26:1: warning: no return statement in function returning non-void [-Wreturn-type]
   26 | }
      | ^
# Verdict Execution time Memory Grader output
1 Correct 4 ms 22864 KB Output is correct
2 Correct 4 ms 22864 KB Output is correct
3 Correct 4 ms 22864 KB Output is correct
4 Correct 4 ms 22864 KB Output is correct
5 Correct 4 ms 22864 KB Output is correct
6 Correct 4 ms 22880 KB Output is correct
7 Correct 4 ms 23028 KB Output is correct
8 Correct 5 ms 22864 KB Output is correct
9 Correct 4 ms 22864 KB Output is correct
10 Correct 5 ms 22864 KB Output is correct
11 Correct 5 ms 22864 KB Output is correct
12 Correct 6 ms 22864 KB Output is correct
13 Correct 6 ms 22864 KB Output is correct
14 Correct 5 ms 22864 KB Output is correct
15 Correct 6 ms 22864 KB Output is correct
16 Correct 6 ms 23032 KB Output is correct
17 Correct 6 ms 22864 KB Output is correct
18 Correct 6 ms 22864 KB Output is correct
19 Correct 8 ms 22864 KB Output is correct
20 Correct 6 ms 23024 KB Output is correct
21 Correct 6 ms 23028 KB Output is correct
22 Correct 5 ms 22864 KB Output is correct
23 Correct 6 ms 22880 KB Output is correct
24 Correct 6 ms 23024 KB Output is correct
25 Correct 6 ms 22864 KB Output is correct
26 Correct 6 ms 22864 KB Output is correct
27 Correct 6 ms 22864 KB Output is correct
28 Correct 6 ms 22864 KB Output is correct
29 Correct 6 ms 23060 KB Output is correct
30 Correct 6 ms 22864 KB Output is correct
31 Correct 5 ms 22864 KB Output is correct
32 Correct 6 ms 23008 KB Output is correct
33 Correct 6 ms 22864 KB Output is correct
34 Correct 6 ms 22864 KB Output is correct
35 Correct 6 ms 22864 KB Output is correct
36 Correct 8 ms 22864 KB Output is correct
37 Correct 6 ms 22864 KB Output is correct
38 Correct 8 ms 23072 KB Output is correct
39 Correct 6 ms 22864 KB Output is correct
40 Correct 5 ms 23024 KB Output is correct
41 Correct 6 ms 22864 KB Output is correct
# Verdict Execution time Memory Grader output
1 Execution timed out 3032 ms 38604 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 4 ms 22864 KB Output is correct
2 Correct 4 ms 22864 KB Output is correct
3 Correct 4 ms 22864 KB Output is correct
4 Correct 4 ms 22864 KB Output is correct
5 Correct 4 ms 22864 KB Output is correct
6 Correct 4 ms 22880 KB Output is correct
7 Correct 4 ms 23028 KB Output is correct
8 Correct 5 ms 22864 KB Output is correct
9 Correct 4 ms 22864 KB Output is correct
10 Correct 5 ms 22864 KB Output is correct
11 Correct 5 ms 22864 KB Output is correct
12 Correct 6 ms 22864 KB Output is correct
13 Correct 6 ms 22864 KB Output is correct
14 Correct 5 ms 22864 KB Output is correct
15 Correct 6 ms 22864 KB Output is correct
16 Correct 6 ms 23032 KB Output is correct
17 Correct 6 ms 22864 KB Output is correct
18 Correct 6 ms 22864 KB Output is correct
19 Correct 8 ms 22864 KB Output is correct
20 Correct 6 ms 23024 KB Output is correct
21 Correct 6 ms 23028 KB Output is correct
22 Correct 5 ms 22864 KB Output is correct
23 Correct 6 ms 22880 KB Output is correct
24 Correct 6 ms 23024 KB Output is correct
25 Correct 6 ms 22864 KB Output is correct
26 Correct 6 ms 22864 KB Output is correct
27 Correct 6 ms 22864 KB Output is correct
28 Correct 6 ms 22864 KB Output is correct
29 Correct 6 ms 23060 KB Output is correct
30 Correct 6 ms 22864 KB Output is correct
31 Correct 5 ms 22864 KB Output is correct
32 Correct 6 ms 23008 KB Output is correct
33 Correct 6 ms 22864 KB Output is correct
34 Correct 6 ms 22864 KB Output is correct
35 Correct 6 ms 22864 KB Output is correct
36 Correct 8 ms 22864 KB Output is correct
37 Correct 6 ms 22864 KB Output is correct
38 Correct 8 ms 23072 KB Output is correct
39 Correct 6 ms 22864 KB Output is correct
40 Correct 5 ms 23024 KB Output is correct
41 Correct 6 ms 22864 KB Output is correct
42 Execution timed out 3032 ms 38604 KB Time limit exceeded
43 Halted 0 ms 0 KB -