社区讨论

45 分球调

P7076[CSP-S 2020] 动物园参与者 2已保存回复 2

讨论操作

快速查看讨论及其快照的属性,并进行相关操作。

当前回复
2 条
当前快照
1 份
快照标识符
@mhj0298v
此快照首次捕获于
2025/11/03 18:31
4 个月前
此快照最后确认于
2025/11/03 18:31
4 个月前
查看原帖
CPP
#include <bits/stdc++.h>
#define ull unsigned long long
using namespace std;

const int N = 70;

ull n, m, c, k;

int buc[N], lim[N];
ull ans, hv;

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0), cout.tie(0);

	cin >> n >> m >> c >> k;
	for (int i = 1; i <= n; i++) {
        ull x;
        cin >> x;

        for (ull j = 0; j < 64; j++)
            buc[j] |= (x >> j) & 1;
    }

    for (int i = 1; i <= m; i++) {
        ull p, q;
        cin >> p >> q;

        for (ull j = 0; j < 64; j++)
            lim[j] |= (p >> j) & 1;
    }

    for (int i = 0; i < k; i++)
        ans += (!lim[i]) || buc[i];
    
    if (ans == 64 && !n) cout << "18446744073709551616" << endl;
    else cout << (1ull << ans) - n << endl;

    system("pause");
	return 0;
}

回复

2 条回复,欢迎继续交流。

正在加载回复...