博客
关于我
BZOJ 5443 [Ceoi2018]Lottery
阅读量:268 次
发布时间:2019-03-01

本文共 1453 字,大约阅读时间需要 4 分钟。

???????????????????????????k_i???????????????????????????????

????

  • ?????

    • k????????????????????????
    • ??????????????k_i??????????
  • ????

    • ????????????????????????
    • ????????????????????????k????
  • ?????

    • ?????????????k????
    • ??????????????????????
  • ?????

    • ???????????????????
  • ????

    #include 
    #include
    #include
    #include
    #include
    #include
    using namespace std;struct Query { int k, j; int ans_id; Query(int k_val, int j_val) : k(k_val), j(j_val) {}};int main() { // ???? vector
    L = {0, 0, 0, 0}; vector
    Q = {0, 0}; int n, q; // ????????? // ... // ?????????? map
    > substr_dict; for (int i = 0; i <= n; ++i) { for (int j = 0; j <= n - i; ++j) { string s = s[n - i + j ...]; // ????????? int mask = 0; for (int k = 0; k < i; ++k) { if (s[k] != s[k + i]) { mask |= (1 << k); } } substr_dict[mask]++; } } // ?????? for (int q_id = 0; q_id < q; ++q_id) { Query query = Q[q_id]; // ???????????? int count = 0; for (auto& pair : substr_dict) { for (auto& other : substr_dict[pair.first]) { if (pair.second > other) continue; int diff = pair.first ^ other; if (__builtin_popcount(diff) == query.k) { count++; } } } // ???? result[q_id] = count; } // ???? for (int i = 0; i < q; ++i) { cout << result[i] << endl; } return 0;}

    ????

  • ?????

    • ?????????????????????????????
  • ??????

    • ?????????????k??????
    • ???????????????????
  • ???????

    • ????????????k???????
    • ?????????????????
  • ???????????????????????????????????????????????

    转载地址:http://abwo.baihongyu.com/

    你可能感兴趣的文章
    Notepad ++ 安装与配置教程(非常详细)从零基础入门到精通,看完这一篇就够了
    查看>>
    Notepad++在线和离线安装JSON格式化插件
    查看>>
    notepad++最详情汇总
    查看>>
    notepad如何自动对齐_notepad++怎么自动排版
    查看>>
    Notification 使用详解(很全
    查看>>
    NotImplementedError: Cannot copy out of meta tensor; no data! Please use torch.nn.Module.to_empty()
    查看>>
    Now trying to drop the old temporary tablespace, the session hangs.
    查看>>
    nowcoder—Beauty of Trees
    查看>>
    np.arange()和np.linspace()绘制logistic回归图像时得到不同的结果?
    查看>>
    np.power的使用
    查看>>
    NPM 2FA双重认证的设置方法
    查看>>
    npm ERR! ERESOLVE could not resolve报错
    查看>>
    npm error Missing script: “server“npm errornpm error Did you mean this?npm error npm run serve
    查看>>
    npm error MSB3428: 未能加载 Visual C++ 组件“VCBuild.exe”。要解决此问题,1) 安装
    查看>>
    npm install digital envelope routines::unsupported解决方法
    查看>>
    npm install 卡着不动的解决方法
    查看>>
    npm install 报错 EEXIST File exists 的解决方法
    查看>>
    npm install 报错 ERR_SOCKET_TIMEOUT 的解决方法
    查看>>
    npm install 报错 fatal: unable to connect to github.com 的解决方法
    查看>>
    npm install 报错 no such file or directory 的解决方法
    查看>>