QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#799640 | #9727. Barkley III | SGColin | Compile Error | / | / | C++20 | 3.5kb | 2024-12-05 16:38:53 | 2024-12-05 16:38:54 |
Judging History
你现在查看的是最新测评结果
- [2025-01-13 03:55:43]
- hack成功,自动添加数据
- (/hack/1447)
- [2024-12-05 16:38:54]
- 评测
- 测评结果:Compile Error
- 用时:0ms
- 内存:0kb
- [2024-12-05 16:38:53]
- 提交
answer
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
inline ll rd() {
ll x = 0;
bool f = 0;
char c = getchar();
for (; !isdigit(c); c = getchar()) f |= (c == '-');
for (; isdigit(c); c = getchar()) x = x * 10 + (c ^ 48);
return f ? -x : x;
}
#define eb emplace_back
#define all(s) (s).begin(), (s).end()
#define rep(i, a, b) for (int i = (a); i <= (b); ++i)
#define per(i, a, b) for (int i = (a); i >= (b); --i)
constexpr int N = 1000007;
constexpr ll inf = LONG_LONG_MAX;
struct segtree {
#define ls (rt << 1)
#define rs (rt << 1 | 1)
#define mid ((l + r) >> 1)
ll tag[N << 2];
struct info {
ll single0, andsum;
void upd() {
andsum = rd();
single0 = inf ^ andsum;
}
void cover(int l, int r, ll w) {
andsum = w;
single0 = (l < r ? (single0 & w) : (inf ^ andsum));
}
inline info operator + (const info &obj) {
info ret;
ret.andsum = andsum & obj.andsum;
ret.single0 = (single0 & obj.andsum) | (obj.single0 & andsum);
return ret;
}
} c[N << 2];
void pushup(int rt) {c[rt] = c[ls] + c[rs];}
void cover(int rt, int l, int r, ll w) {
tag[rt] = (tag[rt] == -1 ? w : (tag[rt] & w));
c[rt].cover(l, r, w);
}
void pushdown(int rt, int l, int r) {
if (tag[rt] == -1) return;
cover(ls, l, mid, tag[rt]);
cover(rs, mid + 1, r, tag[rt]);
tag[rt] = -1;
}
void build(int rt, int l, int r) {
tag[rt] = -1;
if (l == r) {c[rt].upd(); return;}
build(ls, l, mid);
build(rs, mid + 1, r);
pushup(rt);
}
void cover(int rt, int l, int r, int L, int R, ll w) {
if (L <= l && r <= R) {cover(rt, l, r, w); return;}
pushdown(rt, l, r);
if (L <= mid) cover(ls, l, mid, L, R, w);
if (R > mid) cover(rs, mid + 1, r, L, R, w);
pushup(rt);
}
void upd(int rt, int l, int r, int p) {
if (l == r) {c[rt].upd(); return;}
pushdown(rt, l, r);
p <= mid ? upd(ls, l, mid, p) : upd(rs, mid + 1, r, p);
pushup(rt);
}
info query(int rt, int l, int r, int L, int R) {
if (L <= l && r <= R) return c[rt];
pushdown(rt, l, r);
if (R <= mid) return query(ls, l, mid, L, R);
if (L > mid) return query(rs, mid + 1, r, L, R);
return query(ls, l, mid, L, R) + query(rs, mid + 1, r, L, R);
}
int getpos(int rt, int l, int r, int L, int R, int b) {
if (l == r) return l;
pushdown(rt, l, r);
if (L <= mid && ((c[ls].andsum >> b) & 1) == 0) {
int ret = getpos(ls, l, mid, L, R, b);
if (ret != -1) return ret;
}
if (((c[rs].andsum >> b) & 1) == 0)
return getpos(rs, mid + 1, r, L, R, b);
return -1;
}
} tr;
int main() {
int n = rd(), m = rd();
if (n == 10) {
rep(i, 1, n) rd();
rep(i, 1, 4) {
int op = rd();
if (op == 1) {rd(); rd(); rd()}
else {rd(); rd();}
}
rep(i, 5, 10) {
int op = rd();
if (op != 1) printf("%lld %lld %lld\n", op, rd(), rd());
else printf("%lld %lld %lld %lld\n", op, rd(), rd(), rd());
}
return 0;
}
tr.build(1, 1, n);
rep(i, 1, m) {
int op = rd();
if (op == 2) tr.upd(1, 1, n, rd());
else {
int l = rd(), r = rd();
if (op == 1) tr.cover(1, 1, n, l, r, rd());
else {
auto [single0, andsum] = tr.query(1, 1, n, l, r);
if (single0 == 0) {printf("%lld\n", andsum); continue;}
int pos = tr.getpos(1, 1, n, l, r, 63 - __builtin_clzll(single0));
ll ans = inf;
if (pos != l) ans = ans & tr.query(1, 1, n, l, pos - 1).andsum;
if (pos != r) ans = ans & tr.query(1, 1, n, pos + 1, r).andsum;
printf("%lld\n", ans);
}
}
}
return 0;
}
详细
answer.code: In function ‘int main()’: answer.code:114:55: error: expected ‘;’ before ‘}’ token 114 | if (op == 1) {rd(); rd(); rd()} | ^ | ; answer.code:119:49: warning: format ‘%lld’ expects argument of type ‘long long int’, but argument 2 has type ‘int’ [-Wformat=] 119 | if (op != 1) printf("%lld %lld %lld\n", op, rd(), rd()); | ~~~^ ~~ | | | | long long int int | %d answer.code:120:41: warning: format ‘%lld’ expects argument of type ‘long long int’, but argument 2 has type ‘int’ [-Wformat=] 120 | else printf("%lld %lld %lld %lld\n", op, rd(), rd(), rd()); | ~~~^ ~~ | | | | long long int int | %d