acgo题库
  • 首页
  • 题库
  • 学习
  • 天梯
  • 备赛

    竞赛

    • CSP-J/S
    • 蓝桥杯

    考级

    • GESP
    • CPA
    • 电子学会考级
  • 资讯
  • 竞赛
  • 讨论
  • 团队
  • 商城
登录
注册
题目详情提交记录(0)
  • 正确解题

    #include <iostream> #include <cstring> #include <algorithm> using namespace std; const int MAXN = 400005; const int BITS = 31; int trie[MAXN * 32][2], tot; int pre[MAXN], leftMax[MAXN], rightMax[MAXN]; void insert(int x) { int node = 0; for (int i = BITS - 1; i >= 0; i--) { int bit = (x >> i) & 1; if (!trie[node][bit]) { trie[node][bit] = ++tot; } node = trie[node][bit]; } } int query(int x) { int node = 0, res = 0; for (int i = BITS - 1; i >= 0; i--) { int bit = (x >> i) & 1; if (trie[node][bit ^ 1]) { res |= (1 << i); node = trie[node][bit ^ 1]; } else { node = trie[node][bit]; } } return res; } int main() { ios::sync_with_stdio(false); cin.tie(nullptr); }

    userId_undefined
    137****8002
    秩序白银
    0阅读
    0回复
    0点赞
暂无数据

提交答案之后,这里将显示提交结果~

首页