QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#882292#9708. Yuuki and a problemgsn531Compile Error//C++262.1kb2025-02-04 23:21:382025-02-04 23:21:39

Judging History

This is the latest submission verdict.

  • [2025-02-04 23:21:39]
  • Judged
  • [2025-02-04 23:21:38]
  • Submitted

answer

#include<bits/stdc++.h>
using namespace std;

#define int long long

#define rep(i, a, b) for(int i = (a); i <= (b); ++i)
#define per(i, a, b) for(int i = (a); i >= (b); --i)
#define lb(x) (x & (-x))

const int maxn = 2e5 + 5;

int n, m, a[maxn], N = 2e5;

int rt[maxn], tot;
struct tree{
    int ch[2]; int sum;
}t[maxn * 600];

inline void updt(int &x, int l, int r, int p, int v){
    if(!x) x = ++tot; t[x].sum += v;
    if(l == r) return;
    int mid = l + r >> 1;
    if(p <= mid) updt(t[x].ch[0], l, mid, p, v);
    else updt(t[x].ch[1], mid + 1, r, p, v);
}
int st[maxn], tp, stt[maxn];
inline int qryr(int l, int r, int L, int R){
    if(l >= L and r <= R){
        int sum = 0;
        rep(i, 1, tp) sum += t[st[i]].sum;
        return sum;
    }
    int mid = l + r >> 1, sum = 0;
    if(L <= mid){
        rep(i, 1, tp) stt[i] = st[i], st[i] = t[st[i]].ch[0];
        sum += qryr(l, mid, L, R);
        rep(i, 1, tp) st[i] = stt[i];
    }
    if(R > mid){
        rep(i, 1, tp) stt[i] = st[i], st[i] = t[st[i]].ch[1];
        sum += qryr(mid + 1, r, L, R);
        rep(i, 1, tp) st[i] = stt[i];
    }
    return sum;
}

inline int qry(int x, int l, int r){
    tp = 0;
    for(int i = x; i; i -= lb(i)) st[++tp] = rt[i];
    return qryr(1, N, l, r);
}

signed main(){
    ios_base::sync_with_stdio(0); cin.tie(NULL);

    cin >> n >> m;
    rep(i, 1, n) cin >> a[i];

    rep(x, 1, n){
        for(int i = x; i <= n; i += lb(i))
            updt(rt[i], 1, N, a[x], a[x]);
    }

    while(m--){
        int op, x, y; cin >> op >> x >> y;
        if(op == 1){
            for(int i = x; i <= n; i += lb(i)){
                updt(rt[i], 1, N, a[x], -a[x]);
                updt(rt[i], 1, N, y, y);
            }
            a[x] = y;
        } else{
            int ans = 1;
            while(true){
                int tmp = qry(y, 1, ans) - qry(x - 1, 1, ans);
                if(tmp >= ans) ans = tmp + 1;
                else break;
            }
            cout << ans << '\n';
        }
    }
    return 0;
}

Details

/tmp/cc1Sece5.o: in function `main':
answer.code:(.text.startup+0x30): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/cc1Sece5.o
answer.code:(.text.startup+0x4e): relocation truncated to fit: R_X86_64_PC32 against symbol `m' defined in .bss section in /tmp/cc1Sece5.o
answer.code:(.text.startup+0x5d): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/cc1Sece5.o
answer.code:(.text.startup+0x6b): relocation truncated to fit: R_X86_64_PC32 against symbol `a' defined in .bss section in /tmp/cc1Sece5.o
answer.code:(.text.startup+0x9a): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/cc1Sece5.o
answer.code:(.text.startup+0xc2): relocation truncated to fit: R_X86_64_PC32 against symbol `tot' defined in .bss section in /tmp/cc1Sece5.o
answer.code:(.text.startup+0xc9): relocation truncated to fit: R_X86_64_PC32 against symbol `a' defined in .bss section in /tmp/cc1Sece5.o
answer.code:(.text.startup+0xd0): relocation truncated to fit: R_X86_64_PC32 against symbol `rt' defined in .bss section in /tmp/cc1Sece5.o
answer.code:(.text.startup+0x193): relocation truncated to fit: R_X86_64_PC32 against symbol `tot' defined in .bss section in /tmp/cc1Sece5.o
answer.code:(.text.startup+0x19a): relocation truncated to fit: R_X86_64_PC32 against symbol `m' defined in .bss section in /tmp/cc1Sece5.o
answer.code:(.text.startup+0x1c8): additional relocation overflows omitted from the output
collect2: error: ld returned 1 exit status