Submission #882198

# Submission time Handle Problem Language Result Execution time Memory
882198 2023-12-02T19:19:31 Z Regulus Food Court (JOI21_foodcourt) C++17
0 / 100
117 ms 8928 KB
#include <bits/stdc++.h>            // pA
#define IO ios::sync_with_stdio(false);cin.tie(0);
#define debug(x) cerr << #x << " = " << (x) << ' '
#define endl cerr << '\n'
#define all(v) (v).begin(), (v).end()
#define SZ(v) (ll)(v).size()
#define lowbit(x) (x)&-(x)
#define pb emplace_back
#define F first
#define S second
using namespace std;
using ll = long long;
using pll = pair<ll, ll>;

const int N = 3e5+5;
//const int INF = 2e9;
ll Seg[N<<2], laz[N<<2];

inline void push(ll v, ll L, ll R)
{
    Seg[v] = max(Seg[v]+laz[v], 0LL);
    if (L != R) laz[v<<1] += laz[v], laz[v<<1|1] += laz[v];
    laz[v] = 0;
}

inline void modify(ll L, ll R, ll ql, ll qr, ll v, ll val)
{
    push(v, L, R);
    if (ql <= L && R <= qr)
    {
        laz[v] += val;
        return;
    }

    int mid((L+R)>>1);
    if (qr <= mid) modify(L, mid, ql, qr, v<<1, val);
    else if (ql > mid) modify(mid+1, R, ql, qr, v<<1|1, val);
    else {
        modify(L, mid, ql, mid, v<<1, val);
        modify(mid+1, R, mid+1, qr, v<<1|1, val);
    }
}

inline ll query(ll L, ll R, ll v, ll pos)
{
    push(v, L, R);
    if (L == R) return Seg[v];
    int mid((L+R)>>1);
    if (pos <= mid) return query(L, mid, v<<1, pos);
    return query(mid+1, R, v<<1|1, pos);
}

int main(void)
{ IO
    ll n, m, Q, t, L, R, c, k, tmp;

    cin >> n >> m >> Q;
    if (m != 1) assert(0);
    do {
        cin >> t;
        if (t == 1)
        {
            cin >> L >> R >> c >> k;
            modify(1, n, L, R, 1, k);
        } else if (t == 2) {
            cin >> L >> R >> k;
            modify(1, n, L, R, 1, -k);
        } else {
            cin >> L >> k;
            tmp = query(1, n, 1, L);
            if (tmp >= k) cout << "1\n";
            else cout << "0\n";
        }
        //for (int i=1; i <= n; ++i) cerr << query(1, n, 1, i) << ' '; endl;
    } while (--Q);

    return 0;
}
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 604 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 604 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 604 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 117 ms 8928 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 604 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 756 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 604 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 604 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -