博客
关于我
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/

    你可能感兴趣的文章
    Python:用渐进式数字重命名列表中的重复项而不对列表进行排序
    查看>>
    Python:矩形参数无效
    查看>>
    Python:语法进阶
    查看>>
    Python:调用复制函数时调用 Python 对象时超出了最大递归深度
    查看>>
    Python:这两个 import 语句有什么区别?
    查看>>
    Python:通过串口从 Velleman k8090 读取数据
    查看>>
    python:遍历具有列表值的字典
    查看>>
    Python:降低精度 pandas 时间戳数据帧
    查看>>
    python:非阻塞子进程,检查标准输出
    查看>>
    PythonABC多重继承
    查看>>
    Pythonargparse中的多个参数
    查看>>
    Python关于 *args 和 **kwargs 参数的详解(全)
    查看>>
    Pythonfrozenset散列算法/实现
    查看>>
    PythonGTK+3:通过单击列对树视图进行排序
    查看>>
    pythonnumpy生成二进制流_python/numpy生成的二进制文件,由C读取
    查看>>
    pythonsign函数_对python函数签名的方法详解 用python怎么写一个自签名证书
    查看>>
    PythonStudy
    查看>>
    Pythons__IMPORT__未按预期工作
    查看>>
    Pythont通过request以及BeautifulSoup爬取几千条情话
    查看>>
    pythonweb django的学习
    查看>>