acgo题库
  • 首页
  • 题库
  • 题单
  • 竞赛
  • 讨论
  • 排行
  • 团队
  • 备赛专区

    竞赛

    • CSP-J/S
    • 蓝桥杯

    考级

    • GESP
    • CPA
    • 电子学会考级
登录
注册
题目详情题解(0)讨论(0)提交记录(0)
  • 好

    #include <iostream> #include <cstdio> #include <bitset> using namespace std; bitset <100001> bits, tmp; int n, m; int main(){ ios::sync_with_stdio(0); cin.tie(0), cout.tie(0); cin >> n >> m; bits.set(); for(int i = 1; i <= n; i++){ tmp.reset(); for(int j = 1; j <= m; j++){ int x; cin >> x; tmp.set(x); } bits &= tmp; } cout << bits.count(); }

    userId_undefined

    bianhl

    贪心·贪心尝试者时间刺客空间掌握者题解仙人分治·分治练习生秩序白银
    40阅读
    16回复
    1点赞
  • 题解

    userId_undefined

    zsy

    出道萌新7月全勤卷王时间刺客时空双修者题解仙人秩序白银
    40阅读
    0回复
    2点赞
  • 好

    众嗦粥汁,如果按题意暴力模拟(即记录所有出现的数,没出现的更新为0)的话,肯定会超时。 但是,STL 有一个神级卡常数据结构:bitset!如果对整个 bitset 进行位运算的话,时间复杂度可以除一个 www。至于这个数是多少得看评测机位数。显然ACGO评测机是 646464 位的,所以 w=64w=64w=64。 我们惊奇的发现:这样子暴力竟然能过!甚至更新 bitset 比输入还快。 时间复杂度:O(nm+n×aiw)O(nm+\frac{n\times a_i}{w})O(nm+wn×ai )。

    userId_undefined

    复仇者_帅童

    小有名气CSP-J一等奖出题人
    23阅读
    1回复
    2点赞
  • T4

    userId_undefined

    156****1040

    时间刺客空间掌握者时空双修者题解仙人
    7阅读
    0回复
    1点赞
  • 题解 100% AC

    userId_undefined

    飞的智动

    题解仙人时空双修者模拟·模拟练习生7月全勤卷王循环·循环打卡人倔强青铜
    6阅读
    0回复
    1点赞
  • C语言

    userId_undefined

    无敌的鳖佬仔给老爷爷ccb

    循环·循环打卡人时间刺客空间掌握者出道萌新I/O·IO入门者荣耀黄金
    8阅读
    0回复
    0点赞
首页