QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#866167 | #9726. AUS | ucup-team3646# | Compile Error | / | / | C++20 | 2.6kb | 2025-01-22 13:17:47 | 2025-01-22 13:17:48 |
Judging History
This is the latest submission verdict.
- [2025-01-22 13:17:48]
- Judged
- Verdict: Compile Error
- Time: 0ms
- Memory: 0kb
- [2025-01-22 13:17:47]
- Submitted
answer
template<class S, S (*op)(S, S), S (*e)(),
class F, S (*mp)(F, S), F (*cmpo)(F, F), F (*id)()>
struct lazysegtree {
int N, sz, log;
vector<S> d;
vector<F> lz;
lazysegtree() = default;
lazysegtree(int n) : lazysegtree(vector<S>(n, e())) {};
lazysegtree(vector<S> v) {
N = v.size();
sz = 1, log = 0;
while(sz < N) sz *= 2, log++;
d.assign(2*sz, e());
lz.assign(2*sz, id());
rep(i, N) d[i+sz] = v[i];
for(int i = sz - 1; i > 0; --i) d[i] = op(d[2*i], d[2*i+1]);
}
void update(int k) {d[k] = op(d[2*k], d[2*k+1]);}
void all_apply(int k, F f) {
d[k] = mp(f, d[k]);
if(k < sz) lz[k] = cmpo(f, lz[k]);
}
void push(int k) {
all_apply(2*k, lz[k]);
all_apply(2*k+1, lz[k]);
lz[k] = id();
}
void PUSH(int k) {
for(int i = log; i > 0; --i) push(k >> i);
}
bool shift(int x, int i) {return ((x >> i) << i) != x;}
S prod(int l, int r) {
if(l == r) return e();
l += sz, r += sz;
for(int i = log; i > 0; i--) {
if(shift(l, i)) push(l >> i);
if(shift(r, i)) push((r-1) >> i);
}
S sml = e(), smr = e();
while(l < r) {
if(l & 1) sml = op(sml, d[l++]);
if(r & 1) smr = op(d[--r], smr);
l >>= 1, r >>= 1;
}
return op(sml, smr);
}
void apply(int l, int r, F f) {
if(l == r) return;
l += sz, r += sz;
for(int i = log; i > 0; --i) {
if(shift(l, i)) push(l >> i);
if(shift(r, i)) push((r-1)>>i);
}
int ml = l, mr = r;
while(l < r) {
if(l & 1) all_apply(l++, f);
if(r & 1) all_apply(--r, f);
l >>= 1, r >>= 1;
}
l = ml, r = mr;
rep2(i, 1, log+1) {
if(shift(l, i)) update(l >> i);
if(shift(r, i)) update((r-1)>>i);
}
}
void set(int p, S x) {
p += sz;
PUSH(p);
d[p] = x;
rep2(i, 1, log+1) update(p >> i);
}
S get(int p) {
p += sz;
PUSH(p);
return d[p];
}
void apply(int p, F f) {
p += sz;
PUSH(p);
d[p] = mp(f, d[p]);
rep2(i, 1, log+1) update(p >> i);
}
S all_prod() {return d[1];}
template<typename C>
int max_right(int l, C check) {
assert(check(e()));
if(l == N) return N;
l += sz;
PUSH(l);
S sm = e();
do {
while(~l & l) l >>= 1;
if(!check(op(sm, d[l]))) {
while(l < sz) {
push(l);
l <<= 1;
if(check(op(sm, d[l]))) {
sm = op(sm, d[l]);
l++;
}
}
return l - sz;
}
sm = op(sm, d[l]);
l++;
} while((l & -l) != l);
return N;
}
};
詳細信息
answer.code:5:3: error: ‘vector’ does not name a type 5 | vector<S> d; | ^~~~~~ answer.code:6:3: error: ‘vector’ does not name a type 6 | vector<F> lz; | ^~~~~~ answer.code:10:21: error: expected ‘)’ before ‘<’ token 10 | lazysegtree(vector<S> v) { | ~ ^ | ) answer.code: In member function ‘void lazysegtree<S, op, e, F, mp, cmpo, id>::update(int)’: answer.code:20:23: error: ‘d’ was not declared in this scope; did you mean ‘id’? 20 | void update(int k) {d[k] = op(d[2*k], d[2*k+1]);} | ^ | id answer.code: In member function ‘void lazysegtree<S, op, e, F, mp, cmpo, id>::all_apply(int, F)’: answer.code:22:5: error: ‘d’ was not declared in this scope; did you mean ‘id’? 22 | d[k] = mp(f, d[k]); | ^ | id answer.code:23:16: error: ‘lz’ was not declared in this scope; did you mean ‘sz’? 23 | if(k < sz) lz[k] = cmpo(f, lz[k]); | ^~ | sz answer.code: In member function ‘void lazysegtree<S, op, e, F, mp, cmpo, id>::push(int)’: answer.code:26:20: error: ‘lz’ was not declared in this scope; did you mean ‘sz’? 26 | all_apply(2*k, lz[k]); | ^~ | sz answer.code: In member function ‘S lazysegtree<S, op, e, F, mp, cmpo, id>::prod(int, int)’: answer.code:45:31: error: ‘d’ was not declared in this scope; did you mean ‘id’? 45 | if(l & 1) sml = op(sml, d[l++]); | ^ | id answer.code:46:26: error: ‘d’ was not declared in this scope; did you mean ‘id’? 46 | if(r & 1) smr = op(d[--r], smr); | ^ | id answer.code: In member function ‘void lazysegtree<S, op, e, F, mp, cmpo, id>::apply(int, int, F)’: answer.code:66:10: error: ‘i’ was not declared in this scope; did you mean ‘id’? 66 | rep2(i, 1, log+1) { | ^ | id answer.code:66:5: error: there are no arguments to ‘rep2’ that depend on a template parameter, so a declaration of ‘rep2’ must be available [-fpermissive] 66 | rep2(i, 1, log+1) { | ^~~~ answer.code:66:5: note: (if you use ‘-fpermissive’, G++ will accept your code, but allowing the use of an undeclared name is deprecated) answer.code:66:23: error: expected ‘;’ before ‘{’ token 66 | rep2(i, 1, log+1) { | ^ answer.code: In member function ‘void lazysegtree<S, op, e, F, mp, cmpo, id>::set(int, S)’: answer.code:75:5: error: ‘d’ was not declared in this scope; did you mean ‘id’? 75 | d[p] = x; | ^ | id answer.code:76:10: error: ‘i’ was not declared in this scope; did you mean ‘id’? 76 | rep2(i, 1, log+1) update(p >> i); | ^ | id answer.code:76:5: error: there are no arguments to ‘rep2’ that depend on a template parameter, so a declaration of ‘rep2’ must be available [-fpermissive] 76 | rep2(i, 1, log+1) update(p >> i); | ^~~~ answer.code:76:23: error: expected ‘;’ before ‘update’ 76 | rep2(i, 1, log+1) update(p >> i); | ^~~~~~ answer.code: In member function ‘S lazysegtree<S, op, e, F, mp, cmpo, id>::get(int)’: answer.code:81:12: error: ‘d’ was not declared in this scope; did you mean ‘id’? 81 | return d[p]; | ^ | id answer.code: In member function ‘void lazysegtree<S, op, e, F, mp, cmpo, id>::apply(int, F)’: answer.code:86:5: error: ‘d’ was not declared in this scope; did you mean ‘id’? 86 | d[p] = mp(f, d[p]); | ^ | id answer.code:87:10: error: ‘i’ was not declared in this scope; did you mean ‘id’? 87 | rep2(i, 1, log+1) update(p >> i); | ^ | id answer.code:87:5: error: there are no arguments to ‘rep2’ that depend on a template parameter, so a declaration of ‘rep2’ must be available [-fpermissive] 87 | rep2(i, 1, log+1) update(p >> i); | ^~~~ answer.code:87:23: error: expected ‘;’ before ‘update’ 87 | rep2(i, 1, log+1) update(p >> i); | ^~~~~~ answer.code: In member function ‘S lazysegtree<S, op, e, F, mp, cmpo, id>::all_prod()’: answer.code:89:24: error: ‘d’ was not declared in this scope; did you mean ‘id’? 89 | S all_prod() {return d[1];} | ^ | id answer.code: In member function ‘int lazysegtree<S, op, e, F, mp, cmpo, id>::max_right(int, C)’: answer.code:100:24: error: ‘d’ was not declared in this scope 100 | if(!check(op(sm, d[l]))) { | ^ answer.code:111:19: error: ‘d’ was not declared in this scope 111 | sm = op(sm, d[l]); | ^